CrackMe.apk
Download file
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 com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.DeviceInfo;
import com.google.android.exoplayer2.ExoPlayerLibraryInfo;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.MediaMetadata;
import com.google.android.exoplayer2.PlaybackException;
import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.text.CueGroup;
import com.google.android.exoplayer2.trackselection.TrackSelectionParameters;
import com.google.android.exoplayer2.ui.TimeBar;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.RepeatModeUtil;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.video.VideoSize;
import java.util.Arrays;
import java.util.Formatter;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
public class PlayerControlView extends FrameLayout {
public static final int DEFAULT_REPEAT_TOGGLE_MODES = 0;
public static final int DEFAULT_SHOW_TIMEOUT_MS = 5000;
public static final int DEFAULT_TIME_BAR_MIN_UPDATE_INTERVAL_MS = 200;
private static final int MAX_UPDATE_INTERVAL_MS = 1000;
public static final int MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR = 100;
private long[] adGroupTimesMs;
private final float buttonAlphaDisabled;
private final float buttonAlphaEnabled;
private final ComponentListener componentListener;
private long currentBufferedPosition;
private long currentPosition;
private long currentWindowOffset;
private final TextView durationView;
private long[] extraAdGroupTimesMs;
private boolean[] extraPlayedAdGroups;
/* access modifiers changed from: private */
public final View fastForwardButton;
/* access modifiers changed from: private */
public final StringBuilder formatBuilder;
/* access modifiers changed from: private */
public final Formatter formatter;
private final Runnable hideAction;
private long hideAtMs;
private boolean isAttachedToWindow;
private boolean multiWindowTimeBar;
/* access modifiers changed from: private */
public final View nextButton;
/* access modifiers changed from: private */
public final View pauseButton;
private final Timeline.Period period;
/* access modifiers changed from: private */
public final View playButton;
private boolean[] playedAdGroups;
/* access modifiers changed from: private */
public Player player;
/* access modifiers changed from: private */
public final TextView positionView;
/* access modifiers changed from: private */
public final View previousButton;
private ProgressUpdateListener progressUpdateListener;
private final String repeatAllButtonContentDescription;
private final Drawable repeatAllButtonDrawable;
private final String repeatOffButtonContentDescription;
private final Drawable repeatOffButtonDrawable;
private final String repeatOneButtonContentDescription;
private final Drawable repeatOneButtonDrawable;
/* access modifiers changed from: private */
public final ImageView repeatToggleButton;
/* access modifiers changed from: private */
public int repeatToggleModes;
/* access modifiers changed from: private */
public final View rewindButton;
/* access modifiers changed from: private */
public boolean scrubbing;
private boolean showFastForwardButton;
private boolean showMultiWindowTimeBar;
private boolean showNextButton;
private boolean showPreviousButton;
private boolean showRewindButton;
private boolean showShuffleButton;
private int showTimeoutMs;
/* access modifiers changed from: private */
public final ImageView shuffleButton;
private final Drawable shuffleOffButtonDrawable;
private final String shuffleOffContentDescription;
private final Drawable shuffleOnButtonDrawable;
private final String shuffleOnContentDescription;
private final TimeBar timeBar;
private int timeBarMinUpdateIntervalMs;
private final Runnable updateProgressAction;
private final CopyOnWriteArrayList<VisibilityListener> visibilityListeners;
private final View vrButton;
private final Timeline.Window window;
public interface ProgressUpdateListener {
void onProgressUpdate(long j, long j2);
}
public interface VisibilityListener {
void onVisibilityChange(int i);
}
private static boolean isHandledMediaKey(int i) {
return i == 90 || i == 89 || i == 85 || i == 79 || i == 126 || i == 127 || i == 87 || i == 88;
}
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.ui");
}
public PlayerControlView(Context context) {
this(context, (AttributeSet) null);
}
public PlayerControlView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public PlayerControlView(Context context, 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 componentListener2 = new ComponentListener();
this.componentListener = componentListener2;
this.updateProgressAction = new PlayerControlView$$ExternalSyntheticLambda1(this);
this.hideAction = new PlayerControlView$$ExternalSyntheticLambda0(this);
LayoutInflater.from(context).inflate(i2, this);
setDescendantFocusability(262144);
TimeBar timeBar2 = (TimeBar) findViewById(R.id.exo_progress);
View findViewById = findViewById(R.id.exo_progress_placeholder);
if (timeBar2 != null) {
this.timeBar = timeBar2;
} else if (findViewById != null) {
DefaultTimeBar defaultTimeBar = new DefaultTimeBar(context, (AttributeSet) 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 timeBar3 = this.timeBar;
if (timeBar3 != null) {
timeBar3.addListener(componentListener2);
}
View findViewById2 = findViewById(R.id.exo_play);
this.playButton = findViewById2;
if (findViewById2 != null) {
findViewById2.setOnClickListener(componentListener2);
}
View findViewById3 = findViewById(R.id.exo_pause);
this.pauseButton = findViewById3;
if (findViewById3 != null) {
findViewById3.setOnClickListener(componentListener2);
}
View findViewById4 = findViewById(R.id.exo_prev);
this.previousButton = findViewById4;
if (findViewById4 != null) {
findViewById4.setOnClickListener(componentListener2);
}
View findViewById5 = findViewById(R.id.exo_next);
this.nextButton = findViewById5;
if (findViewById5 != null) {
findViewById5.setOnClickListener(componentListener2);
}
View findViewById6 = findViewById(R.id.exo_rew);
this.rewindButton = findViewById6;
if (findViewById6 != null) {
findViewById6.setOnClickListener(componentListener2);
}
View findViewById7 = findViewById(R.id.exo_ffwd);
this.fastForwardButton = findViewById7;
if (findViewById7 != null) {
findViewById7.setOnClickListener(componentListener2);
}
ImageView imageView = (ImageView) findViewById(R.id.exo_repeat_toggle);
this.repeatToggleButton = imageView;
if (imageView != null) {
imageView.setOnClickListener(componentListener2);
}
ImageView imageView2 = (ImageView) findViewById(R.id.exo_shuffle);
this.shuffleButton = imageView2;
if (imageView2 != null) {
imageView2.setOnClickListener(componentListener2);
}
View findViewById8 = findViewById(R.id.exo_vr);
this.vrButton = findViewById8;
setShowVrButton(false);
updateButton(false, false, findViewById8);
Resources resources = context.getResources();
this.buttonAlphaEnabled = ((float) resources.getInteger(R.integer.exo_media_button_opacity_percentage_enabled)) / 100.0f;
this.buttonAlphaDisabled = ((float) 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);
this.currentPosition = C.TIME_UNSET;
this.currentBufferedPosition = C.TIME_UNSET;
}
public Player getPlayer() {
return this.player;
}
public void setPlayer(Player player2) {
boolean z = true;
Assertions.checkState(Looper.myLooper() == Looper.getMainLooper());
if (!(player2 == null || player2.getApplicationLooper() == Looper.getMainLooper())) {
z = false;
}
Assertions.checkArgument(z);
Player player3 = this.player;
if (player3 != player2) {
if (player3 != null) {
player3.removeListener(this.componentListener);
}
this.player = player2;
if (player2 != null) {
player2.addListener(this.componentListener);
}
updateAll();
}
}
public void setShowMultiWindowTimeBar(boolean z) {
this.showMultiWindowTimeBar = z;
updateTimeline();
}
public void setExtraAdGroupMarkers(long[] jArr, boolean[] zArr) {
boolean z = false;
if (jArr == null) {
this.extraAdGroupTimesMs = new long[0];
this.extraPlayedAdGroups = new boolean[0];
} else {
boolean[] zArr2 = (boolean[]) Assertions.checkNotNull(zArr);
if (jArr.length == zArr2.length) {
z = true;
}
Assertions.checkArgument(z);
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);
}
public void setProgressUpdateListener(ProgressUpdateListener progressUpdateListener2) {
this.progressUpdateListener = progressUpdateListener2;
}
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 int getShowTimeoutMs() {
return this.showTimeoutMs;
}
public void setShowTimeoutMs(int i) {
this.showTimeoutMs = i;
if (isVisible()) {
hideAfterTimeout();
}
}
public int getRepeatToggleModes() {
return this.repeatToggleModes;
}
public void setRepeatToggleModes(int i) {
this.repeatToggleModes = i;
Player player2 = this.player;
if (player2 != null) {
int repeatMode = player2.getRepeatMode();
if (i == 0 && repeatMode != 0) {
this.player.setRepeatMode(0);
} else if (i == 1 && repeatMode == 2) {
this.player.setRepeatMode(1);
} else if (i == 2 && repeatMode == 1) {
this.player.setRepeatMode(2);
}
}
updateRepeatModeButton();
}
public boolean getShowShuffleButton() {
return this.showShuffleButton;
}
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(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<VisibilityListener> it = this.visibilityListeners.iterator();
while (it.hasNext()) {
it.next().onVisibilityChange(getVisibility());
}
updateAll();
requestPlayPauseFocus();
requestPlayPauseAccessibilityFocus();
}
hideAfterTimeout();
}
public void hide() {
if (isVisible()) {
setVisibility(8);
Iterator<VisibilityListener> it = this.visibilityListeners.iterator();
while (it.hasNext()) {
it.next().onVisibilityChange(getVisibility());
}
removeCallbacks(this.updateProgressAction);
removeCallbacks(this.hideAction);
this.hideAtMs = C.TIME_UNSET;
}
}
public boolean isVisible() {
return getVisibility() == 0;
}
private void hideAfterTimeout() {
removeCallbacks(this.hideAction);
if (this.showTimeoutMs > 0) {
long uptimeMillis = SystemClock.uptimeMillis();
int i = this.showTimeoutMs;
this.hideAtMs = uptimeMillis + ((long) i);
if (this.isAttachedToWindow) {
postDelayed(this.hideAction, (long) i);
return;
}
return;
}
this.hideAtMs = C.TIME_UNSET;
}
private void updateAll() {
updatePlayPauseButton();
updateNavigation();
updateRepeatModeButton();
updateShuffleButton();
updateTimeline();
}
/* access modifiers changed from: private */
public void updatePlayPauseButton() {
boolean z;
boolean z2;
boolean z3;
if (isVisible() && this.isAttachedToWindow) {
boolean shouldShowPauseButton = shouldShowPauseButton();
View view = this.playButton;
int i = 8;
boolean z4 = true;
if (view != null) {
z2 = (shouldShowPauseButton && view.isFocused()) | false;
if (Util.SDK_INT < 21) {
z3 = z2;
} else {
z3 = shouldShowPauseButton && Api21.isAccessibilityFocused(this.playButton);
}
z = z3 | false;
this.playButton.setVisibility(shouldShowPauseButton ? 8 : 0);
} else {
z2 = false;
z = false;
}
View view2 = this.pauseButton;
if (view2 != null) {
z2 |= !shouldShowPauseButton && view2.isFocused();
if (Util.SDK_INT < 21) {
z4 = z2;
} else if (shouldShowPauseButton || !Api21.isAccessibilityFocused(this.pauseButton)) {
z4 = false;
}
z |= z4;
View view3 = this.pauseButton;
if (shouldShowPauseButton) {
i = 0;
}
view3.setVisibility(i);
}
if (z2) {
requestPlayPauseFocus();
}
if (z) {
requestPlayPauseAccessibilityFocus();
}
}
}
/* access modifiers changed from: private */
public void updateNavigation() {
boolean z;
boolean z2;
boolean z3;
boolean z4;
if (isVisible() && this.isAttachedToWindow) {
Player player2 = this.player;
boolean z5 = false;
if (player2 != null) {
boolean isCommandAvailable = player2.isCommandAvailable(5);
boolean isCommandAvailable2 = player2.isCommandAvailable(7);
z2 = player2.isCommandAvailable(11);
z = player2.isCommandAvailable(12);
z4 = player2.isCommandAvailable(9);
boolean z6 = isCommandAvailable2;
z3 = isCommandAvailable;
z5 = z6;
} else {
z4 = false;
z3 = false;
z2 = false;
z = false;
}
updateButton(this.showPreviousButton, z5, this.previousButton);
updateButton(this.showRewindButton, z2, this.rewindButton);
updateButton(this.showFastForwardButton, z, this.fastForwardButton);
updateButton(this.showNextButton, z4, this.nextButton);
TimeBar timeBar2 = this.timeBar;
if (timeBar2 != null) {
timeBar2.setEnabled(z3);
}
}
}
/* access modifiers changed from: private */
public void updateRepeatModeButton() {
ImageView imageView;
if (isVisible() && this.isAttachedToWindow && (imageView = this.repeatToggleButton) != null) {
if (this.repeatToggleModes == 0) {
updateButton(false, false, imageView);
return;
}
Player player2 = this.player;
if (player2 == null) {
updateButton(true, false, imageView);
this.repeatToggleButton.setImageDrawable(this.repeatOffButtonDrawable);
this.repeatToggleButton.setContentDescription(this.repeatOffButtonContentDescription);
return;
}
updateButton(true, true, imageView);
int repeatMode = player2.getRepeatMode();
if (repeatMode == 0) {
this.repeatToggleButton.setImageDrawable(this.repeatOffButtonDrawable);
this.repeatToggleButton.setContentDescription(this.repeatOffButtonContentDescription);
} else if (repeatMode == 1) {
this.repeatToggleButton.setImageDrawable(this.repeatOneButtonDrawable);
this.repeatToggleButton.setContentDescription(this.repeatOneButtonContentDescription);
} else if (repeatMode == 2) {
this.repeatToggleButton.setImageDrawable(this.repeatAllButtonDrawable);
this.repeatToggleButton.setContentDescription(this.repeatAllButtonContentDescription);
}
this.repeatToggleButton.setVisibility(0);
}
}
/* access modifiers changed from: private */
public void updateShuffleButton() {
ImageView imageView;
String str;
if (isVisible() && this.isAttachedToWindow && (imageView = this.shuffleButton) != null) {
Player player2 = this.player;
if (!this.showShuffleButton) {
updateButton(false, false, imageView);
} else if (player2 == null) {
updateButton(true, false, imageView);
this.shuffleButton.setImageDrawable(this.shuffleOffButtonDrawable);
this.shuffleButton.setContentDescription(this.shuffleOffContentDescription);
} else {
updateButton(true, true, imageView);
this.shuffleButton.setImageDrawable(player2.getShuffleModeEnabled() ? this.shuffleOnButtonDrawable : this.shuffleOffButtonDrawable);
ImageView imageView2 = this.shuffleButton;
if (player2.getShuffleModeEnabled()) {
str = this.shuffleOnContentDescription;
} else {
str = this.shuffleOffContentDescription;
}
imageView2.setContentDescription(str);
}
}
}
/* access modifiers changed from: private */
public void updateTimeline() {
int i;
long j;
Player player2 = this.player;
if (player2 != null) {
boolean z = true;
this.multiWindowTimeBar = this.showMultiWindowTimeBar && canShowMultiWindowTimeBar(player2.getCurrentTimeline(), this.window);
this.currentWindowOffset = 0;
Timeline currentTimeline = player2.getCurrentTimeline();
if (!currentTimeline.isEmpty()) {
int currentMediaItemIndex = player2.getCurrentMediaItemIndex();
boolean z2 = this.multiWindowTimeBar;
int i2 = z2 ? 0 : currentMediaItemIndex;
int windowCount = z2 ? currentTimeline.getWindowCount() - 1 : currentMediaItemIndex;
long j2 = 0;
i = 0;
while (true) {
if (i2 > windowCount) {
break;
}
if (i2 == currentMediaItemIndex) {
this.currentWindowOffset = Util.usToMs(j2);
}
currentTimeline.getWindow(i2, this.window);
if (this.window.durationUs == C.TIME_UNSET) {
Assertions.checkState(this.multiWindowTimeBar ^ z);
break;
}
for (int i3 = this.window.firstPeriodIndex; i3 <= this.window.lastPeriodIndex; i3++) {
currentTimeline.getPeriod(i3, this.period);
int adGroupCount = this.period.getAdGroupCount();
for (int removedAdGroupCount = this.period.getRemovedAdGroupCount(); removedAdGroupCount < adGroupCount; removedAdGroupCount++) {
long adGroupTimeUs = this.period.getAdGroupTimeUs(removedAdGroupCount);
if (adGroupTimeUs == Long.MIN_VALUE) {
if (this.period.durationUs == C.TIME_UNSET) {
} else {
adGroupTimeUs = this.period.durationUs;
}
}
long positionInWindowUs = adGroupTimeUs + this.period.getPositionInWindowUs();
if (positionInWindowUs >= 0) {
long[] jArr = this.adGroupTimesMs;
if (i == jArr.length) {
int length = jArr.length == 0 ? 1 : jArr.length * 2;
this.adGroupTimesMs = Arrays.copyOf(jArr, length);
this.playedAdGroups = Arrays.copyOf(this.playedAdGroups, length);
}
this.adGroupTimesMs[i] = Util.usToMs(j2 + positionInWindowUs);
this.playedAdGroups[i] = this.period.hasPlayedAdGroup(removedAdGroupCount);
i++;
}
}
}
j2 += this.window.durationUs;
i2++;
z = true;
}
j = j2;
} else {
j = 0;
i = 0;
}
long usToMs = Util.usToMs(j);
TextView textView = this.durationView;
if (textView != null) {
textView.setText(Util.getStringForTime(this.formatBuilder, this.formatter, usToMs));
}
TimeBar timeBar2 = this.timeBar;
if (timeBar2 != null) {
timeBar2.setDuration(usToMs);
int length2 = this.extraAdGroupTimesMs.length;
int i4 = i + length2;
long[] jArr2 = this.adGroupTimesMs;
if (i4 > jArr2.length) {
this.adGroupTimesMs = Arrays.copyOf(jArr2, i4);
this.playedAdGroups = Arrays.copyOf(this.playedAdGroups, i4);
}
System.arraycopy(this.extraAdGroupTimesMs, 0, this.adGroupTimesMs, i, length2);
System.arraycopy(this.extraPlayedAdGroups, 0, this.playedAdGroups, i, length2);
this.timeBar.setAdGroupTimesMs(this.adGroupTimesMs, this.playedAdGroups, i4);
}
updateProgress();
}
}
/* access modifiers changed from: private */
public void updateProgress() {
long j;
int i;
if (isVisible() && this.isAttachedToWindow) {
Player player2 = this.player;
long j2 = 0;
if (player2 != null) {
j2 = this.currentWindowOffset + player2.getContentPosition();
j = this.currentWindowOffset + player2.getContentBufferedPosition();
} else {
j = 0;
}
boolean z = false;
boolean z2 = j2 != this.currentPosition;
if (j != this.currentBufferedPosition) {
z = true;
}
this.currentPosition = j2;
this.currentBufferedPosition = j;
TextView textView = this.positionView;
if (textView != null && !this.scrubbing && z2) {
textView.setText(Util.getStringForTime(this.formatBuilder, this.formatter, j2));
}
TimeBar timeBar2 = this.timeBar;
if (timeBar2 != null) {
timeBar2.setPosition(j2);
this.timeBar.setBufferedPosition(j);
}
ProgressUpdateListener progressUpdateListener2 = this.progressUpdateListener;
if (progressUpdateListener2 != null && (z2 || z)) {
progressUpdateListener2.onProgressUpdate(j2, j);
}
removeCallbacks(this.updateProgressAction);
if (player2 == null) {
i = 1;
} else {
i = player2.getPlaybackState();
}
long j3 = 1000;
if (player2 != null && player2.isPlaying()) {
TimeBar timeBar3 = this.timeBar;
long min = Math.min(timeBar3 != null ? timeBar3.getPreferredUpdateDelay() : 1000, 1000 - (j2 % 1000));
float f = player2.getPlaybackParameters().speed;
if (f > 0.0f) {
j3 = (long) (((float) min) / f);
}
postDelayed(this.updateProgressAction, Util.constrainValue(j3, (long) this.timeBarMinUpdateIntervalMs, 1000));
} else if (i != 4 && i != 1) {
postDelayed(this.updateProgressAction, 1000);
}
}
}
private void requestPlayPauseFocus() {
View view;
View view2;
boolean shouldShowPauseButton = shouldShowPauseButton();
if (!shouldShowPauseButton && (view2 = this.playButton) != null) {
view2.requestFocus();
} else if (shouldShowPauseButton && (view = this.pauseButton) != null) {
view.requestFocus();
}
}
private 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) {
view.sendAccessibilityEvent(8);
}
}
private void updateButton(boolean z, boolean z2, View view) {
if (view != null) {
view.setEnabled(z2);
view.setAlpha(z2 ? this.buttonAlphaEnabled : this.buttonAlphaDisabled);
view.setVisibility(z ? 0 : 8);
}
}
/* access modifiers changed from: private */
public void seekToTimeBarPosition(Player player2, long j) {
int i;
Timeline currentTimeline = player2.getCurrentTimeline();
if (this.multiWindowTimeBar && !currentTimeline.isEmpty()) {
int windowCount = currentTimeline.getWindowCount();
i = 0;
while (true) {
long durationMs = currentTimeline.getWindow(i, this.window).getDurationMs();
if (j < durationMs) {
break;
} else if (i == windowCount - 1) {
j = durationMs;
break;
} else {
j -= durationMs;
i++;
}
}
} else {
i = player2.getCurrentMediaItemIndex();
}
seekTo(player2, i, j);
updateProgress();
}
private void seekTo(Player player2, int i, long j) {
player2.seekTo(i, j);
}
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();
}
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.isAttachedToWindow = false;
removeCallbacks(this.updateProgressAction);
removeCallbacks(this.hideAction);
}
public final boolean dispatchTouchEvent(MotionEvent motionEvent) {
if (motionEvent.getAction() == 0) {
removeCallbacks(this.hideAction);
} else if (motionEvent.getAction() == 1) {
hideAfterTimeout();
}
return super.dispatchTouchEvent(motionEvent);
}
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
return dispatchMediaKeyEvent(keyEvent) || super.dispatchKeyEvent(keyEvent);
}
public boolean dispatchMediaKeyEvent(KeyEvent keyEvent) {
int keyCode = keyEvent.getKeyCode();
Player player2 = this.player;
if (player2 == null || !isHandledMediaKey(keyCode)) {
return false;
}
if (keyEvent.getAction() != 0) {
return true;
}
if (keyCode == 90) {
if (player2.getPlaybackState() == 4) {
return true;
}
player2.seekForward();
return true;
} else if (keyCode == 89) {
player2.seekBack();
return true;
} else if (keyEvent.getRepeatCount() != 0) {
return true;
} else {
if (keyCode == 79 || keyCode == 85) {
dispatchPlayPause(player2);
return true;
} else if (keyCode == 87) {
player2.seekToNext();
return true;
} else if (keyCode == 88) {
player2.seekToPrevious();
return true;
} else if (keyCode == 126) {
dispatchPlay(player2);
return true;
} else if (keyCode != 127) {
return true;
} else {
dispatchPause(player2);
return true;
}
}
}
private boolean shouldShowPauseButton() {
Player player2 = this.player;
if (player2 == null || player2.getPlaybackState() == 4 || this.player.getPlaybackState() == 1 || !this.player.getPlayWhenReady()) {
return false;
}
return true;
}
private void dispatchPlayPause(Player player2) {
int playbackState = player2.getPlaybackState();
if (playbackState == 1 || playbackState == 4 || !player2.getPlayWhenReady()) {
dispatchPlay(player2);
} else {
dispatchPause(player2);
}
}
/* access modifiers changed from: private */
public void dispatchPlay(Player player2) {
int playbackState = player2.getPlaybackState();
if (playbackState == 1) {
player2.prepare();
} else if (playbackState == 4) {
seekTo(player2, player2.getCurrentMediaItemIndex(), C.TIME_UNSET);
}
player2.play();
}
/* access modifiers changed from: private */
public void dispatchPause(Player player2) {
player2.pause();
}
private static boolean canShowMultiWindowTimeBar(Timeline timeline, Timeline.Window window2) {
if (timeline.getWindowCount() > 100) {
return false;
}
int windowCount = timeline.getWindowCount();
for (int i = 0; i < windowCount; i++) {
if (timeline.getWindow(i, window2).durationUs == C.TIME_UNSET) {
return false;
}
}
return true;
}
private static int getRepeatToggleModes(TypedArray typedArray, int i) {
return typedArray.getInt(R.styleable.PlayerControlView_repeat_toggle_modes, i);
}
private final class ComponentListener implements Player.Listener, TimeBar.OnScrubListener, View.OnClickListener {
public /* synthetic */ void onAudioAttributesChanged(AudioAttributes audioAttributes) {
Player.Listener.CC.$default$onAudioAttributesChanged(this, audioAttributes);
}
public /* synthetic */ void onAudioSessionIdChanged(int i) {
Player.Listener.CC.$default$onAudioSessionIdChanged(this, i);
}
public /* synthetic */ void onAvailableCommandsChanged(Player.Commands commands) {
Player.Listener.CC.$default$onAvailableCommandsChanged(this, commands);
}
public /* synthetic */ void onCues(CueGroup cueGroup) {
Player.Listener.CC.$default$onCues((Player.Listener) this, cueGroup);
}
public /* synthetic */ void onCues(List list) {
Player.Listener.CC.$default$onCues((Player.Listener) this, list);
}
public /* synthetic */ void onDeviceInfoChanged(DeviceInfo deviceInfo) {
Player.Listener.CC.$default$onDeviceInfoChanged(this, deviceInfo);
}
public /* synthetic */ void onDeviceVolumeChanged(int i, boolean z) {
Player.Listener.CC.$default$onDeviceVolumeChanged(this, i, z);
}
public /* synthetic */ void onIsLoadingChanged(boolean z) {
Player.Listener.CC.$default$onIsLoadingChanged(this, z);
}
public /* synthetic */ void onIsPlayingChanged(boolean z) {
Player.Listener.CC.$default$onIsPlayingChanged(this, z);
}
public /* synthetic */ void onLoadingChanged(boolean z) {
Player.Listener.CC.$default$onLoadingChanged(this, z);
}
public /* synthetic */ void onMaxSeekToPreviousPositionChanged(long j) {
Player.Listener.CC.$default$onMaxSeekToPreviousPositionChanged(this, j);
}
public /* synthetic */ void onMediaItemTransition(MediaItem mediaItem, int i) {
Player.Listener.CC.$default$onMediaItemTransition(this, mediaItem, i);
}
public /* synthetic */ void onMediaMetadataChanged(MediaMetadata mediaMetadata) {
Player.Listener.CC.$default$onMediaMetadataChanged(this, mediaMetadata);
}
public /* synthetic */ void onMetadata(Metadata metadata) {
Player.Listener.CC.$default$onMetadata(this, metadata);
}
public /* synthetic */ void onPlayWhenReadyChanged(boolean z, int i) {
Player.Listener.CC.$default$onPlayWhenReadyChanged(this, z, i);
}
public /* synthetic */ void onPlaybackParametersChanged(PlaybackParameters playbackParameters) {
Player.Listener.CC.$default$onPlaybackParametersChanged(this, playbackParameters);
}
public /* synthetic */ void onPlaybackStateChanged(int i) {
Player.Listener.CC.$default$onPlaybackStateChanged(this, i);
}
public /* synthetic */ void onPlaybackSuppressionReasonChanged(int i) {
Player.Listener.CC.$default$onPlaybackSuppressionReasonChanged(this, i);
}
public /* synthetic */ void onPlayerError(PlaybackException playbackException) {
Player.Listener.CC.$default$onPlayerError(this, playbackException);
}
public /* synthetic */ void onPlayerErrorChanged(PlaybackException playbackException) {
Player.Listener.CC.$default$onPlayerErrorChanged(this, playbackException);
}
public /* synthetic */ void onPlayerStateChanged(boolean z, int i) {
Player.Listener.CC.$default$onPlayerStateChanged(this, z, i);
}
public /* synthetic */ void onPlaylistMetadataChanged(MediaMetadata mediaMetadata) {
Player.Listener.CC.$default$onPlaylistMetadataChanged(this, mediaMetadata);
}
public /* synthetic */ void onPositionDiscontinuity(int i) {
Player.Listener.CC.$default$onPositionDiscontinuity(this, i);
}
public /* synthetic */ void onPositionDiscontinuity(Player.PositionInfo positionInfo, Player.PositionInfo positionInfo2, int i) {
Player.Listener.CC.$default$onPositionDiscontinuity(this, positionInfo, positionInfo2, i);
}
public /* synthetic */ void onRenderedFirstFrame() {
Player.Listener.CC.$default$onRenderedFirstFrame(this);
}
public /* synthetic */ void onRepeatModeChanged(int i) {
Player.Listener.CC.$default$onRepeatModeChanged(this, i);
}
public /* synthetic */ void onSeekBackIncrementChanged(long j) {
Player.Listener.CC.$default$onSeekBackIncrementChanged(this, j);
}
public /* synthetic */ void onSeekForwardIncrementChanged(long j) {
Player.Listener.CC.$default$onSeekForwardIncrementChanged(this, j);
}
public /* synthetic */ void onSeekProcessed() {
Player.Listener.CC.$default$onSeekProcessed(this);
}
public /* synthetic */ void onShuffleModeEnabledChanged(boolean z) {
Player.Listener.CC.$default$onShuffleModeEnabledChanged(this, z);
}
public /* synthetic */ void onSkipSilenceEnabledChanged(boolean z) {
Player.Listener.CC.$default$onSkipSilenceEnabledChanged(this, z);
}
public /* synthetic */ void onSurfaceSizeChanged(int i, int i2) {
Player.Listener.CC.$default$onSurfaceSizeChanged(this, i, i2);
}
public /* synthetic */ void onTimelineChanged(Timeline timeline, int i) {
Player.Listener.CC.$default$onTimelineChanged(this, timeline, i);
}
public /* synthetic */ void onTrackSelectionParametersChanged(TrackSelectionParameters trackSelectionParameters) {
Player.Listener.CC.$default$onTrackSelectionParametersChanged(this, trackSelectionParameters);
}
public /* synthetic */ void onTracksChanged(Tracks tracks) {
Player.Listener.CC.$default$onTracksChanged(this, tracks);
}
public /* synthetic */ void onVideoSizeChanged(VideoSize videoSize) {
Player.Listener.CC.$default$onVideoSizeChanged(this, videoSize);
}
public /* synthetic */ void onVolumeChanged(float f) {
Player.Listener.CC.$default$onVolumeChanged(this, f);
}
private ComponentListener() {
}
public void onEvents(Player player, Player.Events events) {
if (events.containsAny(4, 5)) {
PlayerControlView.this.updatePlayPauseButton();
}
if (events.containsAny(4, 5, 7)) {
PlayerControlView.this.updateProgress();
}
if (events.contains(8)) {
PlayerControlView.this.updateRepeatModeButton();
}
if (events.contains(9)) {
PlayerControlView.this.updateShuffleButton();
}
if (events.containsAny(8, 9, 11, 0, 13)) {
PlayerControlView.this.updateNavigation();
}
if (events.containsAny(11, 0)) {
PlayerControlView.this.updateTimeline();
}
}
public void onScrubStart(TimeBar timeBar, long j) {
boolean unused = PlayerControlView.this.scrubbing = true;
if (PlayerControlView.this.positionView != null) {
PlayerControlView.this.positionView.setText(Util.getStringForTime(PlayerControlView.this.formatBuilder, PlayerControlView.this.formatter, j));
}
}
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));
}
}
public void onScrubStop(TimeBar timeBar, long j, boolean z) {
boolean unused = PlayerControlView.this.scrubbing = false;
if (!z && PlayerControlView.this.player != null) {
PlayerControlView playerControlView = PlayerControlView.this;
playerControlView.seekToTimeBarPosition(playerControlView.player, j);
}
}
public void onClick(View view) {
Player access$1100 = PlayerControlView.this.player;
if (access$1100 != null) {
if (PlayerControlView.this.nextButton == view) {
access$1100.seekToNext();
} else if (PlayerControlView.this.previousButton == view) {
access$1100.seekToPrevious();
} else if (PlayerControlView.this.fastForwardButton == view) {
if (access$1100.getPlaybackState() != 4) {
access$1100.seekForward();
}
} else if (PlayerControlView.this.rewindButton == view) {
access$1100.seekBack();
} else if (PlayerControlView.this.playButton == view) {
PlayerControlView.this.dispatchPlay(access$1100);
} else if (PlayerControlView.this.pauseButton == view) {
PlayerControlView.this.dispatchPause(access$1100);
} else if (PlayerControlView.this.repeatToggleButton == view) {
access$1100.setRepeatMode(RepeatModeUtil.getNextRepeatMode(access$1100.getRepeatMode(), PlayerControlView.this.repeatToggleModes));
} else if (PlayerControlView.this.shuffleButton == view) {
access$1100.setShuffleModeEnabled(!access$1100.getShuffleModeEnabled());
}
}
}
}
private static final class Api21 {
private Api21() {
}
public static boolean isAccessibilityFocused(View view) {
return view.isAccessibilityFocused();
}
}
}
Download file