Deselect all bottom nav items when home tab not among them

This commit is contained in:
Bnyro 2023-05-15 14:27:13 +02:00
parent 5b6b1a3dfa
commit f29013427c

View File

@ -131,6 +131,8 @@ class MainActivity : BaseActivity() {
false
}
if (binding.bottomNav.menu.children.none { it.itemId == startFragmentId }) deselectBottomBarItems()
binding.toolbar.title = ThemeHelper.getStyledAppName(this)
// handle error logs
@ -179,6 +181,17 @@ class MainActivity : BaseActivity() {
loadIntentData()
}
/**
* Deselect all bottom bar items
*/
fun deselectBottomBarItems() {
binding.bottomNav.menu.setGroupCheckable(0, true, false)
for (child in binding.bottomNav.menu.children) {
child.isChecked = false
}
binding.bottomNav.menu.setGroupCheckable(0, true, true)
}
/**
* Try to find a scroll or recycler view and scroll it back to the top
*/