Merge pull request #3773 from Bnyro/master

Deselect all bottom nav items when home tab not among them
This commit is contained in:
Bnyro 2023-05-15 14:27:10 +02:00 committed by GitHub
commit 4652b36a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
*/