Correct naming of compilation field MediaMetadata.

PiperOrigin-RevId: 381016088
This commit is contained in:
samrobinson 2021-06-23 14:17:58 +01:00 committed by Oliver Woodman
parent 7d05f20493
commit 2d44f82aa4
2 changed files with 16 additions and 16 deletions

View File

@ -66,7 +66,7 @@ public final class MediaMetadata implements Bundleable {
@Nullable private Integer discNumber; @Nullable private Integer discNumber;
@Nullable private Integer totalDiscCount; @Nullable private Integer totalDiscCount;
@Nullable private CharSequence genre; @Nullable private CharSequence genre;
@Nullable private CharSequence playlistTitle; @Nullable private CharSequence compilation;
@Nullable private Bundle extras; @Nullable private Bundle extras;
public Builder() {} public Builder() {}
@ -100,7 +100,7 @@ public final class MediaMetadata implements Bundleable {
this.discNumber = mediaMetadata.discNumber; this.discNumber = mediaMetadata.discNumber;
this.totalDiscCount = mediaMetadata.totalDiscCount; this.totalDiscCount = mediaMetadata.totalDiscCount;
this.genre = mediaMetadata.genre; this.genre = mediaMetadata.genre;
this.playlistTitle = mediaMetadata.playlistTitle; this.compilation = mediaMetadata.compilation;
this.extras = mediaMetadata.extras; this.extras = mediaMetadata.extras;
} }
@ -299,9 +299,9 @@ public final class MediaMetadata implements Bundleable {
return this; return this;
} }
/** Sets the playlist title. */ /** Sets the compilation. */
public Builder setPlaylistTitle(@Nullable CharSequence playlistTitle) { public Builder setCompilation(@Nullable CharSequence compilation) {
this.playlistTitle = playlistTitle; this.compilation = compilation;
return this; return this;
} }
@ -475,8 +475,8 @@ public final class MediaMetadata implements Bundleable {
@Nullable public final Integer totalDiscCount; @Nullable public final Integer totalDiscCount;
/** Optional genre. */ /** Optional genre. */
@Nullable public final CharSequence genre; @Nullable public final CharSequence genre;
/** Optional playlist title. */ /** Optional compilation. */
@Nullable public final CharSequence playlistTitle; @Nullable public final CharSequence compilation;
/** /**
* Optional extras {@link Bundle}. * Optional extras {@link Bundle}.
@ -516,7 +516,7 @@ public final class MediaMetadata implements Bundleable {
this.discNumber = builder.discNumber; this.discNumber = builder.discNumber;
this.totalDiscCount = builder.totalDiscCount; this.totalDiscCount = builder.totalDiscCount;
this.genre = builder.genre; this.genre = builder.genre;
this.playlistTitle = builder.playlistTitle; this.compilation = builder.compilation;
this.extras = builder.extras; this.extras = builder.extras;
} }
@ -562,7 +562,7 @@ public final class MediaMetadata implements Bundleable {
&& Util.areEqual(discNumber, that.discNumber) && Util.areEqual(discNumber, that.discNumber)
&& Util.areEqual(totalDiscCount, that.totalDiscCount) && Util.areEqual(totalDiscCount, that.totalDiscCount)
&& Util.areEqual(genre, that.genre) && Util.areEqual(genre, that.genre)
&& Util.areEqual(playlistTitle, that.playlistTitle); && Util.areEqual(compilation, that.compilation);
} }
@Override @Override
@ -596,7 +596,7 @@ public final class MediaMetadata implements Bundleable {
discNumber, discNumber,
totalDiscCount, totalDiscCount,
genre, genre,
playlistTitle); compilation);
} }
// Bundleable implementation. // Bundleable implementation.
@ -632,7 +632,7 @@ public final class MediaMetadata implements Bundleable {
FIELD_DISC_NUMBER, FIELD_DISC_NUMBER,
FIELD_TOTAL_DISC_COUNT, FIELD_TOTAL_DISC_COUNT,
FIELD_GENRE, FIELD_GENRE,
FIELD_PLAYLIST_TITLE, FIELD_COMPILATION,
FIELD_EXTRAS FIELD_EXTRAS
}) })
private @interface FieldNumber {} private @interface FieldNumber {}
@ -665,7 +665,7 @@ public final class MediaMetadata implements Bundleable {
private static final int FIELD_DISC_NUMBER = 25; private static final int FIELD_DISC_NUMBER = 25;
private static final int FIELD_TOTAL_DISC_COUNT = 26; private static final int FIELD_TOTAL_DISC_COUNT = 26;
private static final int FIELD_GENRE = 27; private static final int FIELD_GENRE = 27;
private static final int FIELD_PLAYLIST_TITLE = 28; private static final int FIELD_COMPILATION = 28;
private static final int FIELD_EXTRAS = 1000; private static final int FIELD_EXTRAS = 1000;
@Override @Override
@ -685,7 +685,7 @@ public final class MediaMetadata implements Bundleable {
bundle.putCharSequence(keyForField(FIELD_COMPOSER), composer); bundle.putCharSequence(keyForField(FIELD_COMPOSER), composer);
bundle.putCharSequence(keyForField(FIELD_CONDUCTOR), conductor); bundle.putCharSequence(keyForField(FIELD_CONDUCTOR), conductor);
bundle.putCharSequence(keyForField(FIELD_GENRE), genre); bundle.putCharSequence(keyForField(FIELD_GENRE), genre);
bundle.putCharSequence(keyForField(FIELD_PLAYLIST_TITLE), playlistTitle); bundle.putCharSequence(keyForField(FIELD_COMPILATION), compilation);
if (userRating != null) { if (userRating != null) {
bundle.putBundle(keyForField(FIELD_USER_RATING), userRating.toBundle()); bundle.putBundle(keyForField(FIELD_USER_RATING), userRating.toBundle());
@ -755,7 +755,7 @@ public final class MediaMetadata implements Bundleable {
.setComposer(bundle.getCharSequence(keyForField(FIELD_COMPOSER))) .setComposer(bundle.getCharSequence(keyForField(FIELD_COMPOSER)))
.setConductor(bundle.getCharSequence(keyForField(FIELD_CONDUCTOR))) .setConductor(bundle.getCharSequence(keyForField(FIELD_CONDUCTOR)))
.setGenre(bundle.getCharSequence(keyForField(FIELD_GENRE))) .setGenre(bundle.getCharSequence(keyForField(FIELD_GENRE)))
.setPlaylistTitle(bundle.getCharSequence(keyForField(FIELD_PLAYLIST_TITLE))) .setCompilation(bundle.getCharSequence(keyForField(FIELD_COMPILATION)))
.setExtras(bundle.getBundle(keyForField(FIELD_EXTRAS))); .setExtras(bundle.getBundle(keyForField(FIELD_EXTRAS)));
if (bundle.containsKey(keyForField(FIELD_USER_RATING))) { if (bundle.containsKey(keyForField(FIELD_USER_RATING))) {

View File

@ -66,7 +66,7 @@ public class MediaMetadataTest {
assertThat(mediaMetadata.discNumber).isNull(); assertThat(mediaMetadata.discNumber).isNull();
assertThat(mediaMetadata.totalDiscCount).isNull(); assertThat(mediaMetadata.totalDiscCount).isNull();
assertThat(mediaMetadata.genre).isNull(); assertThat(mediaMetadata.genre).isNull();
assertThat(mediaMetadata.playlistTitle).isNull(); assertThat(mediaMetadata.compilation).isNull();
assertThat(mediaMetadata.extras).isNull(); assertThat(mediaMetadata.extras).isNull();
} }
@ -124,7 +124,7 @@ public class MediaMetadataTest {
.setDiscNumber(1) .setDiscNumber(1)
.setTotalDiscCount(3) .setTotalDiscCount(3)
.setGenre("Pop") .setGenre("Pop")
.setPlaylistTitle("Amazing songs.") .setCompilation("Amazing songs.")
.setExtras(extras) // Extras is not implemented in MediaMetadata.equals(Object o). .setExtras(extras) // Extras is not implemented in MediaMetadata.equals(Object o).
.build(); .build();