From d0bf93ebb706811707b956a22b051b6b2bbe02c9 Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Thu, 22 Apr 2021 04:43:53 +0700 Subject: [PATCH] MainActivity: Show bottom nav when the tab page is changed (#4914) * MainActivity: Show bottom nav when the tab page is changed * Revert "MainActivity: Show bottom nav when the tab page is changed" This reverts commit 27fd73db * MainActivity: Show bottom nav when the app bar is fully expanded --- .../java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index 0865205403..1d8d93d557 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -130,6 +130,15 @@ class MainActivity : BaseViewBindingActivity() { tabAnimator = ViewHeightAnimator(binding.tabs, 0L) bottomNavAnimator = ViewHeightAnimator(binding.bottomNav) + // If bottom nav is hidden, make it visible again when the app bar is expanded + binding.appbar.addOnOffsetChangedListener( + AppBarLayout.OnOffsetChangedListener { _, verticalOffset -> + if (verticalOffset == 0) { + showBottomNav(true) + } + } + ) + // Set behavior of bottom nav preferences.hideBottomBar() .asImmediateFlow { setBottomNavBehaviorOnScroll() }