Hello I want to hide Floating action bar button and bottom app bar in certain fragments , have tried different ways but I cannot get it to work. Is it even possible to do that or do I have to stick with regular navigation bar
val bottomNavigationMenu = findViewById<BottomNavigationView>(R.id.bottomNavMenu)
val bottomAppBar = findViewById<BottomAppBar>(R.id.bottomAppBar)
bottomNavigationMenu.background = null
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
val controller = navHostFragment.navController
bottomNavigationMenu.setupWithNavController(navController = controller) // setting up navigation bar
bottomAppBar.setupWithNavController(navController = controller)
// HIDING NAVIGATION BAR IN CERTAIN FRAGMENTS
controller.addOnDestinationChangedListener { _: NavController, navDestination: NavDestination, _: Bundle? ->
when (navDestination.id) {
R.id.loginFragment, R.id.registrationFragment, R.id.passwordResetFragment, R.id.messageFragment, R.id.passwordChangeFragment, R.id.createMessageFragment -> bottomNavigationMenu.visibility =
GONE
R.id.loginFragment, R.id.registrationFragment, R.id.passwordResetFragment, R.id.messageFragment, R.id.passwordChangeFragment, R.id.createMessageFragment -> bottomAppBar.visibility = GONE
else -> bottomNavigationMenu.visibility = VISIBLE
}
}