Skip to content

Commit 4bee97f

Browse files
committed
properly handle negative callback of handleSAFDialog
1 parent e18cce9 commit 4bee97f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/adapters/ItemsAdapter.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
397397
CompressAsDialog(activity, firstPath) {
398398
val destination = it
399399
activity.handleSAFDialog(firstPath) {
400+
if (!it) {
401+
return@handleSAFDialog
402+
}
403+
400404
activity.toast(R.string.compressing)
401405
val paths = getSelectedFileDirItems().map { it.path }
402406
Thread {
@@ -422,6 +426,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
422426
}
423427

424428
activity.handleSAFDialog(firstPath) {
429+
if (!it) {
430+
return@handleSAFDialog
431+
}
432+
425433
val paths = getSelectedFileDirItems().asSequence().map { it.path }.filter { it.isZipFile() }.toList()
426434
tryDecompressingPaths(paths) {
427435
if (it) {
@@ -608,6 +616,10 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
608616
}
609617

610618
activity.handleSAFDialog(SAFPath) {
619+
if (!it) {
620+
return@handleSAFDialog
621+
}
622+
611623
val files = ArrayList<FileDirItem>(selectedKeys.size)
612624
val positions = ArrayList<Int>()
613625
selectedKeys.forEach {

app/src/main/kotlin/com/simplemobiletools/filemanager/pro/dialogs/CreateNewItemDialog.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
5151
private fun createDirectory(path: String, alertDialog: AlertDialog, callback: (Boolean) -> Unit) {
5252
when {
5353
activity.needsStupidWritePermissions(path) -> activity.handleSAFDialog(path) {
54+
if (!it) {
55+
return@handleSAFDialog
56+
}
57+
5458
val documentFile = activity.getDocumentFile(path.getParentPath())
5559
if (documentFile == null) {
5660
val error = String.format(activity.getString(R.string.could_not_create_folder), path)
@@ -83,6 +87,10 @@ class CreateNewItemDialog(val activity: SimpleActivity, val path: String, val ca
8387
when {
8488
activity.needsStupidWritePermissions(path) -> {
8589
activity.handleSAFDialog(path) {
90+
if (!it) {
91+
return@handleSAFDialog
92+
}
93+
8694
val documentFile = activity.getDocumentFile(path.getParentPath())
8795
if (documentFile == null) {
8896
val error = String.format(activity.getString(R.string.could_not_create_file), path)

0 commit comments

Comments
 (0)