Java 类android.view.AbsSavedState 实例源码

项目:FMTech    文件:CoordinatorLayout.java   
protected Parcelable onSaveInstanceState()
{
  SavedState localSavedState = new SavedState(super.onSaveInstanceState());
  SparseArray localSparseArray = new SparseArray();
  int i = 0;
  int j = getChildCount();
  while (i < j)
  {
    View localView = getChildAt(i);
    int k = localView.getId();
    Behavior localBehavior = ((LayoutParams)localView.getLayoutParams()).mBehavior;
    if ((k != -1) && (localBehavior != null))
    {
      AbsSavedState localAbsSavedState = View.BaseSavedState.EMPTY_STATE;
      if (localAbsSavedState != null) {
        localSparseArray.append(k, localAbsSavedState);
      }
    }
    i++;
  }
  localSavedState.behaviorStates = localSparseArray;
  return localSavedState;
}
项目:MyTravelingDiary    文件:PullToRefreshBase.java   
@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;
    } else if (state instanceof AbsSavedState) {
        // add by mamingli 解决从后台重新调用app时,下拉菜单导致的崩溃问题
        Log.e(LOG_TAG, "onRestoreInstanceState state is AbsSavedState");
        AbsSavedState ss = (AbsSavedState) state;
        super.onRestoreInstanceState(ss.getSuperState());
    } else {
        // add by mamingli 解决从后台重新调用app时,下拉菜单导致的崩溃问题
        Log.e(LOG_TAG, "onRestoreInstanceState state is unknown: " + state.getClass());
        super.onRestoreInstanceState(state);
    }
}
项目:AndroidObservableScrollView-master    文件:SavedStateTest.java   
public void testGridViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableGridView.SavedState state1 = new ObservableGridView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableGridView.SavedState state2 = ObservableGridView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:AndroidObservableScrollView-master    文件:SavedStateTest.java   
public void testListViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableListView.SavedState state1 = new ObservableListView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableListView.SavedState state2 = ObservableListView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:AndroidObservableScrollView-master    文件:SavedStateTest.java   
public void testRecyclerViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableRecyclerView.SavedState state1 = new ObservableRecyclerView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableRecyclerView.SavedState state2 = ObservableRecyclerView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:AndroidObservableScrollView-master    文件:SavedStateTest.java   
public void testScrollViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableScrollView.SavedState state1 = new ObservableScrollView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableScrollView.SavedState state2 = ObservableScrollView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:AndroidObservableScrollView-master    文件:SavedStateTest.java   
public void testWebViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableWebView.SavedState state1 = new ObservableWebView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableWebView.SavedState state2 = ObservableWebView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:android_database    文件:BaseCursorAdapter.java   
/**
 * If you decide to override this method, do not forget to call {@code super.saveInstanceState()}
 * and pass the obtained super state to the corresponding constructor of your saved state
 * implementation to ensure the state of all classes along the chain is properly saved.
 */
@NonNull
@Override
@CallSuper
public Parcelable saveInstanceState() {
    return AbsSavedState.EMPTY_STATE;
}
项目:android_database    文件:BaseRecyclerCursorAdapter.java   
/**
 * If you decide to override this method, do not forget to call {@code super.saveInstanceState()}
 * and pass the obtained super state to the corresponding constructor of your saved state
 * implementation to ensure the state of all classes along the chain is properly saved.
 */
@NonNull
@Override
@CallSuper
public Parcelable saveInstanceState() {
    return AbsSavedState.EMPTY_STATE;
}
项目:photostream-tools    文件:SearchViewDelegate.java   
/**
 * Speichert den aktuellen Status der SearchView in ein Parcelable Objekt
 * @return {@link Parcelable}
 */
public Parcelable saveInstanceState(){
    SavedState savedState = new SavedState(AbsSavedState.EMPTY_STATE);
    savedState.setQuery(searchView.getQuery().toString());
    savedState.setFocused(searchView.isFocused());
    savedState.setExpanded(MenuItemCompat.isActionViewExpanded(searchViewMenuItem));
    return savedState;
}
项目:Android-ObservableScrollView    文件:SavedStateTest.java   
public void testGridViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableGridView.SavedState state1 = new ObservableGridView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableGridView.SavedState state2 = ObservableGridView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:Android-ObservableScrollView    文件:SavedStateTest.java   
public void testListViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableListView.SavedState state1 = new ObservableListView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableListView.SavedState state2 = ObservableListView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:Android-ObservableScrollView    文件:SavedStateTest.java   
public void testRecyclerViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableRecyclerView.SavedState state1 = new ObservableRecyclerView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableRecyclerView.SavedState state2 = ObservableRecyclerView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:Android-ObservableScrollView    文件:SavedStateTest.java   
public void testScrollViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableScrollView.SavedState state1 = new ObservableScrollView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableScrollView.SavedState state2 = ObservableScrollView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:Android-ObservableScrollView    文件:SavedStateTest.java   
public void testWebViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableWebView.SavedState state1 = new ObservableWebView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableWebView.SavedState state2 = ObservableWebView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:StudyMovie    文件:SavedStateTest.java   
public void testGridViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableGridView.SavedState state1 = new ObservableGridView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableGridView.SavedState state2 = ObservableGridView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:StudyMovie    文件:SavedStateTest.java   
public void testListViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableListView.SavedState state1 = new ObservableListView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableListView.SavedState state2 = ObservableListView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:StudyMovie    文件:SavedStateTest.java   
public void testRecyclerViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableRecyclerView.SavedState state1 = new ObservableRecyclerView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableRecyclerView.SavedState state2 = ObservableRecyclerView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:StudyMovie    文件:SavedStateTest.java   
public void testScrollViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableScrollView.SavedState state1 = new ObservableScrollView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableScrollView.SavedState state2 = ObservableScrollView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:StudyMovie    文件:SavedStateTest.java   
public void testWebViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableWebView.SavedState state1 = new ObservableWebView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableWebView.SavedState state2 = ObservableWebView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:Android-ObservableScrollView-master    文件:SavedStateTest.java   
public void testGridViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableGridView.SavedState state1 = new ObservableGridView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableGridView.SavedState state2 = ObservableGridView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:Android-ObservableScrollView-master    文件:SavedStateTest.java   
public void testListViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableListView.SavedState state1 = new ObservableListView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableListView.SavedState state2 = ObservableListView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:Android-ObservableScrollView-master    文件:SavedStateTest.java   
public void testRecyclerViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableRecyclerView.SavedState state1 = new ObservableRecyclerView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevFirstVisiblePosition = 1;
    state1.prevFirstVisibleChildHeight = 2;
    state1.prevScrolledChildrenHeight = 3;
    state1.prevScrollY = 4;
    state1.scrollY = 5;
    state1.childrenHeights = new SparseIntArray();
    state1.childrenHeights.put(0, 10);
    state1.childrenHeights.put(1, 20);
    state1.childrenHeights.put(2, 30);
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableRecyclerView.SavedState state2 = ObservableRecyclerView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevFirstVisiblePosition, state2.prevFirstVisiblePosition);
    assertEquals(state1.prevFirstVisibleChildHeight, state2.prevFirstVisibleChildHeight);
    assertEquals(state1.prevScrolledChildrenHeight, state2.prevScrolledChildrenHeight);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
    assertNotNull(state1.childrenHeights);
    assertEquals(3, state1.childrenHeights.size());
    assertEquals(10, state1.childrenHeights.get(0));
    assertEquals(20, state1.childrenHeights.get(1));
    assertEquals(30, state1.childrenHeights.get(2));
}
项目:Android-ObservableScrollView-master    文件:SavedStateTest.java   
public void testScrollViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableScrollView.SavedState state1 = new ObservableScrollView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableScrollView.SavedState state2 = ObservableScrollView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:Android-ObservableScrollView-master    文件:SavedStateTest.java   
public void testWebViewSavedState() throws Throwable {
    Parcel parcel = Parcel.obtain();
    ObservableWebView.SavedState state1 = new ObservableWebView.SavedState(AbsSavedState.EMPTY_STATE);
    state1.prevScrollY = 1;
    state1.scrollY = 2;
    state1.writeToParcel(parcel, 0);

    parcel.setDataPosition(0);

    ObservableWebView.SavedState state2 = ObservableWebView.SavedState.CREATOR.createFromParcel(parcel);
    assertNotNull(state2);
    assertEquals(state1.prevScrollY, state2.prevScrollY);
    assertEquals(state1.scrollY, state2.scrollY);
}
项目:fonticon    文件:FontIconDrawable.java   
public Parcelable onSaveInstanceState() {
    SavedState ss = new SavedState(AbsSavedState.EMPTY_STATE);

    ss.text = getText();
    ss.textColor = getTextColorStateList();
    ss.textSize = getTextSize();
    ss.autoMirrored = isAutoMirrored();
    //noinspection deprecation
    ss.needMirroring = isNeedMirroring();

    return ss;
}
项目:gloomy-dungeons-2    文件:Preference.java   
protected void onRestoreInstanceState(Parcelable state) {
    mBaseMethodCalled = true;
    if (state != AbsSavedState.EMPTY_STATE && state != null) {
        throw new IllegalArgumentException(
                "Wrong state class -- expecting Preference State");
    }
}
项目:laposte-android    文件:Preference.java   
protected void onRestoreInstanceState(Parcelable state) {
    mBaseMethodCalled = true;
    if (state != AbsSavedState.EMPTY_STATE && state != null) {
        throw new IllegalArgumentException(
                "Wrong state class -- expecting Preference State");
    }
}
项目:TflTravelAlerts    文件:Preference.java   
protected void onRestoreInstanceState(Parcelable state) {
    mBaseMethodCalled = true;
    if (state != AbsSavedState.EMPTY_STATE && state != null) {
        throw new IllegalArgumentException(
                "Wrong state class -- expecting Preference State");
    }
}
项目:mosby    文件:PartialViewGroupMvpViewStateDelegateCallbackImpl.java   
@Override public Parcelable superOnSaveInstanceState() {
  return Mockito.mock(AbsSavedState.class);
}
项目:mosby    文件:PartialViewGroupMvpDelegateCallbackImpl.java   
@Override public Parcelable superOnSaveInstanceState() {
  return Mockito.mock(AbsSavedState.class);
}
项目:gloomy-dungeons-2    文件:Preference.java   
protected Parcelable onSaveInstanceState() {
    mBaseMethodCalled = true;
    return AbsSavedState.EMPTY_STATE;
}
项目:laposte-android    文件:Preference.java   
protected Parcelable onSaveInstanceState() {
    mBaseMethodCalled = true;
    return AbsSavedState.EMPTY_STATE;
}
项目:TflTravelAlerts    文件:Preference.java   
protected Parcelable onSaveInstanceState() {
    mBaseMethodCalled = true;
    return AbsSavedState.EMPTY_STATE;
}