public static QuranPageFragment newInstance(int page) { final QuranPageFragment f = new QuranPageFragment(); final Bundle args = new Bundle(); args.putInt(PAGE_NUMBER_EXTRA, page); f.setArguments(args); return f; }
@Override public void destroyItem(ViewGroup container, int position, Object object) { Fragment f = (Fragment) object; if (f instanceof QuranPageFragment) { ((QuranPageFragment) f).cleanup(); } else if (f instanceof TabletFragment) { ((TabletFragment) f).cleanup(); } super.destroyItem(container, position, object); }
@Override public Fragment getItem(int position) { int count = getCount(); android.util.Log.d(TAG, "getting page: " + (count - position)); if (mIsDualPages) { return TabletFragment.newInstance( (count - position) * 2, mIsShowingTranslation ? TabletFragment.Mode.TRANSLATION : TabletFragment.Mode.ARABIC); } if (mIsShowingTranslation) { return TranslationFragment.newInstance(count - position); } else { return QuranPageFragment.newInstance(count - position); } }