- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
652 lines
25 KiB
Java
652 lines
25 KiB
Java
package com.google.android.exoplayer2.ui;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Looper;
|
|
import android.os.SystemClock;
|
|
import android.util.AttributeSet;
|
|
import android.view.KeyEvent;
|
|
import android.view.LayoutInflater;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import androidx.annotation.DoNotInline;
|
|
import androidx.annotation.Nullable;
|
|
import com.google.android.exoplayer2.ControlDispatcher;
|
|
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
|
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
|
|
import com.google.android.exoplayer2.Player;
|
|
import com.google.android.exoplayer2.Timeline$Period;
|
|
import com.google.android.exoplayer2.Timeline$Window;
|
|
import com.google.android.exoplayer2.ui.TimeBar;
|
|
import com.google.android.exoplayer2.util.Assertions;
|
|
import com.google.android.exoplayer2.util.Util;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.C;
|
|
import java.util.Formatter;
|
|
import java.util.Iterator;
|
|
import java.util.Locale;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class PlayerControlView extends FrameLayout {
|
|
public long[] adGroupTimesMs;
|
|
public final float buttonAlphaDisabled;
|
|
public final float buttonAlphaEnabled;
|
|
public final ComponentListener componentListener;
|
|
public ControlDispatcher controlDispatcher;
|
|
public long currentBufferedPosition;
|
|
public long currentPosition;
|
|
public final TextView durationView;
|
|
public long[] extraAdGroupTimesMs;
|
|
public boolean[] extraPlayedAdGroups;
|
|
public final View fastForwardButton;
|
|
public final StringBuilder formatBuilder;
|
|
public final Formatter formatter;
|
|
public final Runnable hideAction;
|
|
public long hideAtMs;
|
|
public boolean isAttachedToWindow;
|
|
public final View nextButton;
|
|
public final View pauseButton;
|
|
public final Timeline$Period period;
|
|
public final View playButton;
|
|
public boolean[] playedAdGroups;
|
|
public final TextView positionView;
|
|
public final View previousButton;
|
|
public final String repeatAllButtonContentDescription;
|
|
public final Drawable repeatAllButtonDrawable;
|
|
public final String repeatOffButtonContentDescription;
|
|
public final Drawable repeatOffButtonDrawable;
|
|
public final String repeatOneButtonContentDescription;
|
|
public final Drawable repeatOneButtonDrawable;
|
|
public final ImageView repeatToggleButton;
|
|
public int repeatToggleModes;
|
|
public final View rewindButton;
|
|
public boolean scrubbing;
|
|
public boolean showFastForwardButton;
|
|
public boolean showMultiWindowTimeBar;
|
|
public boolean showNextButton;
|
|
public boolean showPreviousButton;
|
|
public boolean showRewindButton;
|
|
public boolean showShuffleButton;
|
|
public int showTimeoutMs;
|
|
public final ImageView shuffleButton;
|
|
public final Drawable shuffleOffButtonDrawable;
|
|
public final String shuffleOffContentDescription;
|
|
public final Drawable shuffleOnButtonDrawable;
|
|
public final String shuffleOnContentDescription;
|
|
public final TimeBar timeBar;
|
|
public int timeBarMinUpdateIntervalMs;
|
|
public final Runnable updateProgressAction;
|
|
public final CopyOnWriteArrayList visibilityListeners;
|
|
public final View vrButton;
|
|
public final Timeline$Window window;
|
|
|
|
public interface ProgressUpdateListener {
|
|
}
|
|
|
|
public interface VisibilityListener {
|
|
void onVisibilityChange(int i);
|
|
}
|
|
|
|
public int getShowTimeoutMs() {
|
|
return this.showTimeoutMs;
|
|
}
|
|
|
|
public void setProgressUpdateListener(@Nullable ProgressUpdateListener progressUpdateListener) {
|
|
}
|
|
|
|
public final boolean shouldShowPauseButton() {
|
|
return false;
|
|
}
|
|
|
|
public final void updateTimeline() {
|
|
}
|
|
|
|
public static /* synthetic */ Player access$1100(PlayerControlView playerControlView) {
|
|
playerControlView.getClass();
|
|
return null;
|
|
}
|
|
|
|
static {
|
|
ExoPlayerLibraryInfo.registerModule("goog.exo.ui");
|
|
}
|
|
|
|
public PlayerControlView(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public PlayerControlView(Context context, @Nullable AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0);
|
|
}
|
|
|
|
public PlayerControlView(Context context, @Nullable AttributeSet attributeSet, int i) {
|
|
this(context, attributeSet, i, attributeSet);
|
|
}
|
|
|
|
public PlayerControlView(Context context, AttributeSet attributeSet, int i, AttributeSet attributeSet2) {
|
|
super(context, attributeSet, i);
|
|
int i2 = R$layout.exo_player_control_view;
|
|
this.showTimeoutMs = 5000;
|
|
this.repeatToggleModes = 0;
|
|
this.timeBarMinUpdateIntervalMs = 200;
|
|
this.hideAtMs = C.TIME_UNSET;
|
|
this.showRewindButton = true;
|
|
this.showFastForwardButton = true;
|
|
this.showPreviousButton = true;
|
|
this.showNextButton = true;
|
|
this.showShuffleButton = false;
|
|
if (attributeSet2 != null) {
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet2, R$styleable.PlayerControlView, i, 0);
|
|
try {
|
|
this.showTimeoutMs = obtainStyledAttributes.getInt(R$styleable.PlayerControlView_show_timeout, this.showTimeoutMs);
|
|
i2 = obtainStyledAttributes.getResourceId(R$styleable.PlayerControlView_controller_layout_id, i2);
|
|
this.repeatToggleModes = getRepeatToggleModes(obtainStyledAttributes, this.repeatToggleModes);
|
|
this.showRewindButton = obtainStyledAttributes.getBoolean(R$styleable.PlayerControlView_show_rewind_button, this.showRewindButton);
|
|
this.showFastForwardButton = obtainStyledAttributes.getBoolean(R$styleable.PlayerControlView_show_fastforward_button, this.showFastForwardButton);
|
|
this.showPreviousButton = obtainStyledAttributes.getBoolean(R$styleable.PlayerControlView_show_previous_button, this.showPreviousButton);
|
|
this.showNextButton = obtainStyledAttributes.getBoolean(R$styleable.PlayerControlView_show_next_button, this.showNextButton);
|
|
this.showShuffleButton = obtainStyledAttributes.getBoolean(R$styleable.PlayerControlView_show_shuffle_button, this.showShuffleButton);
|
|
setTimeBarMinUpdateInterval(obtainStyledAttributes.getInt(R$styleable.PlayerControlView_time_bar_min_update_interval, this.timeBarMinUpdateIntervalMs));
|
|
} finally {
|
|
obtainStyledAttributes.recycle();
|
|
}
|
|
}
|
|
this.visibilityListeners = new CopyOnWriteArrayList();
|
|
this.period = new Timeline$Period();
|
|
this.window = new Timeline$Window();
|
|
StringBuilder sb = new StringBuilder();
|
|
this.formatBuilder = sb;
|
|
this.formatter = new Formatter(sb, Locale.getDefault());
|
|
this.adGroupTimesMs = new long[0];
|
|
this.playedAdGroups = new boolean[0];
|
|
this.extraAdGroupTimesMs = new long[0];
|
|
this.extraPlayedAdGroups = new boolean[0];
|
|
ComponentListener componentListener = new ComponentListener();
|
|
this.componentListener = componentListener;
|
|
this.controlDispatcher = new DefaultControlDispatcher();
|
|
this.updateProgressAction = new Runnable() { // from class: com.google.android.exoplayer2.ui.PlayerControlView$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
PlayerControlView.this.updateProgress();
|
|
}
|
|
};
|
|
this.hideAction = new Runnable() { // from class: com.google.android.exoplayer2.ui.PlayerControlView$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
PlayerControlView.this.hide();
|
|
}
|
|
};
|
|
LayoutInflater.from(context).inflate(i2, this);
|
|
setDescendantFocusability(262144);
|
|
TimeBar timeBar = (TimeBar) findViewById(R$id.exo_progress);
|
|
View findViewById = findViewById(R$id.exo_progress_placeholder);
|
|
if (timeBar != null) {
|
|
this.timeBar = timeBar;
|
|
} else if (findViewById != null) {
|
|
DefaultTimeBar defaultTimeBar = new DefaultTimeBar(context, null, 0, attributeSet2);
|
|
defaultTimeBar.setId(R$id.exo_progress);
|
|
defaultTimeBar.setLayoutParams(findViewById.getLayoutParams());
|
|
ViewGroup viewGroup = (ViewGroup) findViewById.getParent();
|
|
int indexOfChild = viewGroup.indexOfChild(findViewById);
|
|
viewGroup.removeView(findViewById);
|
|
viewGroup.addView(defaultTimeBar, indexOfChild);
|
|
this.timeBar = defaultTimeBar;
|
|
} else {
|
|
this.timeBar = null;
|
|
}
|
|
this.durationView = (TextView) findViewById(R$id.exo_duration);
|
|
this.positionView = (TextView) findViewById(R$id.exo_position);
|
|
TimeBar timeBar2 = this.timeBar;
|
|
if (timeBar2 != null) {
|
|
timeBar2.addListener(componentListener);
|
|
}
|
|
View findViewById2 = findViewById(R$id.exo_play);
|
|
this.playButton = findViewById2;
|
|
if (findViewById2 != null) {
|
|
findViewById2.setOnClickListener(componentListener);
|
|
}
|
|
View findViewById3 = findViewById(R$id.exo_pause);
|
|
this.pauseButton = findViewById3;
|
|
if (findViewById3 != null) {
|
|
findViewById3.setOnClickListener(componentListener);
|
|
}
|
|
View findViewById4 = findViewById(R$id.exo_prev);
|
|
this.previousButton = findViewById4;
|
|
if (findViewById4 != null) {
|
|
findViewById4.setOnClickListener(componentListener);
|
|
}
|
|
View findViewById5 = findViewById(R$id.exo_next);
|
|
this.nextButton = findViewById5;
|
|
if (findViewById5 != null) {
|
|
findViewById5.setOnClickListener(componentListener);
|
|
}
|
|
View findViewById6 = findViewById(R$id.exo_rew);
|
|
this.rewindButton = findViewById6;
|
|
if (findViewById6 != null) {
|
|
findViewById6.setOnClickListener(componentListener);
|
|
}
|
|
View findViewById7 = findViewById(R$id.exo_ffwd);
|
|
this.fastForwardButton = findViewById7;
|
|
if (findViewById7 != null) {
|
|
findViewById7.setOnClickListener(componentListener);
|
|
}
|
|
ImageView imageView = (ImageView) findViewById(R$id.exo_repeat_toggle);
|
|
this.repeatToggleButton = imageView;
|
|
if (imageView != null) {
|
|
imageView.setOnClickListener(componentListener);
|
|
}
|
|
ImageView imageView2 = (ImageView) findViewById(R$id.exo_shuffle);
|
|
this.shuffleButton = imageView2;
|
|
if (imageView2 != null) {
|
|
imageView2.setOnClickListener(componentListener);
|
|
}
|
|
View findViewById8 = findViewById(R$id.exo_vr);
|
|
this.vrButton = findViewById8;
|
|
setShowVrButton(false);
|
|
updateButton(false, false, findViewById8);
|
|
Resources resources = context.getResources();
|
|
this.buttonAlphaEnabled = resources.getInteger(R$integer.exo_media_button_opacity_percentage_enabled) / 100.0f;
|
|
this.buttonAlphaDisabled = resources.getInteger(R$integer.exo_media_button_opacity_percentage_disabled) / 100.0f;
|
|
this.repeatOffButtonDrawable = resources.getDrawable(R$drawable.exo_controls_repeat_off);
|
|
this.repeatOneButtonDrawable = resources.getDrawable(R$drawable.exo_controls_repeat_one);
|
|
this.repeatAllButtonDrawable = resources.getDrawable(R$drawable.exo_controls_repeat_all);
|
|
this.shuffleOnButtonDrawable = resources.getDrawable(R$drawable.exo_controls_shuffle_on);
|
|
this.shuffleOffButtonDrawable = resources.getDrawable(R$drawable.exo_controls_shuffle_off);
|
|
this.repeatOffButtonContentDescription = resources.getString(R$string.exo_controls_repeat_off_description);
|
|
this.repeatOneButtonContentDescription = resources.getString(R$string.exo_controls_repeat_one_description);
|
|
this.repeatAllButtonContentDescription = resources.getString(R$string.exo_controls_repeat_all_description);
|
|
this.shuffleOnContentDescription = resources.getString(R$string.exo_controls_shuffle_on_description);
|
|
this.shuffleOffContentDescription = resources.getString(R$string.exo_controls_shuffle_off_description);
|
|
}
|
|
|
|
public void setPlayer(@Nullable Player player) {
|
|
Assertions.checkState(Looper.myLooper() == Looper.getMainLooper());
|
|
Assertions.checkArgument(player == null || player.getApplicationLooper() == Looper.getMainLooper());
|
|
if (player == null) {
|
|
return;
|
|
}
|
|
if (player != null) {
|
|
player.addListener(this.componentListener);
|
|
}
|
|
updateAll();
|
|
}
|
|
|
|
public void setShowMultiWindowTimeBar(boolean z) {
|
|
this.showMultiWindowTimeBar = z;
|
|
updateTimeline();
|
|
}
|
|
|
|
public void setExtraAdGroupMarkers(@Nullable long[] jArr, @Nullable boolean[] zArr) {
|
|
if (jArr == null) {
|
|
this.extraAdGroupTimesMs = new long[0];
|
|
this.extraPlayedAdGroups = new boolean[0];
|
|
} else {
|
|
boolean[] zArr2 = (boolean[]) Assertions.checkNotNull(zArr);
|
|
Assertions.checkArgument(jArr.length == zArr2.length);
|
|
this.extraAdGroupTimesMs = jArr;
|
|
this.extraPlayedAdGroups = zArr2;
|
|
}
|
|
updateTimeline();
|
|
}
|
|
|
|
public void addVisibilityListener(VisibilityListener visibilityListener) {
|
|
Assertions.checkNotNull(visibilityListener);
|
|
this.visibilityListeners.add(visibilityListener);
|
|
}
|
|
|
|
public void removeVisibilityListener(VisibilityListener visibilityListener) {
|
|
this.visibilityListeners.remove(visibilityListener);
|
|
}
|
|
|
|
@Deprecated
|
|
public void setControlDispatcher(ControlDispatcher controlDispatcher) {
|
|
if (this.controlDispatcher != controlDispatcher) {
|
|
this.controlDispatcher = controlDispatcher;
|
|
updateNavigation();
|
|
}
|
|
}
|
|
|
|
public void setShowRewindButton(boolean z) {
|
|
this.showRewindButton = z;
|
|
updateNavigation();
|
|
}
|
|
|
|
public void setShowFastForwardButton(boolean z) {
|
|
this.showFastForwardButton = z;
|
|
updateNavigation();
|
|
}
|
|
|
|
public void setShowPreviousButton(boolean z) {
|
|
this.showPreviousButton = z;
|
|
updateNavigation();
|
|
}
|
|
|
|
public void setShowNextButton(boolean z) {
|
|
this.showNextButton = z;
|
|
updateNavigation();
|
|
}
|
|
|
|
public void setShowTimeoutMs(int i) {
|
|
this.showTimeoutMs = i;
|
|
if (isVisible()) {
|
|
hideAfterTimeout();
|
|
}
|
|
}
|
|
|
|
public void setRepeatToggleModes(int i) {
|
|
this.repeatToggleModes = i;
|
|
updateRepeatModeButton();
|
|
}
|
|
|
|
public void setShowShuffleButton(boolean z) {
|
|
this.showShuffleButton = z;
|
|
updateShuffleButton();
|
|
}
|
|
|
|
public boolean getShowVrButton() {
|
|
View view = this.vrButton;
|
|
return view != null && view.getVisibility() == 0;
|
|
}
|
|
|
|
public void setShowVrButton(boolean z) {
|
|
View view = this.vrButton;
|
|
if (view != null) {
|
|
view.setVisibility(z ? 0 : 8);
|
|
}
|
|
}
|
|
|
|
public void setVrButtonListener(@Nullable View.OnClickListener onClickListener) {
|
|
View view = this.vrButton;
|
|
if (view != null) {
|
|
view.setOnClickListener(onClickListener);
|
|
updateButton(getShowVrButton(), onClickListener != null, this.vrButton);
|
|
}
|
|
}
|
|
|
|
public void setTimeBarMinUpdateInterval(int i) {
|
|
this.timeBarMinUpdateIntervalMs = Util.constrainValue(i, 16, 1000);
|
|
}
|
|
|
|
public void show() {
|
|
if (!isVisible()) {
|
|
setVisibility(0);
|
|
Iterator it = this.visibilityListeners.iterator();
|
|
while (it.hasNext()) {
|
|
((VisibilityListener) it.next()).onVisibilityChange(getVisibility());
|
|
}
|
|
updateAll();
|
|
requestPlayPauseFocus();
|
|
requestPlayPauseAccessibilityFocus();
|
|
}
|
|
hideAfterTimeout();
|
|
}
|
|
|
|
public void hide() {
|
|
if (isVisible()) {
|
|
setVisibility(8);
|
|
Iterator it = this.visibilityListeners.iterator();
|
|
while (it.hasNext()) {
|
|
((VisibilityListener) it.next()).onVisibilityChange(getVisibility());
|
|
}
|
|
removeCallbacks(this.updateProgressAction);
|
|
removeCallbacks(this.hideAction);
|
|
this.hideAtMs = C.TIME_UNSET;
|
|
}
|
|
}
|
|
|
|
public boolean isVisible() {
|
|
return getVisibility() == 0;
|
|
}
|
|
|
|
public final void hideAfterTimeout() {
|
|
removeCallbacks(this.hideAction);
|
|
if (this.showTimeoutMs <= 0) {
|
|
this.hideAtMs = C.TIME_UNSET;
|
|
return;
|
|
}
|
|
long uptimeMillis = SystemClock.uptimeMillis();
|
|
int i = this.showTimeoutMs;
|
|
this.hideAtMs = uptimeMillis + i;
|
|
if (this.isAttachedToWindow) {
|
|
postDelayed(this.hideAction, i);
|
|
}
|
|
}
|
|
|
|
public final void updateAll() {
|
|
updatePlayPauseButton();
|
|
updateNavigation();
|
|
updateRepeatModeButton();
|
|
updateShuffleButton();
|
|
updateTimeline();
|
|
}
|
|
|
|
public final void updatePlayPauseButton() {
|
|
boolean z;
|
|
boolean z2;
|
|
if (isVisible() && this.isAttachedToWindow) {
|
|
boolean shouldShowPauseButton = shouldShowPauseButton();
|
|
View view = this.playButton;
|
|
boolean z3 = true;
|
|
if (view != null) {
|
|
z = shouldShowPauseButton && view.isFocused();
|
|
if (Util.SDK_INT < 21) {
|
|
z2 = z;
|
|
} else {
|
|
z2 = shouldShowPauseButton && Api21.isAccessibilityFocused(this.playButton);
|
|
}
|
|
this.playButton.setVisibility(shouldShowPauseButton ? 8 : 0);
|
|
} else {
|
|
z = false;
|
|
z2 = false;
|
|
}
|
|
View view2 = this.pauseButton;
|
|
if (view2 != null) {
|
|
z |= !shouldShowPauseButton && view2.isFocused();
|
|
if (Util.SDK_INT < 21) {
|
|
z3 = z;
|
|
} else if (shouldShowPauseButton || !Api21.isAccessibilityFocused(this.pauseButton)) {
|
|
z3 = false;
|
|
}
|
|
z2 |= z3;
|
|
this.pauseButton.setVisibility(shouldShowPauseButton ? 0 : 8);
|
|
}
|
|
if (z) {
|
|
requestPlayPauseFocus();
|
|
}
|
|
if (z2) {
|
|
requestPlayPauseAccessibilityFocus();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void updateNavigation() {
|
|
if (isVisible() && this.isAttachedToWindow) {
|
|
updateButton(this.showPreviousButton, false, this.previousButton);
|
|
updateButton(this.showRewindButton, false, this.rewindButton);
|
|
updateButton(this.showFastForwardButton, false, this.fastForwardButton);
|
|
updateButton(this.showNextButton, false, this.nextButton);
|
|
TimeBar timeBar = this.timeBar;
|
|
if (timeBar != null) {
|
|
timeBar.setEnabled(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void updateRepeatModeButton() {
|
|
ImageView imageView;
|
|
if (isVisible() && this.isAttachedToWindow && (imageView = this.repeatToggleButton) != null) {
|
|
if (this.repeatToggleModes == 0) {
|
|
updateButton(false, false, imageView);
|
|
return;
|
|
}
|
|
updateButton(true, false, imageView);
|
|
this.repeatToggleButton.setImageDrawable(this.repeatOffButtonDrawable);
|
|
this.repeatToggleButton.setContentDescription(this.repeatOffButtonContentDescription);
|
|
}
|
|
}
|
|
|
|
public final void updateShuffleButton() {
|
|
ImageView imageView;
|
|
if (isVisible() && this.isAttachedToWindow && (imageView = this.shuffleButton) != null) {
|
|
if (!this.showShuffleButton) {
|
|
updateButton(false, false, imageView);
|
|
return;
|
|
}
|
|
updateButton(true, false, imageView);
|
|
this.shuffleButton.setImageDrawable(this.shuffleOffButtonDrawable);
|
|
this.shuffleButton.setContentDescription(this.shuffleOffContentDescription);
|
|
}
|
|
}
|
|
|
|
public final void updateProgress() {
|
|
if (isVisible() && this.isAttachedToWindow) {
|
|
boolean z = 0 != this.currentPosition;
|
|
this.currentPosition = 0L;
|
|
this.currentBufferedPosition = 0L;
|
|
TextView textView = this.positionView;
|
|
if (textView != null && !this.scrubbing && z) {
|
|
textView.setText(Util.getStringForTime(this.formatBuilder, this.formatter, 0L));
|
|
}
|
|
TimeBar timeBar = this.timeBar;
|
|
if (timeBar != null) {
|
|
timeBar.setPosition(0L);
|
|
this.timeBar.setBufferedPosition(0L);
|
|
}
|
|
removeCallbacks(this.updateProgressAction);
|
|
}
|
|
}
|
|
|
|
public final void requestPlayPauseFocus() {
|
|
View view;
|
|
View view2;
|
|
boolean shouldShowPauseButton = shouldShowPauseButton();
|
|
if (!shouldShowPauseButton && (view2 = this.playButton) != null) {
|
|
view2.requestFocus();
|
|
} else {
|
|
if (!shouldShowPauseButton || (view = this.pauseButton) == null) {
|
|
return;
|
|
}
|
|
view.requestFocus();
|
|
}
|
|
}
|
|
|
|
public final void requestPlayPauseAccessibilityFocus() {
|
|
View view;
|
|
View view2;
|
|
boolean shouldShowPauseButton = shouldShowPauseButton();
|
|
if (!shouldShowPauseButton && (view2 = this.playButton) != null) {
|
|
view2.sendAccessibilityEvent(8);
|
|
} else {
|
|
if (!shouldShowPauseButton || (view = this.pauseButton) == null) {
|
|
return;
|
|
}
|
|
view.sendAccessibilityEvent(8);
|
|
}
|
|
}
|
|
|
|
public final void updateButton(boolean z, boolean z2, View view) {
|
|
if (view == null) {
|
|
return;
|
|
}
|
|
view.setEnabled(z2);
|
|
view.setAlpha(z2 ? this.buttonAlphaEnabled : this.buttonAlphaDisabled);
|
|
view.setVisibility(z ? 0 : 8);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
this.isAttachedToWindow = true;
|
|
long j = this.hideAtMs;
|
|
if (j != C.TIME_UNSET) {
|
|
long uptimeMillis = j - SystemClock.uptimeMillis();
|
|
if (uptimeMillis <= 0) {
|
|
hide();
|
|
} else {
|
|
postDelayed(this.hideAction, uptimeMillis);
|
|
}
|
|
} else if (isVisible()) {
|
|
hideAfterTimeout();
|
|
}
|
|
updateAll();
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
this.isAttachedToWindow = false;
|
|
removeCallbacks(this.updateProgressAction);
|
|
removeCallbacks(this.hideAction);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public final boolean dispatchTouchEvent(MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() == 0) {
|
|
removeCallbacks(this.hideAction);
|
|
} else if (motionEvent.getAction() == 1) {
|
|
hideAfterTimeout();
|
|
}
|
|
return super.dispatchTouchEvent(motionEvent);
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
|
|
return dispatchMediaKeyEvent(keyEvent) || super.dispatchKeyEvent(keyEvent);
|
|
}
|
|
|
|
public boolean dispatchMediaKeyEvent(KeyEvent keyEvent) {
|
|
keyEvent.getKeyCode();
|
|
return false;
|
|
}
|
|
|
|
public static int getRepeatToggleModes(TypedArray typedArray, int i) {
|
|
return typedArray.getInt(R$styleable.PlayerControlView_repeat_toggle_modes, i);
|
|
}
|
|
|
|
public final class ComponentListener implements Player.Listener, TimeBar.OnScrubListener, View.OnClickListener {
|
|
public ComponentListener() {
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.ui.TimeBar.OnScrubListener
|
|
public void onScrubStart(TimeBar timeBar, long j) {
|
|
PlayerControlView.this.scrubbing = true;
|
|
if (PlayerControlView.this.positionView != null) {
|
|
PlayerControlView.this.positionView.setText(Util.getStringForTime(PlayerControlView.this.formatBuilder, PlayerControlView.this.formatter, j));
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.ui.TimeBar.OnScrubListener
|
|
public void onScrubMove(TimeBar timeBar, long j) {
|
|
if (PlayerControlView.this.positionView != null) {
|
|
PlayerControlView.this.positionView.setText(Util.getStringForTime(PlayerControlView.this.formatBuilder, PlayerControlView.this.formatter, j));
|
|
}
|
|
}
|
|
|
|
@Override // com.google.android.exoplayer2.ui.TimeBar.OnScrubListener
|
|
public void onScrubStop(TimeBar timeBar, long j, boolean z) {
|
|
PlayerControlView.this.scrubbing = false;
|
|
if (z) {
|
|
return;
|
|
}
|
|
PlayerControlView.access$1100(PlayerControlView.this);
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
PlayerControlView.access$1100(PlayerControlView.this);
|
|
}
|
|
}
|
|
|
|
public static final class Api21 {
|
|
@DoNotInline
|
|
public static boolean isAccessibilityFocused(View view) {
|
|
return view.isAccessibilityFocused();
|
|
}
|
|
}
|
|
}
|