From 247b41445dde211386dfce8ee8df647da4687b5c Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 13 Jan 2019 20:19:54 +0100 Subject: [PATCH] properly retrieve old last_modified at rotating files by exif --- .../gallery/pro/activities/ViewPagerActivity.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index c6811570a..0d09d339d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -665,7 +665,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View @TargetApi(Build.VERSION_CODES.N) private fun tryRotateByExif(path: String): Boolean { return try { + val file = File(path) + val oldLastModified = file.lastModified() if (saveImageRotation(path, mRotationDegrees)) { + if (config.keepLastModified) { + file.setLastModified(oldLastModified) + updateLastModified(path, oldLastModified) + } mRotationDegrees = 0 invalidateOptionsMenu() toast(R.string.file_saved)