rescan files after renaming

This commit is contained in:
tibbi 2017-05-26 15:58:30 +02:00
parent 0075346411
commit 9f143f2be6
2 changed files with 12 additions and 3 deletions

View file

@ -29,5 +29,5 @@ ext {
propMinSdkVersion = 16
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '2.18.1'
propVersionName = '2.18.2'
}

View file

@ -269,11 +269,20 @@ fun BaseSimpleActivity.renameFile(oldFile: File, newFile: File, callback: (succe
return@handleSAFDialog
}
callback(document.canWrite() && document.renameTo(newFile.name))
val success = document.canWrite() && document.renameTo(newFile.name)
if (success) {
scanFiles(arrayListOf(oldFile, newFile)) {
callback(true)
}
} else {
callback(false)
}
}
} else if (oldFile.renameTo(newFile)) {
newFile.setLastModified(System.currentTimeMillis())
callback(true)
scanFiles(arrayListOf(oldFile, newFile)) {
callback(true)
}
} else {
callback(false)
}