diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 3e41d4ab9..2909574be 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -367,7 +367,7 @@ class LibraryController( actionMode!!, R.menu.library_selection ) { onActionItemClicked(it!!) } - (activity as? MainActivity)?.showNav(visible = false, collapse = true) + (activity as? MainActivity)?.showBottomNav(visible = false, collapse = true) } } @@ -476,7 +476,7 @@ class LibraryController( selectionRelay.call(LibrarySelectionEvent.Cleared()) binding.actionToolbar.hide() - (activity as? MainActivity)?.showNav(visible = true, collapse = true) + (activity as? MainActivity)?.showBottomNav(visible = true, collapse = true) actionMode = null } 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 bfe56ff4c..8e92225c0 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 @@ -140,7 +140,7 @@ class MainActivity : BaseViewBindingActivity() { binding.toolbarLayout.appbar.addOnOffsetChangedListener( AppBarLayout.OnOffsetChangedListener { _, verticalOffset -> if (verticalOffset == 0) { - showNav(true) + showNav(visible = true) } } ) @@ -451,7 +451,13 @@ class MainActivity : BaseViewBindingActivity() { } } - fun showNav(visible: Boolean, collapse: Boolean = false) { + private fun showNav(visible: Boolean, collapse: Boolean = false) { + showBottomNav(visible, collapse) + showSideNav(visible) + } + + // Also used from some controllers to swap bottom nav with action toolbar + fun showBottomNav(visible: Boolean, collapse: Boolean = false) { binding.bottomNav?.let { val layoutParams = it.layoutParams as CoordinatorLayout.LayoutParams val bottomViewNavigationBehavior = @@ -470,7 +476,9 @@ class MainActivity : BaseViewBindingActivity() { bottomViewNavigationBehavior?.slideDown(it) } } + } + private fun showSideNav(visible: Boolean) { binding.sideNav?.let { it.isVisible = visible } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt index 11e8ab777..33077968a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt @@ -182,7 +182,7 @@ class UpdatesController : actionMode!!, R.menu.updates_chapter_selection ) { onActionItemClicked(it!!) } - (activity as? MainActivity)?.showNav(visible = false, collapse = true) + (activity as? MainActivity)?.showBottomNav(visible = false, collapse = true) } toggleSelection(position) @@ -380,7 +380,7 @@ class UpdatesController : adapter?.clearSelection() binding.actionToolbar.hide() - (activity as? MainActivity)?.showNav(visible = true, collapse = true) + (activity as? MainActivity)?.showBottomNav(visible = true, collapse = true) actionMode = null }