Exemplo n.º 1
0
  @Override
  protected final void onRestoreInstanceState(Parcelable state) {
    if (state instanceof Bundle) {
      Bundle bundle = (Bundle) state;

      setMode(Mode.mapIntToValue(bundle.getInt(STATE_MODE, 0)));
      mCurrentMode = Mode.mapIntToValue(bundle.getInt(STATE_CURRENT_MODE, 0));

      mScrollingWhileRefreshingEnabled =
          bundle.getBoolean(STATE_SCROLLING_REFRESHING_ENABLED, false);
      mShowViewWhileRefreshing = bundle.getBoolean(STATE_SHOW_REFRESHING_VIEW, true);

      // Let super Restore Itself
      super.onRestoreInstanceState(bundle.getParcelable(STATE_SUPER));

      State viewState = State.mapIntToValue(bundle.getInt(STATE_STATE, 0));
      if (viewState == State.REFRESHING || viewState == State.MANUAL_REFRESHING) {
        setState(viewState, true);
      }

      // Now let derivative classes restore their state
      onPtrRestoreInstanceState(bundle);
      return;
    }

    super.onRestoreInstanceState(state);
  }
Exemplo n.º 2
0
 @Override
 protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
   super.onPtrRestoreInstanceState(savedInstanceState);
   mRefreshableView.restoreState(savedInstanceState);
 }