From d0b4b33466899477f41357e691cbe34a997e0812 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Tue, 22 Jun 2021 22:25:19 -0400 Subject: [PATCH] Some fixes to temporarily showing/hiding the reading menu in some cases like showing system bars or opening notification drawer etc. --- .../tachiyomi/ui/reader/ReaderActivity.kt | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index a772a8506c..e48d9de7c8 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -303,20 +303,6 @@ class ReaderActivity : super.onSaveInstanceState(outState) } - /** - * Called when the window focus changes. It sets the menu visibility to the last known state - * to apply again System UI (for immersive mode). - */ - override fun onWindowFocusChanged(hasFocus: Boolean) { - super.onWindowFocusChanged(hasFocus) - if (hasFocus) { - when (menuStickyVisible) { - true -> setMenuVisibility(false) - false -> setMenuVisibility(menuVisible, animate = false) - } - } - } - /** * Called when the options menu of the binding.toolbar is being created. It adds our custom menu. */ @@ -1290,7 +1276,7 @@ class ReaderActivity : } override fun onVisibilityChange(visible: Boolean) { - if (visible && !menuStickyVisible && !menuVisible) { + if (visible && !menuStickyVisible && !menuVisible && !binding.readerMenu.isVisible) { menuStickyVisible = visible if (visible) { coroutine = launchUI { @@ -1313,9 +1299,9 @@ class ReaderActivity : ) binding.appBar.startAnimation(toolbarAnimation) } - } else { + } else if (!visible && (menuStickyVisible || menuVisible)) { if (menuStickyVisible && !menuVisible) { - setMenuVisibility(false, animate = false) + setMenuVisibility(false) } coroutine?.cancel() }