Class BottomNavBarController

java.lang.Object
com.kernelcrew.moodapp.ui.BottomNavBarController
All Implemented Interfaces:
com.google.android.material.navigation.NavigationBarView.OnItemSelectedListener

public class BottomNavBarController extends Object implements com.google.android.material.navigation.NavigationBarView.OnItemSelectedListener
Controller to manage a bottom nav bar. Construct in the onCreateView callback with a NavigationBarView fetched via findViewById. Call bind(view) in the onViewCreated callback.
  • Constructor Details

    • BottomNavBarController

      public BottomNavBarController(com.google.android.material.navigation.NavigationBarView navigationBar)
  • Method Details

    • bind

      public void bind(@NonNull View view)
      Must be called in the onViewCreated callback because the view needs to have a nav host controller connected to it.
      Parameters:
      view - View passed to onViewCreated
    • onNavigationItemSelected

      public boolean onNavigationItemSelected(@NonNull MenuItem item)
      Specified by:
      onNavigationItemSelected in interface com.google.android.material.navigation.NavigationBarView.OnItemSelectedListener