@Override public Fragment getItem(int position) { String fragmentCodeType = null; Fragment currentFragment = null; if (tabStrip != null) { List<Tab> titleTabs = tabStrip.getTabs(); for (int j = 0; j < titleTabs.size(); j++) { if (j == position) { Tab tab = titleTabs.get(j); fragmentCodeType = tab.getFragment().getKey(); break; } } } else { fragmentCodeType = onlyFragment; } try { if (fragmentFactory != null) { currentFragment = fragmentFactory.getFragment(fragmentCodeType, fermatSession, resourcesProviderManager); } } catch (FragmentNotFoundException e) { e.printStackTrace(); } return currentFragment; }
public TabsPagerAdapter( FragmentManager fm, Context context, FermatFragmentFactory walletFragmentFactory, TabStrip tabStrip, FermatSession walletSession, WalletResourcesProviderManager walletResourcesProviderManager) { super(fm); this.context = context; this.fermatSession = walletSession; this.fragmentFactory = walletFragmentFactory; this.tabStrip = tabStrip; this.resourcesProviderManager = walletResourcesProviderManager; if (tabStrip != null) { List<Tab> titleTabs = tabStrip.getTabs(); titles = new String[titleTabs.size()]; for (int i = 0; i < titleTabs.size(); i++) { Tab tab = titleTabs.get(i); titles[i] = tab.getLabel(); } } }
public TabsPagerAdapter( FragmentManager fragmentManager, Context applicationContext, FermatFragmentFactory fermatFragmentFactory, TabStrip tabStrip, FermatSession fermatSession, ResourceProviderManager resourceProviderManager) { super(fragmentManager); this.context = applicationContext; this.fermatSession = fermatSession; this.fragmentFactory = fermatFragmentFactory; this.tabStrip = tabStrip; this.resourcesProviderManager = resourceProviderManager; if (tabStrip != null) { List<Tab> titleTabs = tabStrip.getTabs(); titles = new String[titleTabs.size()]; for (int i = 0; i < titleTabs.size(); i++) { Tab tab = titleTabs.get(i); titles[i] = tab.getLabel(); } } }