diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index e3361fff0..3fabb044d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -96,6 +96,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } mIsPasswordProtectionPending = config.appPasswordProtectionOn + setupLatestMediaId() } override fun onStart() { @@ -553,9 +554,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun gotDirectories(newDirs: ArrayList, isFromCache: Boolean) { if (!isFromCache) { - Thread { - mLatestMediaId = getLatestMediaId() - }.start() + setupLatestMediaId() } val dirs = getSortedDirectories(newDirs) @@ -633,6 +632,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun getBubbleTextItem(index: Int) = getRecyclerAdapter().dirs.getOrNull(index)?.getBubbleText() ?: "" + private fun setupLatestMediaId() { + Thread { + mLatestMediaId = getLatestMediaId() + }.start() + } + private fun checkLastMediaChanged() { if (isActivityDestroyed()) return diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 719d96721..adb3702e1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -113,8 +113,9 @@ class MediaFetcher(val context: Context) { private fun getSelectionArgsQuery(path: String): Array? { return if (path.isEmpty()) { - if (context.isAndroidFour()) + if (context.isAndroidFour()) { return null + } if (context.hasExternalSDCard()) { arrayOf("${context.internalStoragePath}/%", "${context.sdCardPath}/%")