Class BundleableUtil
- java.lang.Object
-
- com.google.android.exoplayer2.util.BundleableUtil
-
public final class BundleableUtil extends Object
Utilities forBundleable.
-
-
Method Summary
-
-
-
Method Detail
-
toNullableBundle
@Nullable public static Bundle toNullableBundle(@Nullable Bundleable bundleable)
Converts aBundleableto aBundle. It's a convenience wrapper ofBundleable.toBundle()that can take nullable values.
-
fromNullableBundle
@Nullable public static <T extends Bundleable> T fromNullableBundle(Bundleable.Creator<T> creator, @Nullable Bundle bundle)
Converts aBundleto aBundleable. It's a convenience wrapper ofBundleable.Creator.fromBundle(android.os.Bundle)that can take nullable values.
-
fromNullableBundle
public static <T extends Bundleable> T fromNullableBundle(Bundleable.Creator<T> creator, @Nullable Bundle bundle, T defaultValue)
Converts aBundleto aBundleable. It's a convenience wrapper ofBundleable.Creator.fromBundle(android.os.Bundle)that provides default value to ensure non-null.
-
toBundleList
public static <T extends Bundleable> ImmutableList<Bundle> toBundleList(List<T> bundleableList)
Converts a list ofBundleableto a listBundle.
-
fromBundleList
public static <T extends Bundleable> ImmutableList<T> fromBundleList(Bundleable.Creator<T> creator, List<Bundle> bundleList)
Converts a list ofBundleto a list ofBundleable.
-
fromBundleNullableList
public static <T extends Bundleable> List<T> fromBundleNullableList(Bundleable.Creator<T> creator, @Nullable List<Bundle> bundleList, List<T> defaultValue)
-
fromBundleNullableSparseArray
public static <T extends Bundleable> SparseArray<T> fromBundleNullableSparseArray(Bundleable.Creator<T> creator, @Nullable SparseArray<Bundle> bundleSparseArray, SparseArray<T> defaultValue)
Converts aSparseArrayofBundleto aSparseArrayofBundleable. ReturnsdefaultValueifbundleSparseArrayis null.
-
toBundleArrayList
public static <T extends Bundleable> ArrayList<Bundle> toBundleArrayList(Collection<T> bundleables)
Converts a collection ofBundleableto anArrayListofBundleso that the returned list can be put toBundleusingBundle.putParcelableArrayList(java.lang.String, java.util.ArrayList<? extends android.os.Parcelable>)conveniently.
-
toBundleSparseArray
public static <T extends Bundleable> SparseArray<Bundle> toBundleSparseArray(SparseArray<T> bundleableSparseArray)
Converts aSparseArrayofBundleableto anSparseArrayofBundleso that the returnedSparseArraycan be put toBundleusingBundle.putSparseParcelableArray(java.lang.String, android.util.SparseArray<? extends android.os.Parcelable>)conveniently.
-
-