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 aBundleable
to 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 aBundle
to 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 aBundle
to 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 ofBundleable
to a listBundle
.
-
fromBundleList
public static <T extends Bundleable> ImmutableList<T> fromBundleList(Bundleable.Creator<T> creator, List<Bundle> bundleList)
Converts a list ofBundle
to 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 aSparseArray
ofBundle
to aSparseArray
ofBundleable
. ReturnsdefaultValue
ifbundleSparseArray
is null.
-
toBundleArrayList
public static <T extends Bundleable> ArrayList<Bundle> toBundleArrayList(Collection<T> bundleables)
Converts a collection ofBundleable
to anArrayList
ofBundle
so that the returned list can be put toBundle
usingBundle.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 aSparseArray
ofBundleable
to anSparseArray
ofBundle
so that the returnedSparseArray
can be put toBundle
usingBundle.putSparseParcelableArray(java.lang.String, android.util.SparseArray<? extends android.os.Parcelable>)
conveniently.
-
-