From 335f3f5fc5fdafa1f6f279a44522766a22ca871a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 21 May 2022 16:59:16 +0200 Subject: [PATCH] do not update file last modified after a file operation, if it is zero --- app/build.gradle | 4 ++-- .../gallery/pro/activities/ViewPagerActivity.kt | 2 +- .../simplemobiletools/gallery/pro/extensions/Activity.kt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bfde8b072..d8524e197 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -78,11 +78,11 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:18b7775e55' + implementation 'com.github.SimpleMobileTools:Simple-Commons:795a4ae3e3' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6' implementation 'com.google.vr:sdk-panowidget:1.180.0' implementation 'com.google.vr:sdk-videowidget:1.180.0' 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 780ce879b..6a0360e9d 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 @@ -1077,7 +1077,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View rescanPaths(paths) { fixDateTaken(paths, false) - if (config.keepLastModified) { + if (config.keepLastModified && lastModified != 0L) { File(file.absolutePath).setLastModified(lastModified) updateLastModified(file.absolutePath, lastModified) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 2d3608ebd..1796690d0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -360,7 +360,7 @@ fun BaseSimpleActivity.movePathsInRecycleBin(paths: ArrayList, callback: mediaDB.updateDeleted("$RECYCLE_BIN$source", System.currentTimeMillis(), source) pathsCnt-- - if (config.keepLastModified) { + if (config.keepLastModified && lastModified != 0L) { internalFile.setLastModified(lastModified) } } @@ -435,7 +435,7 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, callback } newPaths.add(destination) - if (config.keepLastModified) { + if (config.keepLastModified && lastModified != 0L) { File(destination).setLastModified(lastModified) } } catch (e: Exception) { @@ -692,7 +692,7 @@ fun Activity.tryRotateByExif(path: String, degrees: Int, showToasts: Boolean, ca } fun Activity.fileRotatedSuccessfully(path: String, lastModified: Long) { - if (config.keepLastModified) { + if (config.keepLastModified && lastModified != 0L) { File(path).setLastModified(lastModified) updateLastModified(path, lastModified) }