do not update file last modified after a file operation, if it is zero

This commit is contained in:
tibbi 2022-05-21 16:59:16 +02:00
parent 50d022c31d
commit 335f3f5fc5
3 changed files with 6 additions and 6 deletions

View file

@ -78,11 +78,11 @@ android {
} }
dependencies { 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 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' 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.android.exoplayer:exoplayer-core:2.9.6'
implementation 'com.google.vr:sdk-panowidget:1.180.0' implementation 'com.google.vr:sdk-panowidget:1.180.0'
implementation 'com.google.vr:sdk-videowidget:1.180.0' implementation 'com.google.vr:sdk-videowidget:1.180.0'

View file

@ -1077,7 +1077,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
rescanPaths(paths) { rescanPaths(paths) {
fixDateTaken(paths, false) fixDateTaken(paths, false)
if (config.keepLastModified) { if (config.keepLastModified && lastModified != 0L) {
File(file.absolutePath).setLastModified(lastModified) File(file.absolutePath).setLastModified(lastModified)
updateLastModified(file.absolutePath, lastModified) updateLastModified(file.absolutePath, lastModified)
} }

View file

@ -360,7 +360,7 @@ fun BaseSimpleActivity.movePathsInRecycleBin(paths: ArrayList<String>, callback:
mediaDB.updateDeleted("$RECYCLE_BIN$source", System.currentTimeMillis(), source) mediaDB.updateDeleted("$RECYCLE_BIN$source", System.currentTimeMillis(), source)
pathsCnt-- pathsCnt--
if (config.keepLastModified) { if (config.keepLastModified && lastModified != 0L) {
internalFile.setLastModified(lastModified) internalFile.setLastModified(lastModified)
} }
} }
@ -435,7 +435,7 @@ fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList<String>, callback
} }
newPaths.add(destination) newPaths.add(destination)
if (config.keepLastModified) { if (config.keepLastModified && lastModified != 0L) {
File(destination).setLastModified(lastModified) File(destination).setLastModified(lastModified)
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -692,7 +692,7 @@ fun Activity.tryRotateByExif(path: String, degrees: Int, showToasts: Boolean, ca
} }
fun Activity.fileRotatedSuccessfully(path: String, lastModified: Long) { fun Activity.fileRotatedSuccessfully(path: String, lastModified: Long) {
if (config.keepLastModified) { if (config.keepLastModified && lastModified != 0L) {
File(path).setLastModified(lastModified) File(path).setLastModified(lastModified)
updateLastModified(path, lastModified) updateLastModified(path, lastModified)
} }