This file contains hidden or 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 hidden or 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 hidden or 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) | |
} | |
//--------- |
NewerOlder