Commit 33b049c1 by ibaker Committed by Ian Baker

Allow stable API users to bundle/unbundle TrackSelectionParameters

It's reasonable to serialize this type to support backgrounding
use-cases, as demonstrated by the main demo app.

PiperOrigin-RevId: 446161300
parent 1809a0b9
...@@ -1177,9 +1177,17 @@ public class TrackSelectionParameters implements Bundleable { ...@@ -1177,9 +1177,17 @@ public class TrackSelectionParameters implements Bundleable {
return bundle; return bundle;
} }
/** Object that can restore {@code TrackSelectionParameters} from a {@link Bundle}. */ /** Construct an instance from a {@link Bundle} produced by {@link #toBundle()}. */
public static TrackSelectionParameters fromBundle(Bundle bundle) {
return new Builder(bundle).build();
}
/**
* @deprecated Use {@link #fromBundle(Bundle)} instead.
*/
@Deprecated
public static final Creator<TrackSelectionParameters> CREATOR = public static final Creator<TrackSelectionParameters> CREATOR =
bundle -> new Builder(bundle).build(); TrackSelectionParameters::fromBundle;
private static String keyForField(@FieldNumber int field) { private static String keyForField(@FieldNumber int field) {
return Integer.toString(field, Character.MAX_RADIX); return Integer.toString(field, Character.MAX_RADIX);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment