fix a glitch with wrong Last Modified at file moving

This commit is contained in:
tibbi 2022-05-03 09:55:54 +02:00
parent 383dd09fe3
commit b9178c4702

View file

@ -282,6 +282,7 @@ class CopyMoveTask(
activity.updateSDK30Uris(fileUris) {
updateLastModifiedValues(source, destination)
activity.rescanPath(destination.path)
deleteSourceFile(source)
}
} else {
updateLastModifiedValues(source, destination)
@ -294,17 +295,20 @@ class CopyMoveTask(
activity.updateSDK30Uris(fileUris) {
updateLastModifiedValues(source, destination)
activity.rescanPath(destination.path)
inputStream.close()
out?.close()
deleteSourceFile(source)
}
} else {
updateLastModifiedValues(source, destination)
inputStream.close()
out?.close()
deleteSourceFile(source)
}
}
if (!copyOnly) {
} else {
inputStream.close()
out?.close()
activity.deleteFileBg(source, isDeletingMultipleFiles = false)
activity.deleteFromMediaStore(source.path)
deleteSourceFile(source)
}
}
} catch (e: Exception) {
@ -320,6 +324,11 @@ class CopyMoveTask(
File(destination.path).setLastModified(File(source.path).lastModified())
}
private fun deleteSourceFile(source: FileDirItem) {
activity.deleteFileBg(source, isDeletingMultipleFiles = false)
activity.deleteFromMediaStore(source.path)
}
private fun copyOldLastModified(sourcePath: String, destinationPath: String) {
val projection = arrayOf(
MediaStore.Images.Media.DATE_TAKEN,