Skip to content

Commit

Permalink
Fix use of API level 19 method
Browse files Browse the repository at this point in the history
Issue: #1965

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136595233
  • Loading branch information
ojw28 committed Oct 19, 2016
1 parent aa1002a commit 3a5cb43
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public interface VisibilityListener {
private ExoPlayer player;
private VisibilityListener visibilityListener;

private boolean isAttachedToWindow;
private boolean dragging;
private int rewindMs;
private int fastForwardMs;
Expand Down Expand Up @@ -264,7 +265,7 @@ private void hideAfterTimeout() {
removeCallbacks(hideAction);
if (showTimeoutMs > 0) {
hideAtMs = SystemClock.uptimeMillis() + showTimeoutMs;
if (isAttachedToWindow()) {
if (isAttachedToWindow) {
postDelayed(hideAction, showTimeoutMs);
}
} else {
Expand All @@ -279,7 +280,7 @@ private void updateAll() {
}

private void updatePlayPauseButton() {
if (!isVisible() || !isAttachedToWindow()) {
if (!isVisible() || !isAttachedToWindow) {
return;
}
boolean playing = player != null && player.getPlayWhenReady();
Expand All @@ -291,7 +292,7 @@ private void updatePlayPauseButton() {
}

private void updateNavigation() {
if (!isVisible() || !isAttachedToWindow()) {
if (!isVisible() || !isAttachedToWindow) {
return;
}
Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
Expand All @@ -315,7 +316,7 @@ private void updateNavigation() {
}

private void updateProgress() {
if (!isVisible() || !isAttachedToWindow()) {
if (!isVisible() || !isAttachedToWindow) {
return;
}
long duration = player == null ? 0 : player.getDuration();
Expand Down Expand Up @@ -426,6 +427,7 @@ private void fastForward() {
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
isAttachedToWindow = true;
if (hideAtMs != C.TIME_UNSET) {
long delayMs = hideAtMs - SystemClock.uptimeMillis();
if (delayMs <= 0) {
Expand All @@ -440,6 +442,7 @@ public void onAttachedToWindow() {
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
isAttachedToWindow = false;
removeCallbacks(updateProgressAction);
removeCallbacks(hideAction);
}
Expand Down

0 comments on commit 3a5cb43

Please sign in to comment.