当前位置: 首页>>代码示例>>Java>>正文


Java AbsSavedState类代码示例

本文整理汇总了Java中android.view.AbsSavedState的典型用法代码示例。如果您正苦于以下问题:Java AbsSavedState类的具体用法?Java AbsSavedState怎么用?Java AbsSavedState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbsSavedState类属于android.view包,在下文中一共展示了AbsSavedState类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSaveInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
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;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:24,代码来源:CoordinatorLayout.java

示例2: onRestoreInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:34,代码来源:PullToRefreshBase.java

示例3: testGridViewSavedState

import android.view.AbsSavedState; //导入依赖的package包/类
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));
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:30,代码来源:SavedStateTest.java

示例4: testListViewSavedState

import android.view.AbsSavedState; //导入依赖的package包/类
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));
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:30,代码来源:SavedStateTest.java

示例5: testRecyclerViewSavedState

import android.view.AbsSavedState; //导入依赖的package包/类
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));
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:30,代码来源:SavedStateTest.java

示例6: testScrollViewSavedState

import android.view.AbsSavedState; //导入依赖的package包/类
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);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:15,代码来源:SavedStateTest.java

示例7: testWebViewSavedState

import android.view.AbsSavedState; //导入依赖的package包/类
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);
}
 
开发者ID:LeMinhAn,项目名称:AndroidObservableScrollView-master,代码行数:15,代码来源:SavedStateTest.java

示例8: saveInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:universum-studios,项目名称:android_database,代码行数:12,代码来源:BaseCursorAdapter.java

示例9: saveInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:aschattney,项目名称:photostream-tools,代码行数:12,代码来源:SearchViewDelegate.java

示例10: onSaveInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
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;
}
 
开发者ID:yinghuihong,项目名称:fonticon,代码行数:13,代码来源:FontIconDrawable.java

示例11: onRestoreInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
protected void onRestoreInstanceState(Parcelable state) {
    mBaseMethodCalled = true;
    if (state != AbsSavedState.EMPTY_STATE && state != null) {
        throw new IllegalArgumentException(
                "Wrong state class -- expecting Preference State");
    }
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:8,代码来源:Preference.java

示例12: superOnSaveInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
@Override public Parcelable superOnSaveInstanceState() {
  return Mockito.mock(AbsSavedState.class);
}
 
开发者ID:sockeqwe,项目名称:mosby,代码行数:4,代码来源:PartialViewGroupMvpViewStateDelegateCallbackImpl.java

示例13: onSaveInstanceState

import android.view.AbsSavedState; //导入依赖的package包/类
protected Parcelable onSaveInstanceState() {
    mBaseMethodCalled = true;
    return AbsSavedState.EMPTY_STATE;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:5,代码来源:Preference.java


注:本文中的android.view.AbsSavedState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。