@Override public void removeTab(TabProxy tabProxy) { int tabIndex = ((TabGroupProxy) proxy).getTabIndex(tabProxy); TabFragment fragment = (TabFragment) tabGroupPagerAdapter.getRegisteredFragment(tabIndex); TiUIActionBarTab tabView = (TiUIActionBarTab) tabProxy.peekView(); actionBar.removeTab(tabView.tab); if (fragment != null) { fragment.setTab(null); } tabGroupPagerAdapter.notifyDataSetChanged(); }
@Override public int getItemPosition(Object object) { TabFragment fragment = (TabFragment) object; if (fragment.getTab() == null) { return POSITION_NONE; } String fragmentTag = fragment.getTag(); for (int i = 0; i < registeredFragments.size(); i++) { Fragment registeredFragment = getRegisteredFragment(i); if (registeredFragment != null) { if (fragmentTag.equals(registeredFragment.getTag())) { return i; } } } return POSITION_NONE; }