com.google.android.material.bottomnavigation.BottomNavigationView Java Examples

The following examples show how to use com.google.android.material.bottomnavigation.BottomNavigationView. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainActivity.java    From webrtc_android with MIT License 11 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    BottomNavigationView navView = findViewById(R.id.nav_view);
    NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
    AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
            R.id.navigation_user, R.id.navigation_room, R.id.navigation_setting)
            .build();

    // 設置ActionBar跟随联动
    NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
    // 设置Nav跟随联动
    NavigationUI.setupWithNavController(navView, navController);


    // 设置登录状态回调
    SocketManager.getInstance().addUserStateCallback(this);

}
 
Example #2
Source File: SkinMaterialBottomNavigationView.java    From Android-skin-support with MIT License 6 votes vote down vote up
public SkinMaterialBottomNavigationView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mBackgroundTintHelper = new SkinCompatBackgroundHelper(this);
    mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomNavigationView, defStyleAttr,
            R.style.Widget_Design_BottomNavigationView);

    if (a.hasValue(R.styleable.BottomNavigationView_itemIconTint)) {
        mIconTintResId = a.getResourceId(R.styleable.BottomNavigationView_itemIconTint, INVALID_ID);
    } else {
        mDefaultTintResId = resolveColorPrimary();
    }
    if (a.hasValue(R.styleable.BottomNavigationView_itemTextColor)) {
        mTextColorResId = a.getResourceId(R.styleable.BottomNavigationView_itemTextColor, INVALID_ID);
    } else {
        mDefaultTintResId = resolveColorPrimary();
    }
    a.recycle();
    applyItemIconTintResource();
    applyItemTextColorResource();
}
 
Example #3
Source File: BottomNavigationActivity.java    From aptoide-client-v8 with GNU General Public License v3.0 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(LAYOUT);
  navigationSubject = PublishSubject.create();
  bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation);
  getActivityComponent().inject(this);
  if (savedInstanceState != null) {
    bottomNavigationNavigator.setBottomNavigationItems(
        savedInstanceState.getIntegerArrayList(ITEMS_LIST_KEY));
  }
  bottomNavigationView.setOnNavigationItemSelectedListener(item -> {
    navigationSubject.onNext(item.getItemId());
    return true;
  });
  animationup = AnimationUtils.loadAnimation(this, R.anim.slide_up);
  animationdown = AnimationUtils.loadAnimation(this, R.anim.slide_down);
  toggleBottomNavigation(); //Here because of the SettingsFragment that doesn't extend the BaseFragment
}
 
Example #4
Source File: BottomNavigationDemoFragment.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
private void setupBadging() {
  for (BottomNavigationView bn : bottomNavigationViews) {
    int menuItemId = bn.getMenu().getItem(0).getItemId();
    // An icon only badge will be displayed.
    BadgeDrawable badge = bn.getOrCreateBadge(menuItemId);
    badge.setVisible(true);

    menuItemId = bn.getMenu().getItem(1).getItemId();
    // A badge with the text "99" will be displayed.
    badge = bn.getOrCreateBadge(menuItemId);
    badge.setVisible(true);
    badge.setNumber(99);

    menuItemId = bn.getMenu().getItem(2).getItemId();
    // A badge with the text "999+" will be displayed.
    badge = bn.getOrCreateBadge(menuItemId);
    badge.setVisible(true);
    badge.setNumber(9999);
  }
}
 
Example #5
Source File: DynamicFragment.java    From dynamic-support with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (getActivity() == null) {
        return;
    }

    if (isSupportActionBar()) {
        ((AppCompatActivity) requireActivity()).getSupportActionBar().setTitle(getTitle());
        ((AppCompatActivity) requireActivity()).getSupportActionBar().setSubtitle(getSubtitle());
    }

    if (getCheckedMenuItemId() != DynamicResourceUtils.ADS_DEFAULT_RESOURCE_ID) {
        if (requireActivity().findViewById(getBottomNavigationViewId()) != null) {
            ((BottomNavigationView) requireActivity().findViewById(
                    getBottomNavigationViewId())).setSelectedItemId(getCheckedMenuItemId());
        }

        if (requireActivity() instanceof DynamicDrawerActivity) {
            ((DynamicDrawerActivity) requireActivity()).getNavigationView()
                    .setCheckedItem(getCheckedMenuItemId());
        }
    }
}
 
Example #6
Source File: MoviesActivity.java    From PopularMovies with MIT License 6 votes vote down vote up
private void setupBottomNavigation() {
    BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
    bottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
            switch (menuItem.getItemId()) {
                case R.id.action_discover:
                    ActivityUtils.replaceFragmentInActivity(
                            getSupportFragmentManager(), DiscoverMoviesFragment.newInstance(),
                            R.id.fragment_container);
                    return true;
                case R.id.action_favorites:
                    ActivityUtils.replaceFragmentInActivity(
                            getSupportFragmentManager(), FavoritesFragment.newInstance(),
                            R.id.fragment_container);
                    return true;
            }
            return false;
        }
    });
}
 
Example #7
Source File: BottomNavigationDemoFragment.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
private void clearAndHideBadge(int menuItemId) {
  for (BottomNavigationView bn : bottomNavigationViews) {
    MenuItem menuItem = bn.getMenu().getItem(0);
    if (menuItem.getItemId() == menuItemId) {
      // Hide instead of removing the badge associated with the first menu item because the user
      // can trigger it to be displayed again.
      BadgeDrawable badgeDrawable = bn.getBadge(menuItemId);
      if (badgeDrawable != null) {
        badgeDrawable.setVisible(false);
        badgeDrawable.clearNumber();
      }
    } else {
      // Remove the badge associated with this menu item because cannot be displayed again.
      bn.removeBadge(menuItemId);
    }
  }
}
 
Example #8
Source File: BottomNavigationViewActions.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/** Sets item icon tint list on the content of the bottom navigation view. */
public static ViewAction setItemIconTintList(@Nullable final ColorStateList tint) {
  return new ViewAction() {
    @Override
    public Matcher<View> getConstraints() {
      return isDisplayed();
    }

    @Override
    public String getDescription() {
      return "Set item icon tint list";
    }

    @Override
    public void perform(UiController uiController, View view) {
      BottomNavigationView navigationView = (BottomNavigationView) view;
      navigationView.setItemIconTintList(tint);
    }
  };
}
 
Example #9
Source File: BottomNavigationViewActions.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/** Sets icon for the menu item of the navigation view. */
public static ViewAction setIconForMenuItem(
    @IdRes final int menuItemId, final Drawable iconDrawable) {
  return new ViewAction() {
    @Override
    public Matcher<View> getConstraints() {
      return isDisplayed();
    }

    @Override
    public String getDescription() {
      return "Set menu item icon";
    }

    @Override
    public void perform(UiController uiController, View view) {
      BottomNavigationView navigationView = (BottomNavigationView) view;
      navigationView.getMenu().findItem(menuItemId).setIcon(iconDrawable);
    }
  };
}
 
Example #10
Source File: HomeActivity.java    From zap-android with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //NFC
    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);

    mInputMethodManager = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
    mHandler = new Handler();

    mUnlockDialog = buildUnlockDialog();

    // Register observer to detect if app goes to background
    ProcessLifecycleOwner.get().getLifecycle().addObserver(this);

    // Set wallet fragment as beginning fragment
    mFt = getSupportFragmentManager().beginTransaction();
    mCurrentFragment = new WalletFragment();
    mFt.replace(R.id.mainContent, mCurrentFragment);
    mFt.commit();

    // Setup Listener
    BottomNavigationView navigation = findViewById(R.id.mainNavigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
 
Example #11
Source File: BottomNavigationViewActions.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/** Sets and show badge number for the menu item of the navigation view. */
public static ViewAction showBadgeNumberForMenuItem(
    @IdRes final int menuItemId, final int badgeNumber) {
  return new ViewAction() {
    @Override
    public Matcher<View> getConstraints() {
      return isDisplayed();
    }

    @Override
    public String getDescription() {
      return "Set menu item badge number";
    }

    @Override
    public void perform(UiController uiController, View view) {
      BottomNavigationView navigationView = (BottomNavigationView) view;
      navigationView.getOrCreateBadge(menuItemId).setNumber(badgeNumber);
    }
  };
}
 
Example #12
Source File: BottomNavigationViewActions.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/** Add a navigation item to the bottom navigation view. */
public static ViewAction addMenuItem(final String title) {
  return new ViewAction() {
    @Override
    public Matcher<View> getConstraints() {
      return isDisplayed();
    }

    @Override
    public String getDescription() {
      return "Add item with title" + title;
    }

    @Override
    public void perform(UiController uiController, View view) {
      BottomNavigationView navigationView = (BottomNavigationView) view;
      navigationView.getMenu().add(title);
    }
  };
}
 
Example #13
Source File: MainActivity.java    From WebviewProject with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OneSignal.startInit(this)
            .inFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
            .unsubscribeWhenNotificationsAreDisabled(true)
            .init();
    setContentView(R.layout.activity_main);
    FragmentManager fragmentManager=getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.frame_layout, MainPage.newInstance()).commit();
    showSplash();//TODO Delete if you don't want splash screen
    checkInternet();//TODO Delete if you don't want internet control
    addToolbar();//TODO Adds toolbar to the project
    //TODO If you don't want toolbar delete it from activity.xml and here

    bottomNavigationView=findViewById(R.id.bottom_navigation);

    bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem item) {
            selectItem(item);
            return false;
        }
    });
}
 
Example #14
Source File: Helper.java    From FairEmail with GNU General Public License v3.0 6 votes vote down vote up
static void setViewsEnabled(ViewGroup view, boolean enabled) {
    for (int i = 0; i < view.getChildCount(); i++) {
        View child = view.getChildAt(i);
        if (child instanceof Spinner ||
                child instanceof EditText ||
                child instanceof CheckBox ||
                child instanceof ImageView /* =ImageButton */ ||
                child instanceof RadioButton ||
                (child instanceof Button && "disable".equals(child.getTag())))
            child.setEnabled(enabled);
        else if (child instanceof BottomNavigationView) {
            Menu menu = ((BottomNavigationView) child).getMenu();
            menu.setGroupEnabled(0, enabled);
        } else if (child instanceof RecyclerView)
            ; // do nothing
        else if (child instanceof ViewGroup)
            setViewsEnabled((ViewGroup) child, enabled);
    }
}
 
Example #15
Source File: BottomNavigationViewActions.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/** Set the bottom navigation view's label visibility mode. */
public static ViewAction setLabelVisibilityMode(@LabelVisibilityMode final int mode) {
  return new ViewAction() {
    @Override
    public Matcher<View> getConstraints() {
      return isDisplayed();
    }

    @Override
    public String getDescription() {
      return "Set the bottom navigation's label visibility mode to " + mode;
    }

    @Override
    public void perform(UiController uiController, View view) {
      BottomNavigationView navigationView = (BottomNavigationView) view;
      navigationView.setLabelVisibilityMode(mode);
    }
  };
}
 
Example #16
Source File: BottomNavigationViewActions.java    From material-components-android with Apache License 2.0 6 votes vote down vote up
/** Set the bottom navigation view's icon size. */
public static ViewAction setIconSize(final int size) {
  return new ViewAction() {
    @Override
    public Matcher<View> getConstraints() {
      return isDisplayed();
    }

    @Override
    public String getDescription() {
      return "Set the bottom navigation's icon size to " + size;
    }

    @Override
    public void perform(UiController uiController, View view) {
      BottomNavigationView navigationView = (BottomNavigationView) view;
      navigationView.setItemIconSize(size);
    }
  };
}
 
Example #17
Source File: FriendsFragment.java    From Hify with MIT License 6 votes vote down vote up
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

   fab=view.findViewById(R.id.searchFab);
   fab.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View v) {
           gotoSearch();
       }
   });

    BottomNavigationView bottomNavigationView=view.findViewById(R.id.bottom_nav);
    if(getArguments()!=null){
        bottomNavigationView.setSelectedItemId(R.id.action_view_request);
       loadFragment(new FriendRequests());
   }else {
       loadFragment(new Friends());
   }
    bottomNavigationView.setOnNavigationItemSelectedListener(this);
    bottomNavigationView.setOnNavigationItemReselectedListener(this);


}
 
Example #18
Source File: MainActivity.java    From TDTChannels-APP with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    SharedPreferencesController.init(this);

    BottomNavigationView navView = findViewById(R.id.nav_view);

    navView.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
    navView.setSelectedItemId(R.id.nav_tv_channels);

    checkAppVersion();
}
 
Example #19
Source File: BottomNavigationBehavior.java    From Hentoid with Apache License 2.0 5 votes vote down vote up
@Override
public void onNestedPreScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull BottomNavigationView child, @NonNull View target, int dx, int dy, @NonNull int[] consumed, @ViewCompat.NestedScrollType int type) {
    if (dy < 0) {
        showBottomNavigationView(child);
    } else if (dy > 0) {
        hideBottomNavigationView(child);
    }
}
 
Example #20
Source File: MainActivity.java    From ui with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    BottomNavigationView navView = findViewById(R.id.nav_view);

    /*  if not using arch navigation, then you need to implement this.
    navView.setOnNavigationItemSelectedListener(
        new BottomNavigationView.OnNavigationItemSelectedListener() {
            public boolean onNavigationItemSelected(MenuItem item) {
                return false;
            }
        }

    );
    */

    // Passing each menu ID as a set of Ids because each menu should be considered as top level destinations.
    //Note for this to work with arch Navigation, these id must be the same id in menu.xml and the nav_graph.
    AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
        R.id.action_first, R.id.action_second, R.id.action_third)
        .build();
    NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
    NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
    NavigationUI.setupWithNavController(navView, navController);

    //In order to have badges, you need to use the Theme.MaterialComponents.DayNight  (doesn't have to daynight, but materialcompents).
    BadgeDrawable badge = navView.getOrCreateBadge(R.id.action_second);
    badge.setNumber(12);  //should show a 12 in the "badge" for the second one.
    badge.setVisible(true);


}
 
Example #21
Source File: BottomNavigationDemoFragment.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
private void updateBadgeGravity(@BadgeGravity int badgeGravity) {
  for (BottomNavigationView bn : bottomNavigationViews) {
    for (int i = 0; i < MAX_BOTTOM_NAV_CHILDREN; i++) {
      // Update the badge gravity on all the menu items.
      MenuItem menuItem = bn.getMenu().getItem(i);
      int menuItemId = menuItem.getItemId();
      BadgeDrawable badgeDrawable = bn.getBadge(menuItemId);
      if (badgeDrawable != null) {
        badgeDrawable.setBadgeGravity(badgeGravity);
      }
    }
  }
}
 
Example #22
Source File: BottomNavigationDemoFragment.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
private void updateBadgeNumber(int delta) {
  for (BottomNavigationView bn : bottomNavigationViews) {
    // Increase the badge number on the first menu item.
    MenuItem menuItem = bn.getMenu().getItem(0);
    int menuItemId = menuItem.getItemId();
    BadgeDrawable badgeDrawable = bn.getOrCreateBadge(menuItemId);
    // In case the first menu item has been selected and the badge was hidden, call
    // BadgeDrawable#setVisible() to ensure the badge is visible.
    badgeDrawable.setVisible(true);
    badgeDrawable.setNumber(badgeDrawable.getNumber() + delta);
  }
}
 
Example #23
Source File: BottomNavigationViewBindingAdapter.java    From deagle with Apache License 2.0 5 votes vote down vote up
@BindingAdapter(value = {"onNavigationItemSelected", "selectedItemIdAttrChanged" }, requireAll = false)
public static void setOnItemSelectedListener(final BottomNavigationView view, final @Nullable OnNavigationItemSelectedListener listener,
											 final @Nullable InverseBindingListener notifier) {
	if (listener == null && notifier == null) view.setOnNavigationItemSelectedListener(null);
	else view.setOnNavigationItemSelectedListener(new OnNavigationItemSelectedListener() {
		@Override public boolean onNavigationItemSelected(final MenuItem item) {
			if (view.getSelectedItemId() == item.getItemId()) return true;
			if (notifier != null) view.post(new Runnable() { @Override public void run() {
				notifier.onChange();			// Async to avoid infinite loop
			}});
			return listener == null || listener.onNavigationItemSelected(item);
		}
	});
}
 
Example #24
Source File: TransitionFadeThroughDemoFragment.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle bundle) {

  replaceFragment(R.id.action_albums);

  BottomNavigationView bottomNavigationView = view.findViewById(R.id.bottomnavigation);
  bottomNavigationView.setOnNavigationItemSelectedListener(
      item -> {
        replaceFragment(item.getItemId());
        return true;
      });
}
 
Example #25
Source File: BottomNavigationViewInner.java    From smart-farmer-android with Apache License 2.0 5 votes vote down vote up
public BottomNavigationViewInner(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TintTypedArray a = ThemeEnforcement.obtainTintedStyledAttributes(context, attrs,
            R.styleable.BottomNavigationView,
            defStyleAttr, R.style.Widget_Design_BottomNavigationView,
            new int[]{R.styleable.BottomNavigationView_itemTextAppearanceInactive,
                    R.styleable.BottomNavigationView_itemTextAppearanceActive});
    // clear if you don't have set item icon tint list
    if (!a.hasValue(R.styleable.BottomNavigationView_itemIconTint)) {
        clearIconTintColor();
    }
    a.recycle();
}
 
Example #26
Source File: BaseRecyclerViewActivity.java    From AndroidAnimationExercise with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base_recycler_view);
        mFragmentManager = getSupportFragmentManager();
        BottomNavigationView navigation = findViewById(R.id.navigation);
        navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

        initFragments();

        navigation.setSelectedItemId(R.id.navigation_home);
//        navigation.setVisibility(View.GONE);
    }
 
Example #27
Source File: MainActivity.java    From android-DarkTheme with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    BottomNavigationView navigation = findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationListener);

    if (savedInstanceState == null) {
        showFragment(WelcomeFragment.TAG);
    }
}
 
Example #28
Source File: MainActivity.java    From user-interface-samples with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

    BottomNavigationView navigation = findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationListener);

    if (savedInstanceState == null) {
        showFragment(WelcomeFragment.TAG);
    }
}
 
Example #29
Source File: ButtonHandler.java    From SecScanQR with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method resets all the information that were shown on the MainActivty
 * @param tvInformation = TextView were the qrcode is shown
 * @param tvFormat = TextView were the qrcode format is shown
 * @param mLabelInformation = TextView were the qrcode headline is shown
 * @param mLabelFormat = TextView were the qrcode format headline is shown
 * @param qrcode = the qrcode as a String - Needs to be reset for orientation switches
 * @param format= the qrcode format as a String - Needs to be reset for orientation switches
 * @param buttonContainer = The Container as a LinearLayout with all the Buttons
 */
public static void resetScreenInformation(TextView tvInformation, TextView tvFormat, TextView mLabelInformation, TextView mLabelFormat, String qrcode, String format, BottomNavigationView buttonContainer){
    tvInformation.setText(R.string.default_text_main_activity);
    tvFormat.setText("");
    tvFormat.setVisibility(View.GONE);
    mLabelInformation.setVisibility(View.GONE);
    mLabelFormat.setVisibility(View.GONE);
    qrcode = "";
    format = "";
    buttonContainer.setVisibility(View.INVISIBLE);
}
 
Example #30
Source File: MainActivity.java    From java-unified-sdk with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  mTextMessage = (TextView) findViewById(R.id.message);
  BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
  navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

}