catch out of memory errors at saving images with filters

This commit is contained in:
tibbi 2018-07-23 21:11:41 +02:00
parent 84a13be72f
commit 8c72bebe72

View file

@ -228,9 +228,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
bottom_actions_filter_list.beGone() bottom_actions_filter_list.beGone()
Thread { Thread {
try {
val originalBitmap = Glide.with(applicationContext).asBitmap().load(uri).submit(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).get() val originalBitmap = Glide.with(applicationContext).asBitmap().load(uri).submit(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).get()
currentFilter.filter.processFilter(originalBitmap) currentFilter.filter.processFilter(originalBitmap)
saveBitmapToFile(originalBitmap, it, false) saveBitmapToFile(originalBitmap, it, false)
} catch (e: OutOfMemoryError) {
toast(R.string.out_of_memory_error)
}
}.start() }.start()
} }
} }