1private fun setupNav() {
2 val navController = findNavController(R.id.nav_host_fragment)
3 findViewById<BottomNavigationView>(R.id.bottomNav)
4 .setupWithNavController(navController)
5
6 navController.addOnDestinationChangedListener { _, destination, _ ->
7 when (destination.id) {
8 R.id.mainFragment -> showBottomNav()
9 R.id.mineFragment -> showBottomNav()
10 else -> hideBottomNav()
11 }
12 }
13}
14
15private fun showBottomNav() {
16 bottomNav.visibility = View.VISIBLE
17
18}
19
20private fun hideBottomNav() {
21 bottomNav.visibility = View.GONE
22
23}