From 64b4fdece3a16eed444c49f823ac6094f11d9e0a Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Mar 2018 19:15:55 +0100 Subject: [PATCH] create the bitmap at saving rotated image only when necessary --- .../simplemobiletools/gallery/activities/ViewPagerActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index f65de839c..55705a928 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -534,7 +534,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val tmpFile = File(filesDir, ".tmp_${newPath.getFilenameFromPath()}") try { - val bitmap = BitmapFactory.decodeFile(oldPath) getFileOutputStream(tmpFile.toFileDirItem(applicationContext)) { if (it == null) { toast(R.string.unknown_error_occurred) @@ -546,6 +545,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View copyFile(getCurrentFile(), tmpFile) saveExifRotation(ExifInterface(tmpFile.absolutePath)) } else { + val bitmap = BitmapFactory.decodeFile(oldPath) saveFile(tmpFile, bitmap, it as FileOutputStream) }