Commit 351b8a60 by tonihei Committed by Oliver Woodman

Remove isFirstWindow/isLastWindow from Timeline.

These methods are only used in one place, and offer duplicate
functionality to checking getNext(Previous)WindowIndex == C.INDEX_UNSET.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165910258
parent 4c51d386
...@@ -594,30 +594,6 @@ public abstract class Timeline { ...@@ -594,30 +594,6 @@ public abstract class Timeline {
} }
/** /**
* Returns whether the given window is the last window of the timeline depending on the
* {@code repeatMode}.
*
* @param windowIndex A window index.
* @param repeatMode A repeat mode.
* @return Whether the window of the given index is the last window of the timeline.
*/
public final boolean isLastWindow(int windowIndex, @Player.RepeatMode int repeatMode) {
return getNextWindowIndex(windowIndex, repeatMode) == C.INDEX_UNSET;
}
/**
* Returns whether the given window is the first window of the timeline depending on the
* {@code repeatMode}.
*
* @param windowIndex A window index.
* @param repeatMode A repeat mode.
* @return Whether the window of the given index is the first window of the timeline.
*/
public final boolean isFirstWindow(int windowIndex, @Player.RepeatMode int repeatMode) {
return getPreviousWindowIndex(windowIndex, repeatMode) == C.INDEX_UNSET;
}
/**
* Populates a {@link Window} with data for the window at the specified index. Does not populate * Populates a {@link Window} with data for the window at the specified index. Does not populate
* {@link Window#id}. * {@link Window#id}.
* *
......
...@@ -675,9 +675,10 @@ public class PlaybackControlView extends FrameLayout { ...@@ -675,9 +675,10 @@ public class PlaybackControlView extends FrameLayout {
int windowIndex = player.getCurrentWindowIndex(); int windowIndex = player.getCurrentWindowIndex();
timeline.getWindow(windowIndex, window); timeline.getWindow(windowIndex, window);
isSeekable = window.isSeekable; isSeekable = window.isSeekable;
enablePrevious = !timeline.isFirstWindow(windowIndex, player.getRepeatMode()) enablePrevious = isSeekable || !window.isDynamic
|| isSeekable || !window.isDynamic; || timeline.getPreviousWindowIndex(windowIndex, player.getRepeatMode()) != C.INDEX_UNSET;
enableNext = !timeline.isLastWindow(windowIndex, player.getRepeatMode()) || window.isDynamic; enableNext = window.isDynamic
|| timeline.getNextWindowIndex(windowIndex, player.getRepeatMode()) != C.INDEX_UNSET;
if (player.isPlayingAd()) { if (player.isPlayingAd()) {
// Always hide player controls during ads. // Always hide player controls during ads.
hide(); hide();
......
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