Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
753bccec
authored
Feb 10, 2021
by
gyumin
Committed by
Ian Baker
Feb 11, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Implement Bundleable for media2 MediaItem and related classes
PiperOrigin-RevId: 356622155
parent
e28332ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
library/common/src/main/java/com/google/android/exoplayer2/Bundleable.java
library/common/src/main/java/com/google/android/exoplayer2/Bundleable.java
View file @
753bccec
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
;
package
com
.
google
.
android
.
exoplayer2
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
androidx.annotation.Nullable
;
/**
/**
* Interface for classes whose instance can be stored in a {@link Bundle} by {@link #toBundle()} and
* Interface for classes whose instance can be stored in a {@link Bundle} by {@link #toBundle()} and
...
@@ -36,6 +37,24 @@ public interface Bundleable {
...
@@ -36,6 +37,24 @@ public interface Bundleable {
/** Returns a {@link Bundle} representing the information stored in this object. */
/** Returns a {@link Bundle} representing the information stored in this object. */
Bundle
toBundle
();
Bundle
toBundle
();
/**
* Converts a {@link Bundleable} to a {@link Bundle}. It's a convenient wrapper of {@link
* Bundleable#toBundle} that can take nullable values.
*/
@Nullable
static
Bundle
toNullableBundle
(
@Nullable
Bundleable
bundleable
)
{
return
bundleable
==
null
?
null
:
bundleable
.
toBundle
();
}
/**
* Converts a {@link Bundle} to a {@link Bundleable}. It's a convenient wrapper of {@link
* Creator#fromBundle} that can take nullable values.
*/
@Nullable
static
<
T
extends
Bundleable
>
T
fromNullableBundle
(
Creator
<
T
>
creator
,
@Nullable
Bundle
bundle
)
{
return
bundle
==
null
?
null
:
creator
.
fromBundle
(
bundle
);
}
/** Interface for the static {@code CREATOR} field of {@link Bundleable} classes. */
/** Interface for the static {@code CREATOR} field of {@link Bundleable} classes. */
interface
Creator
<
T
extends
Bundleable
>
{
interface
Creator
<
T
extends
Bundleable
>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment