From 065f2acee439237ac1f49afe4f302f940b269fdc Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 29 Jun 2018 23:15:44 +0200 Subject: [PATCH] handle un/hide icon toggling --- .../gallery/activities/ViewPagerActivity.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index dd932a64f..757be841e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -522,7 +522,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - private fun toggleFileVisibility(hide: Boolean) { + private fun toggleFileVisibility(hide: Boolean, callback: (() -> Unit)? = null) { toggleFileVisibility(getCurrentPath(), hide) { val newFileName = it.getFilenameFromPath() supportActionBar?.title = newFileName @@ -533,6 +533,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View getCurrentMedia()[mPos] = this } invalidateOptionsMenu() + callback?.invoke() } } @@ -844,7 +845,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View bottom_toggle_file_visibility.beVisibleIf(visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY != 0) bottom_toggle_file_visibility.setOnClickListener { if (bottom_actions.alpha == 1f) { - + getCurrentMedium()?.apply { + toggleFileVisibility(!isHidden()) { + updateBottomActionIcons(getCurrentMedium()!!) + } + } } } }