本文整理匯總了Java中android.support.v7.app.ActionBar.Tab.getPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java Tab.getPosition方法的具體用法?Java Tab.getPosition怎麽用?Java Tab.getPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.app.ActionBar.Tab
的用法示例。
在下文中一共展示了Tab.getPosition方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performTabClick
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
private void performTabClick(Tab tab) {
switch (tab.getPosition()) {
case 0:
if (spnAllStations != null) {
spnAllStations.performClick();
}
break;
case 1:
AnalyticsUtil.sendEvent(AnalyticsUtil.UI_ACTION, "click_tab_favourites", "station: " + Constants.SELECTED_STATION_NAME_VALUE);
this.startActivityForResult(new Intent(this, FavouritesActivity.class), Constants.FROM_FAVOURITES);
break;
case 2:
AnalyticsUtil.sendEvent(AnalyticsUtil.UI_ACTION, "click_musicBrowser", "station: " + Constants.SELECTED_STATION_NAME_VALUE);
this.startActivity(new Intent(this, FileChooserActivity.class));
// Fragments
// FragmentManager fm = getSupportFragmentManager();
// FileChooserFragment fileList = new FileChooserFragment();
// fm.beginTransaction().replace(android.R.id.content, fileList).commit();
break;
default:
break;
}
}
示例2: selectTab
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
public void selectTab(Tab tab) {
int i = -1;
if (getNavigationMode() != 2) {
this.mSavedTabPosition = tab != null ? tab.getPosition() : -1;
return;
}
FragmentTransaction trans;
if (!(this.mActivity instanceof FragmentActivity) || this.mDecorToolbar.getViewGroup().isInEditMode()) {
trans = null;
} else {
trans = ((FragmentActivity) this.mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
}
if (this.mSelectedTab != tab) {
ScrollingTabContainerView scrollingTabContainerView = this.mTabScrollView;
if (tab != null) {
i = tab.getPosition();
}
scrollingTabContainerView.setTabSelected(i);
if (this.mSelectedTab != null) {
this.mSelectedTab.getCallback().onTabUnselected(this.mSelectedTab, trans);
}
this.mSelectedTab = (TabImpl) tab;
if (this.mSelectedTab != null) {
this.mSelectedTab.getCallback().onTabSelected(this.mSelectedTab, trans);
}
} else if (this.mSelectedTab != null) {
this.mSelectedTab.getCallback().onTabReselected(this.mSelectedTab, trans);
this.mTabScrollView.animateToTab(tab.getPosition());
}
if (trans != null && !trans.isEmpty()) {
trans.commit();
}
}
示例3: onTabSelected
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
public void onTabSelected(Tab tab, FragmentTransaction arg1) {
viewPager.setCurrentItem(tab.getPosition());
Fragment curFrag = getSupportFragmentManager().findFragmentByTag(
"android:switcher:" + R.id.mainContainer + ":" + viewPager.getCurrentItem());
if (curFrag != null && curFrag.isResumed())
((OnDisplayFragment) curFrag).onDisplay();
if (tab.getPosition() == 0) {
viewPager.setSwipingOnlyFromBorder(true);
} else {
viewPager.setSwipingOnlyFromBorder(false);
}
}
示例4: onTabSelected
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
Object tag = tab.getTag();
for (int i = 0; i < mTabs.size(); i++) {
if (mTabs.get(i) == tag) {
mViewPager.setCurrentItem(i);
supportInvalidateOptionsMenu(); // update action bar options
// refresh all that matter
switch (Tabs.values()[tab.getPosition()]) {
case MESSAGE:
MessagesFragment mf = (MessagesFragment) findFragmentByPosition(Tabs.MESSAGE
.ordinal());
if (mf != null) {
mf.updateKeypad();
mf.updateValues(null);
}
break;
case SLINGKEYS:
SlingerFragment sf = (SlingerFragment) findFragmentByPosition(Tabs.SLINGKEYS
.ordinal());
if (sf != null) {
sf.updateKeypad();
sf.updateValues(null);
}
break;
case INTRO:
IntroductionFragment sif = (IntroductionFragment) findFragmentByPosition(Tabs.INTRO
.ordinal());
if (sif != null) {
sif.updateKeypad();
sif.updateValues(null);
}
break;
default:
break;
}
}
}
}
示例5: onTabReselected
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
supportInvalidateOptionsMenu(); // update action bar options
// refresh all that matter
switch (Tabs.values()[tab.getPosition()]) {
case MESSAGE:
MessagesFragment mf = (MessagesFragment) findFragmentByPosition(Tabs.MESSAGE
.ordinal());
if (mf != null) {
mf.updateKeypad();
mf.updateValues(null);
}
break;
case SLINGKEYS:
SlingerFragment sf = (SlingerFragment) findFragmentByPosition(Tabs.SLINGKEYS
.ordinal());
if (sf != null) {
sf.updateKeypad();
sf.updateValues(null);
}
break;
case INTRO:
IntroductionFragment sif = (IntroductionFragment) findFragmentByPosition(Tabs.INTRO
.ordinal());
if (sif != null) {
sif.updateKeypad();
sif.updateValues(null);
}
break;
default:
break;
}
}
示例6: onTabSelected
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
mViewPager.setCurrentItem(tab.getPosition());
if (mViewPager.getCurrentItem() != tab.getPosition())
mViewPager.setCurrentItem(tab.getPosition());
// force display menu when selected
((OSMonitorPagerAdapter) mViewPager.getAdapter()).getItem(
mViewPager.getCurrentItem()).setMenuVisibility(true);
}
示例7: onSaveInstanceState
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
protected void onSaveInstanceState(Bundle outState){
Tab selectedTab = mActionBar.getSelectedTab();
int position = selectedTab.getPosition();
outState.putInt(SELECTED_TAB_POSITION, position);
super.onSaveInstanceState(outState);
}
示例8: onTabSelected
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
@Override
public void onTabSelected(Tab arg0, FragmentTransaction arg1) {
int position = arg0.getPosition();
mViewPager.setCurrentItem(position);
}
示例9: onTabSelected
import android.support.v7.app.ActionBar.Tab; //導入方法依賴的package包/類
public void onTabSelected(Tab tab, FragmentTransaction ft) {
int position = tab.getPosition();
viewPager.setCurrentItem(position);
notifyTabChanged(position);
}