From b0a26d0bd8edd89153331d99b52e3eb20b90eb41 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 22 Apr 2018 22:08:27 +0200 Subject: [PATCH] update UI at picker dialogs from the main thread --- .../simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt | 4 +++- .../com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index e31b4b260..1ee74ba96 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -42,7 +42,9 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri activity.getCachedDirectories { if (it.isNotEmpty()) { - gotDirectories(activity.addTempFolderIfNeeded(it)) + activity.runOnUiThread { + gotDirectories(activity.addTempFolderIfNeeded(it)) + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt index 88845a539..0daec8e55 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickMediumDialog.kt @@ -39,7 +39,9 @@ class PickMediumDialog(val activity: BaseSimpleActivity, val path: String, val c activity.getCachedMedia(path) { val media = it.filter { !it.isVideo() } as ArrayList if (media.isNotEmpty()) { - gotMedia(media) + activity.runOnUiThread { + gotMedia(media) + } } }