From 0ee20b46045af826972e6d93a073db5b9b882b32 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 26 Apr 2017 20:09:08 +0200 Subject: [PATCH] show the "Temporarily show hidden" menu item only when hidden media arent shown --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 ++ .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 3 +++ 2 files changed, 5 insertions(+) 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 73fcde9a0..3c8f40b80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -78,6 +78,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { menu.findItem(R.id.increase_column_count).isVisible = config.dirColumnCnt < 10 menu.findItem(R.id.reduce_column_count).isVisible = config.dirColumnCnt > 1 } + menu.findItem(R.id.temporarily_show_hidden).isVisible = !config.showHiddenMedia return true } @@ -106,6 +107,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mDirs.clear() } tryloadGallery() + invalidateOptionsMenu() } override fun onPause() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 57ab19dd6..06e1fb9c4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -76,6 +76,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mMedia.clear() } tryloadGallery() + invalidateOptionsMenu() } override fun onPause() { @@ -133,6 +134,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { findItem(R.id.open_camera).isVisible = mShowAll findItem(R.id.about).isVisible = mShowAll + findItem(R.id.temporarily_show_hidden).isVisible = !config.showHiddenMedia + findItem(R.id.increase_column_count).isVisible = config.mediaColumnCnt < 10 findItem(R.id.reduce_column_count).isVisible = config.mediaColumnCnt > 1 }