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 {