From d0e81a341003ffc317fc8899193b5b693b19081c Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 5 Dec 2016 23:17:02 +0100 Subject: [PATCH] wait for mediascanner at some callbacks --- .../com/simplemobiletools/gallery/dialogs/CopyDialog.kt | 7 ++++--- .../simplemobiletools/gallery/dialogs/RenameFileDialog.kt | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt index 50a221186..45c27ef17 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt @@ -91,9 +91,10 @@ class CopyDialog(val activity: SimpleActivity, val files: ArrayList, val c updatedFiles.add(destination) } - context.scanFiles(updatedFiles) {} - dismiss() - copyMoveListener.copySucceeded(true, files.size * 2 == updatedFiles.size) + context.scanFiles(updatedFiles) { + dismiss() + copyMoveListener.copySucceeded(true, files.size * 2 == updatedFiles.size) + } } } }) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt index fc9dd2fd4..9f78a797a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/RenameFileDialog.kt @@ -4,9 +4,9 @@ import android.app.AlertDialog import android.view.LayoutInflater import android.view.WindowManager import com.simplemobiletools.filepicker.extensions.* -import com.simplemobiletools.gallery.helpers.Config import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity +import com.simplemobiletools.gallery.helpers.Config import kotlinx.android.synthetic.main.rename_file.view.* import java.io.File @@ -73,7 +73,8 @@ class RenameFileDialog(val activity: SimpleActivity, val file: File, val callbac private fun sendSuccess(currFile: File, newFile: File) { val changedFiles = arrayListOf(currFile, newFile) - activity.scanFiles(changedFiles) {} - callback.invoke(newFile) + activity.scanFiles(changedFiles) { + callback.invoke(newFile) + } } }