@Override public void restoreState(Parcelable state, ClassLoader loader) { Bundle bundle = (Bundle)state; if (state != null) { savedPages = bundle.getSparseParcelableArray(KEY_SAVED_PAGES); maxPagesToStateSave = bundle.getInt(KEY_MAX_PAGES_TO_STATE_SAVE); savedPageHistory = bundle.getIntegerArrayList(KEY_SAVE_PAGE_HISTORY); } }
@Override public void restoreState(Parcelable state, ClassLoader loader) { Bundle bundle = (Bundle)state; if (state != null) { savesState = bundle.getBoolean(KEY_SAVES_STATE, false); savedPages = bundle.getSparseParcelableArray(KEY_SAVED_PAGES); int[] visiblePageIdsKeys = bundle.getIntArray(KEY_VISIBLE_PAGE_IDS_KEYS); String[] visiblePageIdsValues = bundle.getStringArray(KEY_VISIBLE_PAGE_IDS_VALUES); visiblePageIds = new SparseArray<>(visiblePageIdsKeys.length); for (int i = 0; i < visiblePageIdsKeys.length; i++) { visiblePageIds.put(visiblePageIdsKeys[i], visiblePageIdsValues[i]); } } }
public final View createDrawerView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { drawerView = onCreateDrawerView(inflater, container, savedInstanceState); if (drawerView != null) { SparseArray<Parcelable> saved = drawerViewState; if (saved == null && savedInstanceState != null) { saved = savedInstanceState.getSparseParcelableArray(KEY_DRAWER_VIEW_STATE); } if (saved != null) { drawerView.restoreHierarchyState(saved); } } return drawerView; }
private void restoreViewState(@NonNull View view) { if (viewState != null) { view.restoreHierarchyState(viewState.getSparseParcelableArray(KEY_VIEW_STATE_HIERARCHY)); Bundle savedViewState = viewState.getBundle(KEY_VIEW_STATE_BUNDLE); savedViewState.setClassLoader(getClass().getClassLoader()); onRestoreViewState(view, savedViewState); restoreChildControllerHosts(); List<LifecycleListener> listeners = new ArrayList<>(lifecycleListeners); for (LifecycleListener lifecycleListener : listeners) { lifecycleListener.onRestoreViewState(this, viewState); } } }
when(bundle.getSparseParcelableArray(anyString())).thenAnswer(get);
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); final int itemCount = size(); for (int i = 0; i < itemCount; i++) { final android.view.MenuItem item = getItem(i); final View v = MenuItemCompat.getActionView(item); if (v != null && v.getId() != View.NO_ID) { v.restoreHierarchyState(viewStates); } } final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID); if (expandedId > 0) { android.view.MenuItem itemToExpand = findItem(expandedId); if (itemToExpand != null) { MenuItemCompat.expandActionView(itemToExpand); } } }
@Override public final void restoreInstanceState(@Nullable final Bundle savedInstanceState) { if (savedInstanceState != null) { savedInstanceStates = savedInstanceState.getSparseParcelableArray(SAVED_INSTANCE_STATES_EXTRA); } }
savedInstanceState.getSparseParcelableArray(VIEW_HIERARCHY_STATE_EXTRA);
public <T extends Parcelable> SparseArray<T> getSparseParcelableArray(Bundle state, String key) { return state.getSparseParcelableArray(key + mBaseKey); }
public void restoreInstanceState(Bundle savedInstanceState) { openedPositions = savedInstanceState.getSparseParcelableArray(OPENED_STATES); if (openedPositions == null) { openedPositions = new SparseArray<>(); } }
final void restore(Bundle savedInstanceState) { if (viewState == null && savedInstanceState != null) { viewState = savedInstanceState.getSparseParcelableArray(VIEW_STATE + hashCode()); } }
public AdRecordStore(final Parcel in) { final Bundle b = in.readBundle(getClass().getClassLoader()); mAdRecords = b.getSparseParcelableArray("records_array"); mLocalNameComplete = b.getString("local_name_complete"); mLocalNameShort = b.getString("local_name_short"); }
void restoreState(Bundle savedInstanceState) { if(savedInstanceState != null) { Bundle state = savedInstanceState.getBundle(mStateKey); if(state != null) { mOperations = savedInstanceState.getSparseParcelableArray("operations"); if(mEnableLogging) { Log.d(TAG, String.format("[Restoring State]")); } } } }
public static NotificationCompatBase.Action getAction(Notification notif, int actionIndex, NotificationCompatBase.Action.Factory factory, RemoteInputCompatBase.RemoteInput.Factory remoteInputFactory) { Notification.Action action = notif.actions[actionIndex]; Bundle actionExtras = null; SparseArray<Bundle> actionExtrasMap = notif.extras.getSparseParcelableArray( NotificationCompatJellybean.EXTRA_ACTION_EXTRAS); if (actionExtrasMap != null) { actionExtras = actionExtrasMap.get(actionIndex); } return NotificationCompatJellybean.readAction(factory, remoteInputFactory, action.icon, action.title, action.actionIntent, actionExtras); }
private void dispatchRestoreInstanceState(Bundle state) { SparseArray<Parcelable> presenterStates = state.getSparseParcelableArray(PRESENTER_KEY); if (presenterStates == null || mPresenters.isEmpty()) return; for (WeakReference<MenuPresenter> ref : mPresenters) { final MenuPresenter presenter = ref.get(); if (presenter == null) { mPresenters.remove(ref); } else { final int id = presenter.getId(); if (id > 0) { Parcelable parcel = presenterStates.get(id); if (parcel != null) { presenter.onRestoreInstanceState(parcel); } } } } }
private void dispatchRestoreInstanceState(Bundle state) { SparseArray<Parcelable> presenterStates = state.getSparseParcelableArray(PRESENTER_KEY); if (presenterStates == null || mPresenters.isEmpty()) return; for (WeakReference<MenuPresenter> ref : mPresenters) { final MenuPresenter presenter = ref.get(); if (presenter == null) { mPresenters.remove(ref); } else { final int id = presenter.getId(); if (id > 0) { Parcelable parcel = presenterStates.get(id); if (parcel != null) { presenter.onRestoreInstanceState(parcel); } } } } }
@Override public void onRestoreInstanceState(final Parcelable parcelable) { if (parcelable instanceof Bundle) { Bundle state = (Bundle) parcelable; SparseArray<Parcelable> hierarchy = state.getSparseParcelableArray(STATE_HIERARCHY); if (hierarchy != null) { mMenuView.restoreHierarchyState(hierarchy); } Bundle adapterState = state.getBundle(STATE_ADAPTER); if (adapterState != null) { mAdapter.restoreInstanceState(adapterState); } SparseArray<Parcelable> header = state.getSparseParcelableArray(STATE_HEADER); if (header != null) { mHeaderLayout.restoreHierarchyState(header); } } }
@Override protected void onRestoreInstanceState(Parcelable state) { Log.d(TAG, "onRestoreInstanceState"); if (state instanceof Bundle) { Bundle bundle = (Bundle) state; state = bundle.getParcelable("superState"); //RESTORE CUSTOM VALUES profileSparseArray = bundle.getSparseParcelableArray(PROFILE_LIST); populateAvatar(); } if (hvFragmentManager != null) { ProfileChooserFragment profileChooserFragment = (ProfileChooserFragment) hvFragmentManager.findFragmentByTag(ProfileChooserFragment.FRAGMENT_TAG); if (profileChooserFragment != null) { profileChooserFragment.setCallback(HeaderView.this); profileChooserFragment.updateTypeface(typeface); } } super.onRestoreInstanceState(state); }
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && viewStates == null) { //Fixes Issue #652 with sdk <= 2.3.6 return; } final int itemCount = size(); for (int i = 0; i < itemCount; i++) { final MenuItem item = getItem(i); final View v = item.getActionView(); if (v != null && v.getId() != View.NO_ID) { v.restoreHierarchyState(viewStates); } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.restoreActionViewStates(states); } } final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID); if (expandedId > 0) { MenuItem itemToExpand = findItem(expandedId); if (itemToExpand != null) { itemToExpand.expandActionView(); } } }
public void restoreActionViewStates(Bundle states) { if (states == null) { return; } SparseArray<Parcelable> viewStates = states.getSparseParcelableArray( getActionViewStatesKey()); final int itemCount = size(); for (int i = 0; i < itemCount; i++) { final MenuItem item = getItem(i); final View v = item.getActionView(); if (v != null && v.getId() != View.NO_ID) { v.restoreHierarchyState(viewStates); } if (item.hasSubMenu()) { final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu(); subMenu.restoreActionViewStates(states); } } final int expandedId = states.getInt(EXPANDED_ACTION_VIEW_ID); if (expandedId > 0) { MenuItem itemToExpand = findItem(expandedId); if (itemToExpand != null) { itemToExpand.expandActionView(); } } }