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!!,
|
actionMode!!,
|
||||||
R.menu.library_selection
|
R.menu.library_selection
|
||||||
) { onActionItemClicked(it!!) }
|
) { 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())
|
selectionRelay.call(LibrarySelectionEvent.Cleared())
|
||||||
|
|
||||||
binding.actionToolbar.hide()
|
binding.actionToolbar.hide()
|
||||||
(activity as? MainActivity)?.showNav(visible = true, collapse = true)
|
(activity as? MainActivity)?.showBottomNav(visible = true, collapse = true)
|
||||||
|
|
||||||
actionMode = null
|
actionMode = null
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
binding.toolbarLayout.appbar.addOnOffsetChangedListener(
|
binding.toolbarLayout.appbar.addOnOffsetChangedListener(
|
||||||
AppBarLayout.OnOffsetChangedListener { _, verticalOffset ->
|
AppBarLayout.OnOffsetChangedListener { _, verticalOffset ->
|
||||||
if (verticalOffset == 0) {
|
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 {
|
binding.bottomNav?.let {
|
||||||
val layoutParams = it.layoutParams as CoordinatorLayout.LayoutParams
|
val layoutParams = it.layoutParams as CoordinatorLayout.LayoutParams
|
||||||
val bottomViewNavigationBehavior =
|
val bottomViewNavigationBehavior =
|
||||||
@ -470,7 +476,9 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
|
|||||||
bottomViewNavigationBehavior?.slideDown(it)
|
bottomViewNavigationBehavior?.slideDown(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showSideNav(visible: Boolean) {
|
||||||
binding.sideNav?.let {
|
binding.sideNav?.let {
|
||||||
it.isVisible = visible
|
it.isVisible = visible
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ class UpdatesController :
|
|||||||
actionMode!!,
|
actionMode!!,
|
||||||
R.menu.updates_chapter_selection
|
R.menu.updates_chapter_selection
|
||||||
) { onActionItemClicked(it!!) }
|
) { onActionItemClicked(it!!) }
|
||||||
(activity as? MainActivity)?.showNav(visible = false, collapse = true)
|
(activity as? MainActivity)?.showBottomNav(visible = false, collapse = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleSelection(position)
|
toggleSelection(position)
|
||||||
@ -380,7 +380,7 @@ class UpdatesController :
|
|||||||
adapter?.clearSelection()
|
adapter?.clearSelection()
|
||||||
|
|
||||||
binding.actionToolbar.hide()
|
binding.actionToolbar.hide()
|
||||||
(activity as? MainActivity)?.showNav(visible = true, collapse = true)
|
(activity as? MainActivity)?.showBottomNav(visible = true, collapse = true)
|
||||||
|
|
||||||
actionMode = null
|
actionMode = null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user