private void reloadData(int position, int verse) {
   ReadingFragment fragment = (ReadingFragment) mAdapter.instantiateItem(mPager, position);
   if (verse > 0) {
     fragment.setForceVerse(verse);
   }
   Bundle bundle = fragment.getArguments();
   if (bundle != null) {
     bundle.putAll(mAdapter.getData(position));
     fragment.reloadData();
   }
 }
 private void refresh() {
   int position = getCurrentPosition();
   String osis = getCurrentOsis();
   mAdapter.setData(position, retrieveOsis(position, osis));
   updateVersion();
   prepare(position);
   reload(position);
 }
 private void reload(int position) {
   reloadData(position);
   if (position > 0) {
     reloadData(position - 1);
   }
   if (position < mAdapter.getCount() - 1) {
     reloadData(position + 1);
   }
 }
 protected final void prepare(int position) {
   Bundle bundle = mAdapter.getData(position);
   String osis = bundle.getString(OSIS);
   if (!TextUtils.isEmpty(osis)) {
     updateHeader(bundle, osis);
     prepareNext(position, bundle.getString(NEXT));
     preparePrev(position, bundle.getString(PREV));
   }
 }
 @Override
 public void onRestart() {
   super.onRestart();
   fontPath = BibleUtils.getFontPath(this);
   if (!ObjectUtils.isIdentical(
       fontPath, mAdapter.getData(getCurrentPosition()).getString(FONT_PATH))) {
     refresh();
   }
 }
  private void jump(String osis, String verse) {
    Bundle bundle = retrieveOsis(POSITION_UNKNOWN, osis);
    bundle.putString(VERSE, verse);
    bundle.putString(VERSE_START, verse);
    int oldPosition = getCurrentPosition();
    int position = bundle.getInt(ID) - 1;
    mAdapter.setData(position, bundle);
    prepare(position);

    mPager.setCurrentItem(position);

    // if it's cached, then reloaded
    if (Math.abs(oldPosition - position) <= mPager.getOffscreenPageLimit()) {
      reloadData(position, NumberUtils.parseInt(verse));
    }
  }
  protected final void initialize() {
    initializeHeader(mHeader);

    mPager.setAdapter(mAdapter);
    mPager.addOnPageChangeListener(this);

    int position = getInitialPosition();
    String osis = getInitialOsis();
    Bundle bundle = retrieveOsis(position, osis);
    if (position == POSITION_UNKNOWN) {
      position = bundle.getInt(ID) - 1;
    }
    mAdapter.setData(position, bundle);
    updateVersion();
    prepare(position);

    mPager.setCurrentItem(position);
  }
 private void prepare(int position, String osis) {
   Bundle bundle = mAdapter.getData(position);
   bundle.putString(OSIS, osis);
   bundle.putAll(retrieveOsis(position, osis));
 }
 private void prepareNext(int position, String osis) {
   int nextPosition = position + 1;
   if (nextPosition < mAdapter.getCount()) {
     prepare(nextPosition, osis);
   }
 }
 protected final String getCurrentOsis() {
   return mAdapter.getData(getCurrentPosition()).getString(OSIS);
 }