fix: renaming folders in gallery

- use SAF when renaming folders on SDK 30+,
- for those folders that cannot be accessed with SAF, display an error immediately
This commit is contained in:
darthpaul 2022-06-18 13:29:47 +01:00
parent 11288f0e8c
commit 6c41c30cf0

View file

@ -930,7 +930,7 @@ fun BaseSimpleActivity.renameFile(
}
}
} else if (isAccessibleWithSAFSdk30(oldPath)) {
if (canManageMedia() && isPathOnInternalStorage(oldPath)) {
if (canManageMedia() && !File(oldPath).isDirectory && isPathOnInternalStorage(oldPath)) {
renameCasually(oldPath, newPath, isRenamingMultipleFiles, callback)
} else {
handleSAFDialogSdk30(oldPath) {
@ -953,6 +953,11 @@ fun BaseSimpleActivity.renameFile(
}
}
}
} else if (isRestrictedWithSAFSdk30(oldPath)) {
runOnUiThread {
toast(R.string.rename_in_sd_card_system_restriction)
callback?.invoke(false, Android30RenameFormat.NONE)
}
} else if (needsStupidWritePermissions(newPath)) {
handleSAFDialog(newPath) {
if (!it) {