mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
handle whole bitmap saving in edit activity on a background thread
This commit is contained in:
parent
f63a8eebac
commit
88d8f39118
1 changed files with 8 additions and 9 deletions
|
@ -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 {
|
||||||
|
Thread {
|
||||||
|
val file = File(path)
|
||||||
getFileOutputStream(file) {
|
getFileOutputStream(file) {
|
||||||
if (it != null) {
|
if (it != null) {
|
||||||
Thread {
|
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in a new issue