public override void selectTab(android.app.ActionBar.Tab tab) { if (getNavigationMode() != NAVIGATION_MODE_TABS) { mSavedTabPosition = tab != null?tab.getPosition() : INVALID_POSITION; return; } android.app.FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction ().disallowAddToBackStack(); if (mSelectedTab == tab) { if (mSelectedTab != null) { mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans); mTabScrollView.animateToTab(tab.getPosition()); } } else { mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : android.app.ActionBar .Tab.INVALID_POSITION); if (mSelectedTab != null) { mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans); } mSelectedTab = ([email protected])tab; if (mSelectedTab != null) { mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans); } } if (!trans.isEmpty()) { trans.commit(); } }
private void configureTab(android.app.ActionBar.Tab tab, int position) { [email protected] tabi = ([email protected] .TabImpl)tab; android.app.ActionBar.TabListener callback = tabi.getCallback(); if (callback == null) { throw new System.InvalidOperationException("Action Bar Tab must have a Callback"); } tabi.setPosition(position); mTabs.add(position, tabi); int count = mTabs.size(); { for (int i = position + 1; i < count; i++) { mTabs.get(i).setPosition(i); } } }
public override void selectTab(android.app.ActionBar.Tab tab) { if (getNavigationMode() != NAVIGATION_MODE_TABS) { mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION; return; } android.app.FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction ().disallowAddToBackStack(); if (mSelectedTab == tab) { if (mSelectedTab != null) { mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans); mTabScrollView.animateToTab(tab.getPosition()); } } else { mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : android.app.ActionBar .Tab.INVALID_POSITION); if (mSelectedTab != null) { mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans); } mSelectedTab = ([email protected])tab; if (mSelectedTab != null) { mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans); } } if (!trans.isEmpty()) { trans.commit(); } }