Search in sources :

Example 81 with Parcelable

use of android.os.Parcelable in project platform_frameworks_base by android.

the class ProgressBar method onSaveInstanceState.

@Override
public Parcelable onSaveInstanceState() {
    // Force our ancestor class to save its state
    Parcelable superState = super.onSaveInstanceState();
    SavedState ss = new SavedState(superState);
    ss.progress = mProgress;
    ss.secondaryProgress = mSecondaryProgress;
    return ss;
}
Also used : Parcelable(android.os.Parcelable)

Example 82 with Parcelable

use of android.os.Parcelable in project platform_frameworks_base by android.

the class MenuBuilder method dispatchSaveInstanceState.

private void dispatchSaveInstanceState(Bundle outState) {
    if (mPresenters.isEmpty())
        return;
    SparseArray<Parcelable> presenterStates = new SparseArray<Parcelable>();
    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) {
                final Parcelable state = presenter.onSaveInstanceState();
                if (state != null) {
                    presenterStates.put(id, state);
                }
            }
        }
    }
    outState.putSparseParcelableArray(PRESENTER_KEY, presenterStates);
}
Also used : SparseArray(android.util.SparseArray) Parcelable(android.os.Parcelable)

Example 83 with Parcelable

use of android.os.Parcelable in project platform_frameworks_base by android.

the class ActionBarView method onSaveInstanceState.

@Override
public Parcelable onSaveInstanceState() {
    Parcelable superState = super.onSaveInstanceState();
    SavedState state = new SavedState(superState);
    if (mExpandedMenuPresenter != null && mExpandedMenuPresenter.mCurrentExpandedItem != null) {
        state.expandedMenuItemId = mExpandedMenuPresenter.mCurrentExpandedItem.getItemId();
    }
    state.isOverflowOpen = isOverflowMenuShowing();
    return state;
}
Also used : Parcelable(android.os.Parcelable)

Example 84 with Parcelable

use of android.os.Parcelable in project platform_frameworks_base by android.

the class HorizontalScrollView method onSaveInstanceState.

@Override
protected Parcelable onSaveInstanceState() {
    if (mContext.getApplicationInfo().targetSdkVersion <= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        // Don't break them, but they don't get scroll state restoration.
        return super.onSaveInstanceState();
    }
    Parcelable superState = super.onSaveInstanceState();
    SavedState ss = new SavedState(superState);
    ss.scrollOffsetFromStart = isLayoutRtl() ? -mScrollX : mScrollX;
    return ss;
}
Also used : Parcelable(android.os.Parcelable)

Example 85 with Parcelable

use of android.os.Parcelable in project platform_frameworks_base by android.

the class IconMenuPresenter method restoreHierarchyState.

public void restoreHierarchyState(Bundle inState) {
    SparseArray<Parcelable> viewStates = inState.getSparseParcelableArray(VIEWS_TAG);
    if (viewStates != null) {
        ((View) mMenuView).restoreHierarchyState(viewStates);
    }
    int subMenuId = inState.getInt(OPEN_SUBMENU_KEY, 0);
    if (subMenuId > 0 && mMenu != null) {
        MenuItem item = mMenu.findItem(subMenuId);
        if (item != null) {
            onSubMenuSelected((SubMenuBuilder) item.getSubMenu());
        }
    }
}
Also used : Parcelable(android.os.Parcelable) MenuItem(android.view.MenuItem) View(android.view.View) ItemView(com.android.internal.view.menu.MenuView.ItemView)

Aggregations

Parcelable (android.os.Parcelable)826 Bundle (android.os.Bundle)99 View (android.view.View)85 Intent (android.content.Intent)58 SparseArray (android.util.SparseArray)38 Test (org.junit.Test)31 ArrayList (java.util.ArrayList)26 MenuItem (android.view.MenuItem)23 ImageView (android.widget.ImageView)23 TextView (android.widget.TextView)17 MenuItem (com.actionbarsherlock.view.MenuItem)14 SuppressLint (android.annotation.SuppressLint)13 Dialog (android.app.Dialog)13 MediumTest (android.support.test.filters.MediumTest)13 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)12 Paint (android.graphics.Paint)12 MenuView (com.android.internal.view.menu.MenuView)12 RemoteException (android.os.RemoteException)11 Bitmap (android.graphics.Bitmap)10 ShortcutIconResource (android.content.Intent.ShortcutIconResource)9