mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
handle whole bitmap saving in edit activity on a background thread
This commit is contained in:
@ -184,18 +184,17 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun saveBitmapToFile(bitmap: Bitmap, path: String) {
|
private fun saveBitmapToFile(bitmap: Bitmap, path: String) {
|
||||||
val file = File(path)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getFileOutputStream(file) {
|
Thread {
|
||||||
if (it != null) {
|
val file = File(path)
|
||||||
Thread {
|
getFileOutputStream(file) {
|
||||||
|
if (it != null) {
|
||||||
saveBitmap(file, bitmap, it)
|
saveBitmap(file, bitmap, it)
|
||||||
}.start()
|
} else {
|
||||||
} else {
|
toast(R.string.image_editing_failed)
|
||||||
toast(R.string.image_editing_failed)
|
}
|
||||||
}
|
}
|
||||||
}
|
}.start()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
} catch (e: OutOfMemoryError) {
|
} catch (e: OutOfMemoryError) {
|
||||||
|
Reference in New Issue
Block a user