@Override
 protected Parcelable onSaveInstanceState() {
   Bundle bundle = new Bundle();
   bundle.putInt(STATE_STATE, mState);
   bundle.putInt(STATE_MODE, mMode.getIntValue());
   bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue());
   bundle.putBoolean(STATE_DISABLE_SCROLLING_REFRESHING, mDisableScrollingWhileRefreshing);
   bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing);
   bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState());
   return bundle;
 }
예제 #2
0
  @Override
  protected final Parcelable onSaveInstanceState() {
    Bundle bundle = new Bundle();

    // Let derivative classes get a chance to save state first, that way we
    // can make sure they don't overrite any of our values
    onPtrSaveInstanceState(bundle);

    bundle.putInt(STATE_STATE, mState.getIntValue());
    bundle.putInt(STATE_MODE, mMode.getIntValue());
    bundle.putInt(STATE_CURRENT_MODE, mCurrentMode.getIntValue());
    bundle.putBoolean(STATE_SCROLLING_REFRESHING_ENABLED, mScrollingWhileRefreshingEnabled);
    bundle.putBoolean(STATE_SHOW_REFRESHING_VIEW, mShowViewWhileRefreshing);
    bundle.putParcelable(STATE_SUPER, super.onSaveInstanceState());

    return bundle;
  }
예제 #3
0
    /**
     * Maps an int to a specific mode. This is needed when saving state, or inflating the view from
     * XML where the mode is given through a attr int.
     *
     * @param modeInt - int to map a Mode to
     * @return Mode that modeInt maps to, or PULL_FROM_START by default.
     */
    static Mode mapIntToValue(final int modeInt) {
      for (Mode value : Mode.values()) {
        if (modeInt == value.getIntValue()) {
          return value;
        }
      }

      // If not, return default
      return getDefault();
    }