com.roughike.bottombar.OnTabSelectListener Java Examples
The following examples show how to use
com.roughike.bottombar.OnTabSelectListener.
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 Pigeon with MIT License | 6 votes |
private void initView() { mToolBar= (Toolbar) findViewById(R.id.common_toolbar); mBottomBar= (BottomBar) findViewById(R.id.bottomBar ); mVpContent = (ViewPager) findViewById(R.id.vp_main_content); mBottomBar.setOnTabSelectListener(new OnTabSelectListener() { @Override public void onTabSelected(@IdRes int tabId) { switch (tabId) { case R.id.tab_home: mToolBar.setTitle("飞鸽"); mVpContent.setCurrentItem(0); break; case R.id.tab_tools: mToolBar.setTitle("发现"); mVpContent.setCurrentItem(1); break; case R.id.tab_person: mToolBar.setTitle("我"); mVpContent.setCurrentItem(2); break; } } }); }
Example #2
Source File: ThreeTabsQRActivity.java From BottomBar with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_three_tabs_quick_return); BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar); // We're doing nothing with this listener here this time. Check example usage // from ThreeTabsActivity on how to use it. bottomBar.setOnTabSelectListener(new OnTabSelectListener() { @Override public void onTabSelected(@IdRes int tabId) { } }); }
Example #3
Source File: MainActivity.java From AcgClub with MIT License | 4 votes |
@Override protected void initData() { setToolBar(mToolBar, getString(R.string.nav_news)); getAppVersionInfo(); getSupportActionBar().setDisplayHomeAsUpEnabled(false); toggle = new ActionBarDrawerToggle(this, drawerLayout, mToolBar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawerLayout.addDrawerListener(toggle); toggle.syncState(); if (loadFragments.get(RouterConstants.PATH_SCHEDULE_MAIN) == null) { loadMultipleRootFragment(R.id.main_content, 0, getTargetFragment(RouterConstants.PATH_SCHEDULE_MAIN), getTargetFragment(RouterConstants.PATH_COMIC_QIMIAO), getTargetFragment(RouterConstants.PATH_PICTURE_MAIN), getTargetFragment(RouterConstants.PATH_ACGNEWS_MAIN)); } bottomBar.setOnTabSelectListener(new OnTabSelectListener() { @Override public void onTabSelected(@IdRes int tabId) { String title = null; switch (tabId) { case R.id.nav_schedule: showFragment = RouterConstants.PATH_SCHEDULE_MAIN; title = getString(R.string.nav_schedule); break; case R.id.nav_comic: showFragment = RouterConstants.PATH_COMIC_QIMIAO; title = getString(R.string.nav_comic); break; case R.id.nav_news: showFragment = RouterConstants.PATH_ACGNEWS_MAIN; title = getString(R.string.nav_news); break; case R.id.nav_picture: showFragment = RouterConstants.PATH_PICTURE_MAIN; title = getString(R.string.nav_picture); break; /*case R.id.nav_fiction: showFragment = R.id.nav_fiction; title = getString(R.string.nav_fiction); break;*/ /*case R.id.nav_setting: showFragment = RouterConstants.PATH_SETTING; title = getString(R.string.nav_setting); break;*/ } showHideFragment(getTargetFragment(showFragment), getTargetFragment(hideFragment)); mToolBar.setTitle(title); hideFragment = showFragment; } }); //navigationView.getMenu().findItem(R.id.nav_news).setChecked(true); navigationView.setNavigationItemSelectedListener( new OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.nav_collection: RouterUtils.getInstance() .build(RouterConstants.PATH_COLLECTION) .navigation(); break; case R.id.nav_music: RouterUtils.getInstance() .build(RouterConstants.PATH_MUSIC_RANDOM) .navigation(); break; case R.id.nav_setting: RouterUtils.getInstance() .build(RouterConstants.PATH_SETTING) .navigation(); break; } //mToolBar.setTitle(item.getTitle()); drawerLayout.closeDrawer(GravityCompat.START); return true; } }); }