Rename Player.PositionInfo#windowIndex to mediaItemIndex
Also fix a typo where windowIndex was being passed to Objects.hashCode twice. The old field is left deprecated for backwards compatibility. Usages will be migrated in an upcoming change. PiperOrigin-RevId: 403049260
This commit is contained in:
parent
8827ccb568
commit
1607043643
@ -473,8 +473,10 @@ public interface Player {
|
|||||||
* The UID of the window, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}.
|
* The UID of the window, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}.
|
||||||
*/
|
*/
|
||||||
@Nullable public final Object windowUid;
|
@Nullable public final Object windowUid;
|
||||||
/** The window index. */
|
/** @deprecated Use {@link #mediaItemIndex} instead. */
|
||||||
public final int windowIndex;
|
@Deprecated public final int windowIndex;
|
||||||
|
/** The media item index. */
|
||||||
|
public final int mediaItemIndex;
|
||||||
/** The media item, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}. */
|
/** The media item, or {@code null} if the timeline is {@link Timeline#isEmpty() empty}. */
|
||||||
@Nullable public final MediaItem mediaItem;
|
@Nullable public final MediaItem mediaItem;
|
||||||
/**
|
/**
|
||||||
@ -509,7 +511,7 @@ public interface Player {
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public PositionInfo(
|
public PositionInfo(
|
||||||
@Nullable Object windowUid,
|
@Nullable Object windowUid,
|
||||||
int windowIndex,
|
int mediaItemIndex,
|
||||||
@Nullable Object periodUid,
|
@Nullable Object periodUid,
|
||||||
int periodIndex,
|
int periodIndex,
|
||||||
long positionMs,
|
long positionMs,
|
||||||
@ -518,7 +520,7 @@ public interface Player {
|
|||||||
int adIndexInAdGroup) {
|
int adIndexInAdGroup) {
|
||||||
this(
|
this(
|
||||||
windowUid,
|
windowUid,
|
||||||
windowIndex,
|
mediaItemIndex,
|
||||||
MediaItem.EMPTY,
|
MediaItem.EMPTY,
|
||||||
periodUid,
|
periodUid,
|
||||||
periodIndex,
|
periodIndex,
|
||||||
@ -531,7 +533,7 @@ public interface Player {
|
|||||||
/** Creates an instance. */
|
/** Creates an instance. */
|
||||||
public PositionInfo(
|
public PositionInfo(
|
||||||
@Nullable Object windowUid,
|
@Nullable Object windowUid,
|
||||||
int windowIndex,
|
int mediaItemIndex,
|
||||||
@Nullable MediaItem mediaItem,
|
@Nullable MediaItem mediaItem,
|
||||||
@Nullable Object periodUid,
|
@Nullable Object periodUid,
|
||||||
int periodIndex,
|
int periodIndex,
|
||||||
@ -540,7 +542,8 @@ public interface Player {
|
|||||||
int adGroupIndex,
|
int adGroupIndex,
|
||||||
int adIndexInAdGroup) {
|
int adIndexInAdGroup) {
|
||||||
this.windowUid = windowUid;
|
this.windowUid = windowUid;
|
||||||
this.windowIndex = windowIndex;
|
this.windowIndex = mediaItemIndex;
|
||||||
|
this.mediaItemIndex = mediaItemIndex;
|
||||||
this.mediaItem = mediaItem;
|
this.mediaItem = mediaItem;
|
||||||
this.periodUid = periodUid;
|
this.periodUid = periodUid;
|
||||||
this.periodIndex = periodIndex;
|
this.periodIndex = periodIndex;
|
||||||
@ -559,7 +562,7 @@ public interface Player {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PositionInfo that = (PositionInfo) o;
|
PositionInfo that = (PositionInfo) o;
|
||||||
return windowIndex == that.windowIndex
|
return mediaItemIndex == that.mediaItemIndex
|
||||||
&& periodIndex == that.periodIndex
|
&& periodIndex == that.periodIndex
|
||||||
&& positionMs == that.positionMs
|
&& positionMs == that.positionMs
|
||||||
&& contentPositionMs == that.contentPositionMs
|
&& contentPositionMs == that.contentPositionMs
|
||||||
@ -574,11 +577,10 @@ public interface Player {
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(
|
return Objects.hashCode(
|
||||||
windowUid,
|
windowUid,
|
||||||
windowIndex,
|
mediaItemIndex,
|
||||||
mediaItem,
|
mediaItem,
|
||||||
periodUid,
|
periodUid,
|
||||||
periodIndex,
|
periodIndex,
|
||||||
windowIndex,
|
|
||||||
positionMs,
|
positionMs,
|
||||||
contentPositionMs,
|
contentPositionMs,
|
||||||
adGroupIndex,
|
adGroupIndex,
|
||||||
@ -589,7 +591,7 @@ public interface Player {
|
|||||||
@Documented
|
@Documented
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({
|
@IntDef({
|
||||||
FIELD_WINDOW_INDEX,
|
FIELD_MEDIA_ITEM_INDEX,
|
||||||
FIELD_MEDIA_ITEM,
|
FIELD_MEDIA_ITEM,
|
||||||
FIELD_PERIOD_INDEX,
|
FIELD_PERIOD_INDEX,
|
||||||
FIELD_POSITION_MS,
|
FIELD_POSITION_MS,
|
||||||
@ -599,7 +601,7 @@ public interface Player {
|
|||||||
})
|
})
|
||||||
private @interface FieldNumber {}
|
private @interface FieldNumber {}
|
||||||
|
|
||||||
private static final int FIELD_WINDOW_INDEX = 0;
|
private static final int FIELD_MEDIA_ITEM_INDEX = 0;
|
||||||
private static final int FIELD_MEDIA_ITEM = 1;
|
private static final int FIELD_MEDIA_ITEM = 1;
|
||||||
private static final int FIELD_PERIOD_INDEX = 2;
|
private static final int FIELD_PERIOD_INDEX = 2;
|
||||||
private static final int FIELD_POSITION_MS = 3;
|
private static final int FIELD_POSITION_MS = 3;
|
||||||
@ -616,7 +618,7 @@ public interface Player {
|
|||||||
@Override
|
@Override
|
||||||
public Bundle toBundle() {
|
public Bundle toBundle() {
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(keyForField(FIELD_WINDOW_INDEX), windowIndex);
|
bundle.putInt(keyForField(FIELD_MEDIA_ITEM_INDEX), mediaItemIndex);
|
||||||
bundle.putBundle(keyForField(FIELD_MEDIA_ITEM), BundleableUtil.toNullableBundle(mediaItem));
|
bundle.putBundle(keyForField(FIELD_MEDIA_ITEM), BundleableUtil.toNullableBundle(mediaItem));
|
||||||
bundle.putInt(keyForField(FIELD_PERIOD_INDEX), periodIndex);
|
bundle.putInt(keyForField(FIELD_PERIOD_INDEX), periodIndex);
|
||||||
bundle.putLong(keyForField(FIELD_POSITION_MS), positionMs);
|
bundle.putLong(keyForField(FIELD_POSITION_MS), positionMs);
|
||||||
@ -630,8 +632,8 @@ public interface Player {
|
|||||||
public static final Creator<PositionInfo> CREATOR = PositionInfo::fromBundle;
|
public static final Creator<PositionInfo> CREATOR = PositionInfo::fromBundle;
|
||||||
|
|
||||||
private static PositionInfo fromBundle(Bundle bundle) {
|
private static PositionInfo fromBundle(Bundle bundle) {
|
||||||
int windowIndex =
|
int mediaItemIndex =
|
||||||
bundle.getInt(keyForField(FIELD_WINDOW_INDEX), /* defaultValue= */ C.INDEX_UNSET);
|
bundle.getInt(keyForField(FIELD_MEDIA_ITEM_INDEX), /* defaultValue= */ C.INDEX_UNSET);
|
||||||
@Nullable
|
@Nullable
|
||||||
MediaItem mediaItem =
|
MediaItem mediaItem =
|
||||||
BundleableUtil.fromNullableBundle(
|
BundleableUtil.fromNullableBundle(
|
||||||
@ -648,7 +650,7 @@ public interface Player {
|
|||||||
bundle.getInt(keyForField(FIELD_AD_INDEX_IN_AD_GROUP), /* defaultValue= */ C.INDEX_UNSET);
|
bundle.getInt(keyForField(FIELD_AD_INDEX_IN_AD_GROUP), /* defaultValue= */ C.INDEX_UNSET);
|
||||||
return new PositionInfo(
|
return new PositionInfo(
|
||||||
/* windowUid= */ null,
|
/* windowUid= */ null,
|
||||||
windowIndex,
|
mediaItemIndex,
|
||||||
mediaItem,
|
mediaItem,
|
||||||
/* periodUid= */ null,
|
/* periodUid= */ null,
|
||||||
periodIndex,
|
periodIndex,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user