Search in sources :

Example 31 with SparseArray

use of android.util.SparseArray in project Libraries-for-Android-Developers by eoecn.

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 32 with SparseArray

use of android.util.SparseArray in project cw-omnibus by commonsguy.

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 33 with SparseArray

use of android.util.SparseArray in project android-parcelable-intellij-plugin by mcharmas.

the class SparseParcelable method create.

public static SparseParcelable create() {
    SparseArray<String> sampleSparseArray = new SparseArray<String>(10);
    sampleSparseArray.put(10, "abcd");
    SparseBooleanArray sparseBooleanArray = new SparseBooleanArray();
    sparseBooleanArray.put(1, false);
    return new SparseParcelable(sampleSparseArray, sparseBooleanArray);
}
Also used : SparseArray(android.util.SparseArray) SparseBooleanArray(android.util.SparseBooleanArray)

Example 34 with SparseArray

use of android.util.SparseArray in project SmartAndroidSource by jaychou2012.

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 35 with SparseArray

use of android.util.SparseArray in project ViewPagerIndicator by LuckyJayce.

the class RecycleBin method setViewTypeCount.

public void setViewTypeCount(int viewTypeCount) {
    if (viewTypeCount < 1) {
        throw new IllegalArgumentException("Can't have a viewTypeCount < 1");
    }
    // noinspection unchecked
    @SuppressWarnings("unchecked") SparseArray<View>[] scrapViews = new SparseArray[viewTypeCount];
    for (int i = 0; i < viewTypeCount; i++) {
        scrapViews[i] = new SparseArray<View>();
    }
    this.viewTypeCount = viewTypeCount;
    currentScrapViews = scrapViews[0];
    this.scrapViews = scrapViews;
}
Also used : SparseArray(android.util.SparseArray) View(android.view.View) SuppressLint(android.annotation.SuppressLint)

Aggregations

SparseArray (android.util.SparseArray)250 ArrayList (java.util.ArrayList)74 ProcessState (com.android.internal.app.procstats.ProcessState)41 Parcelable (android.os.Parcelable)37 View (android.view.View)35 ServiceState (com.android.internal.app.procstats.ServiceState)31 RemoteException (android.os.RemoteException)24 Point (android.graphics.Point)19 ArraySet (android.util.ArraySet)17 HashMap (java.util.HashMap)17 ComponentName (android.content.ComponentName)15 ProcessStats (com.android.internal.app.procstats.ProcessStats)15 UserHandle (android.os.UserHandle)14 ArrayMap (android.util.ArrayMap)14 UserInfo (android.content.pm.UserInfo)13 Paint (android.graphics.Paint)13 Bitmap (android.graphics.Bitmap)12 IOException (java.io.IOException)12 ApplicationInfo (android.content.pm.ApplicationInfo)11 SparseIntArray (android.util.SparseIntArray)11