本文整理汇总了Java中android.view.AbsSavedState.EMPTY_STATE属性的典型用法代码示例。如果您正苦于以下问题:Java AbsSavedState.EMPTY_STATE属性的具体用法?Java AbsSavedState.EMPTY_STATE怎么用?Java AbsSavedState.EMPTY_STATE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.AbsSavedState
的用法示例。
在下文中一共展示了AbsSavedState.EMPTY_STATE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGridViewSavedState
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));
}
示例2: testListViewSavedState
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));
}
示例3: testRecyclerViewSavedState
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));
}
示例4: testScrollViewSavedState
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);
}
示例5: testWebViewSavedState
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);
}
示例6: saveInstanceState
/**
* 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;
}
示例7: saveInstanceState
/**
* 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;
}
示例8: onSaveInstanceState
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;
}
示例9: onRestoreInstanceState
protected void onRestoreInstanceState(Parcelable state) {
mBaseMethodCalled = true;
if (state != AbsSavedState.EMPTY_STATE && state != null) {
throw new IllegalArgumentException(
"Wrong state class -- expecting Preference State");
}
}
示例10: onSaveInstanceState
protected Parcelable onSaveInstanceState() {
mBaseMethodCalled = true;
return AbsSavedState.EMPTY_STATE;
}