mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix use of API level 19 method
Issue: #1965 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136595233
This commit is contained in:
parent
08256eee32
commit
0d679dad0d
1 changed files with 7 additions and 4 deletions
|
|
@ -75,6 +75,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
private ExoPlayer player;
|
private ExoPlayer player;
|
||||||
private VisibilityListener visibilityListener;
|
private VisibilityListener visibilityListener;
|
||||||
|
|
||||||
|
private boolean isAttachedToWindow;
|
||||||
private boolean dragging;
|
private boolean dragging;
|
||||||
private int rewindMs;
|
private int rewindMs;
|
||||||
private int fastForwardMs;
|
private int fastForwardMs;
|
||||||
|
|
@ -264,7 +265,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
removeCallbacks(hideAction);
|
removeCallbacks(hideAction);
|
||||||
if (showTimeoutMs > 0) {
|
if (showTimeoutMs > 0) {
|
||||||
hideAtMs = SystemClock.uptimeMillis() + showTimeoutMs;
|
hideAtMs = SystemClock.uptimeMillis() + showTimeoutMs;
|
||||||
if (isAttachedToWindow()) {
|
if (isAttachedToWindow) {
|
||||||
postDelayed(hideAction, showTimeoutMs);
|
postDelayed(hideAction, showTimeoutMs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -279,7 +280,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePlayPauseButton() {
|
private void updatePlayPauseButton() {
|
||||||
if (!isVisible() || !isAttachedToWindow()) {
|
if (!isVisible() || !isAttachedToWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean playing = player != null && player.getPlayWhenReady();
|
boolean playing = player != null && player.getPlayWhenReady();
|
||||||
|
|
@ -291,7 +292,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNavigation() {
|
private void updateNavigation() {
|
||||||
if (!isVisible() || !isAttachedToWindow()) {
|
if (!isVisible() || !isAttachedToWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
|
Timeline currentTimeline = player != null ? player.getCurrentTimeline() : null;
|
||||||
|
|
@ -315,7 +316,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateProgress() {
|
private void updateProgress() {
|
||||||
if (!isVisible() || !isAttachedToWindow()) {
|
if (!isVisible() || !isAttachedToWindow) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
long duration = player == null ? 0 : player.getDuration();
|
long duration = player == null ? 0 : player.getDuration();
|
||||||
|
|
@ -426,6 +427,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
@Override
|
@Override
|
||||||
public void onAttachedToWindow() {
|
public void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
|
isAttachedToWindow = true;
|
||||||
if (hideAtMs != C.TIME_UNSET) {
|
if (hideAtMs != C.TIME_UNSET) {
|
||||||
long delayMs = hideAtMs - SystemClock.uptimeMillis();
|
long delayMs = hideAtMs - SystemClock.uptimeMillis();
|
||||||
if (delayMs <= 0) {
|
if (delayMs <= 0) {
|
||||||
|
|
@ -440,6 +442,7 @@ public class PlaybackControlView extends FrameLayout {
|
||||||
@Override
|
@Override
|
||||||
public void onDetachedFromWindow() {
|
public void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
|
isAttachedToWindow = false;
|
||||||
removeCallbacks(updateProgressAction);
|
removeCallbacks(updateProgressAction);
|
||||||
removeCallbacks(hideAction);
|
removeCallbacks(hideAction);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue