From 51260d351f1d160e7b5825722d6977c09f4e2cc6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 10 Aug 2019 21:59:39 +0200 Subject: [PATCH] fix #1523, check SAF dialog at restoring recycle bin items to SD cards --- .../gallery/pro/extensions/Activity.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt index 274d4f147..339e37a35 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Activity.kt @@ -256,11 +256,15 @@ fun BaseSimpleActivity.restoreRecycleBinPath(path: String, callback: () -> Unit) fun BaseSimpleActivity.restoreRecycleBinPaths(paths: ArrayList, mediumDao: MediumDao = galleryDB.MediumDao(), callback: () -> Unit) { ensureBackgroundThread { val newPaths = ArrayList() - paths.forEach { - val source = it - val destination = it.removePrefix(recycleBinPath) + for (source in paths) { + val destination = source.removePrefix(recycleBinPath) val lastModified = File(source).lastModified() + val isShowingSAF = handleSAFDialog(destination) {} + if (isShowingSAF) { + return@ensureBackgroundThread + } + var inputStream: InputStream? = null var out: OutputStream? = null try {