本文整理匯總了Java中com.roughike.bottombar.BottomBar.setOnTabSelectListener方法的典型用法代碼示例。如果您正苦於以下問題:Java BottomBar.setOnTabSelectListener方法的具體用法?Java BottomBar.setOnTabSelectListener怎麽用?Java BottomBar.setOnTabSelectListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.roughike.bottombar.BottomBar
的用法示例。
在下文中一共展示了BottomBar.setOnTabSelectListener方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initView
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
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;
}
}
});
}
示例2: onCreate
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@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) {
}
});
}
示例3: onCreate
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbarColorAnimator = new ToolbarColorAnimator(toolbar, Color.BLACK);
topLevelTabs = new SparseArray<>();
topLevelTabs.put(R.id.tab_dining, new DiningTab());
topLevelTabs.put(R.id.tab_restaurants, new RestaurantsTab());
topLevelTabs.put(R.id.tab_settings, new SettingsTab());
BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabSelectListener(this);
}
示例4: initListener
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
public void initListener() {
bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
switch (tabId) {
case R.id.tab1:
replaceFragment(new MusicFragment());
break;
case R.id.tab2:
replaceFragment(new VideoHomeFragment());
break;
case R.id.tab3:
replaceFragment(new HomeFragment());
break;
case R.id.tab4:
replaceFragment(new MeFragment());
}
}
});
mFabMusic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LogUtils.d("MainActivity", "mFabMusic to startActivity");
startActivity(new Intent(MainActivty.this, PlayMusicActivity.class));
}
});
mFabMusic.setVisibility(View.GONE);
}
示例5: initializeBottomBar
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
/**
* set up the navigation tabs at the bottom of the screen
* navigation items:
* dashboard
* search
* add new habit
* follow requests
* profile
*/
private void initializeBottomBar() {
bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
switch (tabId) {
case R.id.tab_dashboard:
onDashboardClicked();
break;
case R.id.tab_search:
onSearchClicked();
break;
case R.id.tab_addHabit:
break;
case R.id.tab_followRequests:
onFollowRequestClicked();
break;
case R.id.tab_profile:
onProfileClicked();
break;
}
}
});
bottomBar.setTabSelectionInterceptor(new TabSelectionInterceptor() {
@Override
public boolean shouldInterceptTabSelection(@IdRes int oldTabId, @IdRes int newTabId) {
if (newTabId == R.id.tab_addHabit) {
onAddHabitClicked();
return true;
}
return false;
}
});
}
示例6: setupBottomBar
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
private void setupBottomBar(BottomBar bottomBar) {
bottomBar.setOnTabSelectListener(id -> {
Fragment frag = null;
switch (id) {
case R.id.tab_map:
if (awaitingLocationPermission) {
frag = new MapPlaceHolderFragment();
} else {
frag = new MapboxMapFragment();
}
break;
case R.id.tab_now:
frag = new ExploreListViewFragment();
break;
case R.id.tab_browse:
frag = new BrowseListViewFragment();
break;
case R.id.tab_favorites:
frag = new FavoritesListViewFragment();
break;
}
if (frag != null) {
setCurrentFragment(frag);
}
});
}
示例7: onCreate
import com.roughike.bottombar.BottomBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fresco.initialize(this);
setContentView(R.layout.activity_main);
LibF = new LibraryFragment();
PopF = new PopularFragment();
BroF = new BrowseFragment();
BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int menuItemId) {
// The user selected a tab at the specified position
FragmentTransaction FragTrans = FragMan.beginTransaction();
if (menuItemId == R.id.menu_library) {
FragTrans.replace(R.id.MainLayout, LibF);
} else if (menuItemId == R.id.menu_popular) {
FragTrans.replace(R.id.MainLayout, PopF);
} else if (menuItemId == R.id.menu_browse) {
FragTrans.replace(R.id.MainLayout, BroF);
}
FragTrans.commit();
}
});
RequestQueue queue = MySingleton.getInstance(this.getApplicationContext()).
getRequestQueue();
popularMangaList = new ArrayList<>();
newMangaList = new ArrayList<>();
//TODO : Caching Popular mangalist
//TODO : Implementing ThreadPool for concurrent mangalist fetch
Intent mangaFetch = new Intent(this,MangaFetchService.class);
mangaFetch.putExtra("mangaURL",mangaFox);
mangaFetch.putExtra("receiver",new PopularProgress(new Handler()));
this.startService(mangaFetch);
}