From cb17ab5b974bf5021cc5639db683687b033522ab Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Apr 2018 15:01:24 +0200 Subject: [PATCH] make sure the directory placeholder is visible only when appropriate --- .../gallery/activities/MainActivity.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 ac235a8a5..29a18a406 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -554,9 +554,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { var isPlaceholderVisible = dirs.isEmpty() runOnUiThread { - directories_empty_text_label.beVisibleIf(dirs.isEmpty() && config.appRunCount > 1) - directories_empty_text.beVisibleIf(dirs.isEmpty() && config.appRunCount > 1) - directories_grid.beVisibleIf(directories_empty_text_label.isGone()) + checkPlaceholderVisibility(dirs) val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFiles == VIEW_TYPE_GRID directories_vertical_fastscroller.beVisibleIf(directories_grid.isVisible() && !allowHorizontalScroll) @@ -646,10 +644,17 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { runOnUiThread { directories_refresh_layout.isRefreshing = false directories_vertical_fastscroller.measureRecyclerView() + checkPlaceholderVisibility(dirs) } }.start() } + private fun checkPlaceholderVisibility(dirs: ArrayList) { + directories_empty_text_label.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) + directories_empty_text.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos) + directories_grid.beVisibleIf(directories_empty_text_label.isGone()) + } + private fun showSortedDirs(dirs: ArrayList) { val sortedDirs = getSortedDirectories(dirs).clone() as ArrayList runOnUiThread {