fix a glitch with wrong Last Modified at file moving
This commit is contained in:
parent
383dd09fe3
commit
b9178c4702
1 changed files with 14 additions and 5 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue