This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val compositeDisposable = CompositeDisposable() | |
private val photoChangeState: Subject<Boolean> = PublishSubject.create() | |
private var isPhotoChanged: Boolean = false | |
set(value) { | |
field = value | |
photoChangeState.onNext(value) | |
} | |
//--------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ImageProcessor { | |
private const val MAX_IMAGE_DIMENSION = 1920 | |
private const val COMPRESS_QUALITY = 100 | |
@Throws(IOException::class) | |
fun saveImageWithFixFromUri(context: Context, uri: Uri, filePath: String) { | |
val bitmap = getFixedImageFromUri(context, uri) | |
saveBitmapToFile(bitmap, filePath) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val b = BitmapFactory.decodeFile(filePath) | |
val stream = ByteArrayOutputStream() | |
b.compress(Bitmap.CompressFormat.JPEG, 100, stream) | |
val ba = stream.toByteArray() | |
photoPart = RequestBody.create(MediaType.parse("image/jpeg"), ba) | |
body = MultipartBody.Part.createFormData("Photo", "Photo.jpg", photoPart!!) | |
val part = RequestBody.create(MediaType.parse("text/plain"), text) | |
@Multipart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun loadPdf(url: String) = Observable.fromCallable { | |
val request = Request.Builder().url(url).build() | |
val call = coreNetwork.getOkHttp().newCall(request) | |
call.execute().body()!!.source().inputStream() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Bundle | |
import android.view.Menu | |
import android.view.View | |
import androidx.core.view.isVisible | |
import com.arellomobile.mvp.presenter.InjectPresenter | |
import com.arellomobile.mvp.presenter.ProvidePresenter | |
import kotlinx.android.synthetic.main.image_viewer.* | |
import javax.inject.Inject | |
import kotlin.math.abs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.webkit.WebView | |
import android.webkit.WebResourceRequest | |
import android.os.Build | |
import android.annotation.TargetApi | |
import android.content.ActivityNotFoundException | |
import android.content.Context | |
import android.webkit.WebViewClient | |
import android.content.Intent | |
import android.net.Uri |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var text: String | |
get() = editText.text.toString() | |
set(value) { | |
editText.setText(value, TextView.BufferType.EDITABLE) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.LayoutInflater | |
import androidx.constraintlayout.widget.ConstraintLayout | |
import kotlinx.android.synthetic.main.avatar_icon.view.* | |
class AvatarIcon(context: Context, attrs: AttributeSet?) : ConstraintLayout(context, attrs) { | |
private var mask: Int? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
package="..."> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<application | |
android:name="..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccessTokenAuthenticator : Authenticator { | |
@Throws(IOException::class) | |
override fun authenticate(route: Route?, response: Response): Request? { | |
val token = AuthProvider.getTokenInfoFromCache()?.refreshToken?.token | |
val coreNetworkComponent = CoreNetworkComponent.get() | |
synchronized(this) { | |
if (token != null) { |
OlderNewer