當前位置: 首頁>>代碼示例>>Java>>正文


Java Tab.getPosition方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:konir,項目名稱:RadioRecPlus,代碼行數:26,代碼來源:RadioRecPlusActivity.java

示例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();
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:34,代碼來源:WindowDecorActionBar.java

示例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);
	}
}
 
開發者ID:t-animal,項目名稱:JourneyApp,代碼行數:16,代碼來源:Journey.java

示例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;
            }
        }
    }
}
 
開發者ID:SafeSlingerProject,項目名稱:SafeSlinger-Android,代碼行數:41,代碼來源:HomeActivity.java

示例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;
    }
}
 
開發者ID:SafeSlingerProject,項目名稱:SafeSlinger-Android,代碼行數:35,代碼來源:HomeActivity.java

示例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);
}
 
開發者ID:eolwral,項目名稱:OSMonitor,代碼行數:11,代碼來源:OSMonitor.java

示例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);
}
 
開發者ID:wada811,項目名稱:AndroidLibrary-wada811,代碼行數:8,代碼來源:TabFragmentViewPagerActivity.java

示例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);
}
 
開發者ID:lemberg,項目名稱:d8androidsdk,代碼行數:6,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:AlexJF,項目名稱:TrackMyMoney,代碼行數:6,代碼來源:TabAdapter.java


注:本文中的android.support.v7.app.ActionBar.Tab.getPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。