Search in sources :

Example 91 with Parcelable

use of android.os.Parcelable in project material by rey5137.

the class TimePicker method onSaveInstanceState.

@Override
protected Parcelable onSaveInstanceState() {
    Parcelable superState = super.onSaveInstanceState();
    SavedState ss = new SavedState(superState);
    ss.mode = mMode;
    ss.hour = mHour;
    ss.minute = mMinute;
    ss.is24Hour = m24Hour;
    return ss;
}
Also used : Parcelable(android.os.Parcelable)

Example 92 with Parcelable

use of android.os.Parcelable in project material by rey5137.

the class Switch method onSaveInstanceState.

@Override
protected Parcelable onSaveInstanceState() {
    Parcelable superState = super.onSaveInstanceState();
    SavedState ss = new SavedState(superState);
    ss.checked = isChecked();
    return ss;
}
Also used : Parcelable(android.os.Parcelable)

Example 93 with Parcelable

use of android.os.Parcelable in project android-support-v4-googlemaps by petedoyle.

the class Fragment method performCreate.

void performCreate(Bundle savedInstanceState) {
    if (mChildFragmentManager != null) {
        mChildFragmentManager.noteStateNotSaved();
    }
    mCalled = false;
    onCreate(savedInstanceState);
    if (!mCalled) {
        throw new SuperNotCalledException("Fragment " + this + " did not call through to super.onCreate()");
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FragmentActivity.FRAGMENTS_TAG);
        if (p != null) {
            if (mChildFragmentManager == null) {
                instantiateChildFragmentManager();
            }
            mChildFragmentManager.restoreAllState(p, null);
            mChildFragmentManager.dispatchCreate();
        }
    }
}
Also used : Parcelable(android.os.Parcelable)

Example 94 with Parcelable

use of android.os.Parcelable in project android-support-v4-googlemaps by petedoyle.

the class FragmentActivity method onCreate.

/**
     * Perform initialization of all fragments and loaders.
     */
@Override
protected void onCreate(Bundle savedInstanceState) {
    mFragments.attachActivity(this, mContainer, null);
    // Old versions of the platform didn't do this!
    if (getLayoutInflater().getFactory() == null) {
        getLayoutInflater().setFactory(this);
    }
    super.onCreate(savedInstanceState);
    NonConfigurationInstances nc = (NonConfigurationInstances) getLastNonConfigurationInstance();
    if (nc != null) {
        mAllLoaderManagers = nc.loaders;
    }
    if (savedInstanceState != null) {
        Parcelable p = savedInstanceState.getParcelable(FRAGMENTS_TAG);
        mFragments.restoreAllState(p, nc != null ? nc.fragments : null);
    }
    mFragments.dispatchCreate();
}
Also used : Parcelable(android.os.Parcelable)

Example 95 with Parcelable

use of android.os.Parcelable in project android-support-v4-googlemaps by petedoyle.

the class FragmentStatePagerAdapter method restoreState.

@Override
public void restoreState(Parcelable state, ClassLoader loader) {
    if (state != null) {
        Bundle bundle = (Bundle) state;
        bundle.setClassLoader(loader);
        Parcelable[] fss = bundle.getParcelableArray("states");
        mSavedState.clear();
        mFragments.clear();
        if (fss != null) {
            for (int i = 0; i < fss.length; i++) {
                mSavedState.add((Fragment.SavedState) fss[i]);
            }
        }
        Iterable<String> keys = bundle.keySet();
        for (String key : keys) {
            if (key.startsWith("f")) {
                int index = Integer.parseInt(key.substring(1));
                Fragment f = mFragmentManager.getFragment(bundle, key);
                if (f != null) {
                    while (mFragments.size() <= index) {
                        mFragments.add(null);
                    }
                    FragmentCompat.setMenuVisibility(f, false);
                    mFragments.set(index, f);
                } else {
                    Log.w(TAG, "Bad fragment at key " + key);
                }
            }
        }
    }
}
Also used : Bundle(android.os.Bundle) Parcelable(android.os.Parcelable) Fragment(android.app.Fragment)

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