mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
do not delete the image if rotating fails, related to #234
This commit is contained in:
parent
6810b3f68b
commit
dfc99e68e4
1 changed files with 5 additions and 3 deletions
|
@ -233,10 +233,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
val currPath = getCurrentPath()
|
val currPath = getCurrentPath()
|
||||||
SaveAsDialog(this, currPath) {
|
SaveAsDialog(this, currPath) {
|
||||||
try {
|
try {
|
||||||
val file = File(it)
|
val selectedFile = File(it)
|
||||||
|
val tmpFile = File(selectedFile.parent, "tmp_${it.getFilenameFromPath()}")
|
||||||
val bitmap = BitmapFactory.decodeFile(currPath)
|
val bitmap = BitmapFactory.decodeFile(currPath)
|
||||||
getFileOutputStream(file) {
|
getFileOutputStream(tmpFile) {
|
||||||
saveFile(file, bitmap, it)
|
saveFile(tmpFile, bitmap, it)
|
||||||
|
renameFile(tmpFile, selectedFile) { }
|
||||||
}
|
}
|
||||||
} catch (e: OutOfMemoryError) {
|
} catch (e: OutOfMemoryError) {
|
||||||
toast(R.string.out_of_memory_error)
|
toast(R.string.out_of_memory_error)
|
||||||
|
|
Loading…
Reference in a new issue