mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Don't hide side nav when opening ActionToolbar on tablets
This commit is contained in:
parent
ef53d4ec07
commit
fa872f6cf7
@ -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
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
||||
binding.toolbarLayout.appbar.addOnOffsetChangedListener(
|
||||
AppBarLayout.OnOffsetChangedListener { _, verticalOffset ->
|
||||
if (verticalOffset == 0) {
|
||||
showNav(true)
|
||||
showNav(visible = true)
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -451,7 +451,13 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
||||
}
|
||||
}
|
||||
|
||||
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<MainActivityBinding>() {
|
||||
bottomViewNavigationBehavior?.slideDown(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSideNav(visible: Boolean) {
|
||||
binding.sideNav?.let {
|
||||
it.isVisible = visible
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user