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
259f0f67
authored
Jun 17, 2021
by
samrobinson
Committed by
Oliver Woodman
Jun 21, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add genre to MediaMetadata.
PiperOrigin-RevId: 380000589
parent
d1aacc5f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java
library/common/src/test/java/com/google/android/exoplayer2/MediaMetadataTest.java
library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java
View file @
259f0f67
...
...
@@ -67,6 +67,7 @@ public final class MediaMetadata implements Bundleable {
@Nullable
private
CharSequence
conductor
;
@Nullable
private
Integer
discNumber
;
@Nullable
private
Integer
totalDiscCount
;
@Nullable
private
CharSequence
genre
;
@Nullable
private
Bundle
extras
;
public
Builder
()
{}
...
...
@@ -99,6 +100,7 @@ public final class MediaMetadata implements Bundleable {
this
.
conductor
=
mediaMetadata
.
conductor
;
this
.
discNumber
=
mediaMetadata
.
discNumber
;
this
.
totalDiscCount
=
mediaMetadata
.
totalDiscCount
;
this
.
genre
=
mediaMetadata
.
genre
;
this
.
extras
=
mediaMetadata
.
extras
;
}
...
...
@@ -303,6 +305,12 @@ public final class MediaMetadata implements Bundleable {
return
this
;
}
/** Sets the genre. */
public
Builder
setGenre
(
@Nullable
CharSequence
genre
)
{
this
.
genre
=
genre
;
return
this
;
}
/** Sets the extras {@link Bundle}. */
public
Builder
setExtras
(
@Nullable
Bundle
extras
)
{
this
.
extras
=
extras
;
...
...
@@ -471,6 +479,8 @@ public final class MediaMetadata implements Bundleable {
@Nullable
public
final
Integer
discNumber
;
/** Optional total number of discs. */
@Nullable
public
final
Integer
totalDiscCount
;
/** Optional genre. */
@Nullable
public
final
CharSequence
genre
;
/**
* Optional extras {@link Bundle}.
...
...
@@ -509,6 +519,7 @@ public final class MediaMetadata implements Bundleable {
this
.
conductor
=
builder
.
conductor
;
this
.
discNumber
=
builder
.
discNumber
;
this
.
totalDiscCount
=
builder
.
totalDiscCount
;
this
.
genre
=
builder
.
genre
;
this
.
extras
=
builder
.
extras
;
}
...
...
@@ -552,7 +563,8 @@ public final class MediaMetadata implements Bundleable {
&&
Util
.
areEqual
(
composer
,
that
.
composer
)
&&
Util
.
areEqual
(
conductor
,
that
.
conductor
)
&&
Util
.
areEqual
(
discNumber
,
that
.
discNumber
)
&&
Util
.
areEqual
(
totalDiscCount
,
that
.
totalDiscCount
);
&&
Util
.
areEqual
(
totalDiscCount
,
that
.
totalDiscCount
)
&&
Util
.
areEqual
(
genre
,
that
.
genre
);
}
@Override
...
...
@@ -584,7 +596,8 @@ public final class MediaMetadata implements Bundleable {
composer
,
conductor
,
discNumber
,
totalDiscCount
);
totalDiscCount
,
genre
);
}
// Bundleable implementation.
...
...
@@ -619,6 +632,7 @@ public final class MediaMetadata implements Bundleable {
FIELD_CONDUCTOR
,
FIELD_DISC_NUMBER
,
FIELD_TOTAL_DISC_COUNT
,
FIELD_GENRE
,
FIELD_EXTRAS
})
private
@interface
FieldNumber
{}
...
...
@@ -650,6 +664,7 @@ public final class MediaMetadata implements Bundleable {
private
static
final
int
FIELD_CONDUCTOR
=
24
;
private
static
final
int
FIELD_DISC_NUMBER
=
25
;
private
static
final
int
FIELD_TOTAL_DISC_COUNT
=
26
;
private
static
final
int
FIELD_GENRE
=
27
;
private
static
final
int
FIELD_EXTRAS
=
1000
;
@Override
...
...
@@ -668,6 +683,7 @@ public final class MediaMetadata implements Bundleable {
bundle
.
putCharSequence
(
keyForField
(
FIELD_WRITER
),
writer
);
bundle
.
putCharSequence
(
keyForField
(
FIELD_COMPOSER
),
composer
);
bundle
.
putCharSequence
(
keyForField
(
FIELD_CONDUCTOR
),
conductor
);
bundle
.
putCharSequence
(
keyForField
(
FIELD_GENRE
),
genre
);
if
(
userRating
!=
null
)
{
bundle
.
putBundle
(
keyForField
(
FIELD_USER_RATING
),
userRating
.
toBundle
());
...
...
@@ -736,6 +752,7 @@ public final class MediaMetadata implements Bundleable {
.
setWriter
(
bundle
.
getCharSequence
(
keyForField
(
FIELD_WRITER
)))
.
setComposer
(
bundle
.
getCharSequence
(
keyForField
(
FIELD_COMPOSER
)))
.
setConductor
(
bundle
.
getCharSequence
(
keyForField
(
FIELD_CONDUCTOR
)))
.
setGenre
(
bundle
.
getCharSequence
(
keyForField
(
FIELD_GENRE
)))
.
setExtras
(
bundle
.
getBundle
(
keyForField
(
FIELD_EXTRAS
)));
if
(
bundle
.
containsKey
(
keyForField
(
FIELD_USER_RATING
)))
{
...
...
library/common/src/test/java/com/google/android/exoplayer2/MediaMetadataTest.java
View file @
259f0f67
...
...
@@ -65,6 +65,7 @@ public class MediaMetadataTest {
assertThat
(
mediaMetadata
.
writer
).
isNull
();
assertThat
(
mediaMetadata
.
discNumber
).
isNull
();
assertThat
(
mediaMetadata
.
totalDiscCount
).
isNull
();
assertThat
(
mediaMetadata
.
genre
).
isNull
();
assertThat
(
mediaMetadata
.
extras
).
isNull
();
}
...
...
@@ -121,6 +122,7 @@ public class MediaMetadataTest {
.
setWriter
(
"Writer"
)
.
setDiscNumber
(
1
)
.
setTotalDiscCount
(
3
)
.
setGenre
(
"Pop"
)
.
setExtras
(
extras
)
// Extras is not implemented in MediaMetadata.equals(Object o).
.
build
();
...
...
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