Пример #1
0
 @Override
 public Fragment getItem(int i) {
   Fragment fragment = this.fragments[i];
   if (fragment == null) {
     FirstrunPagerConfig.FirstrunPanelConfig panelConfig = panels.get(i);
     fragment = Fragment.instantiate(context, panelConfig.getClassname(), panelConfig.getArgs());
     ((FirstrunPanel) fragment).setPagerNavigation(pagerNavigation);
     fragments[i] = fragment;
   }
   return fragment;
 }
Пример #2
0
    public ViewPagerAdapter(
        FragmentManager fm, List<FirstrunPagerConfig.FirstrunPanelConfig> panels) {
      super(fm);
      this.panels = panels;
      this.fragments = new Fragment[panels.size()];
      for (FirstrunPagerConfig.FirstrunPanelConfig panel : panels) {
        mDecor.onAddPagerView(context.getString(panel.getTitleRes()));
      }

      if (panels.size() > 0) {
        mDecor.onPageSelected(0);
      }
    }