Files
rr3-apk/decompiled/sources/com/google/android/exoplayer2/ui/StyledPlayerControlView.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

1003 lines
43 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.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Looper;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
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.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.ui.StyledPlayerControlView;
import com.google.android.exoplayer2.ui.TimeBar;
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.Util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Formatter;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
/* loaded from: classes2.dex */
public class StyledPlayerControlView extends FrameLayout {
public long[] adGroupTimesMs;
public View audioTrackButton;
public TrackSelectionAdapter audioTrackSelectionAdapter;
public final float buttonAlphaDisabled;
public final float buttonAlphaEnabled;
public final ComponentListener componentListener;
public ControlDispatcher controlDispatcher;
public StyledPlayerControlViewLayoutManager controlViewLayoutManager;
public final TextView durationView;
public long[] extraAdGroupTimesMs;
public boolean[] extraPlayedAdGroups;
public final View fastForwardButton;
public final TextView fastForwardButtonTextView;
public final StringBuilder formatBuilder;
public final Formatter formatter;
public ImageView fullScreenButton;
public final String fullScreenEnterContentDescription;
public final Drawable fullScreenEnterDrawable;
public final String fullScreenExitContentDescription;
public final Drawable fullScreenExitDrawable;
public boolean isAttachedToWindow;
public ImageView minimalFullScreenButton;
public boolean needToHideBars;
public final View nextButton;
public final Timeline$Period period;
public final View playPauseButton;
public PlaybackSpeedAdapter playbackSpeedAdapter;
public View playbackSpeedButton;
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 Resources resources;
public final View rewindButton;
public final TextView rewindButtonTextView;
public boolean scrubbing;
public SettingsAdapter settingsAdapter;
public View settingsButton;
public RecyclerView settingsView;
public PopupWindow settingsWindow;
public int settingsWindowMargin;
public boolean showMultiWindowTimeBar;
public int showTimeoutMs;
public final ImageView shuffleButton;
public final Drawable shuffleOffButtonDrawable;
public final String shuffleOffContentDescription;
public final Drawable shuffleOnButtonDrawable;
public final String shuffleOnContentDescription;
public ImageView subtitleButton;
public final Drawable subtitleOffButtonDrawable;
public final String subtitleOffContentDescription;
public final Drawable subtitleOnButtonDrawable;
public final String subtitleOnContentDescription;
public TrackSelectionAdapter textTrackSelectionAdapter;
public final TimeBar timeBar;
public int timeBarMinUpdateIntervalMs;
public TrackNameProvider trackNameProvider;
public final Runnable updateProgressAction;
public final CopyOnWriteArrayList visibilityListeners;
public final View vrButton;
public final Timeline$Window window;
public interface OnFullScreenModeChangedListener {
}
public interface ProgressUpdateListener {
}
public static final class TrackInfo {
public final boolean selected;
}
public interface VisibilityListener {
void onVisibilityChange(int i);
}
public int getShowTimeoutMs() {
return this.showTimeoutMs;
}
public final void onFullScreenButtonClicked(View view) {
}
public final void setPlaybackSpeed(float f) {
}
public void setProgressUpdateListener(@Nullable ProgressUpdateListener progressUpdateListener) {
}
public final boolean shouldShowPauseButton() {
return false;
}
public final void updatePlaybackSpeedList() {
}
public final void updateTimeline() {
}
public static /* synthetic */ Player access$1600(StyledPlayerControlView styledPlayerControlView) {
styledPlayerControlView.getClass();
return null;
}
public static /* synthetic */ DefaultTrackSelector access$4800(StyledPlayerControlView styledPlayerControlView) {
styledPlayerControlView.getClass();
return null;
}
static {
ExoPlayerLibraryInfo.registerModule("goog.exo.ui");
}
public StyledPlayerControlView(Context context) {
this(context, null);
}
public StyledPlayerControlView(Context context, @Nullable AttributeSet attributeSet) {
this(context, attributeSet, 0);
}
public StyledPlayerControlView(Context context, @Nullable AttributeSet attributeSet, int i) {
this(context, attributeSet, i, attributeSet);
}
public StyledPlayerControlView(Context context, AttributeSet attributeSet, int i, AttributeSet attributeSet2) {
super(context, attributeSet, i);
boolean z;
boolean z2;
boolean z3;
boolean z4;
boolean z5;
boolean z6;
boolean z7;
boolean z8;
ComponentListener componentListener;
boolean z9;
boolean z10;
TextView textView;
boolean z11;
ImageView imageView;
boolean z12;
int i2 = R$layout.exo_styled_player_control_view;
this.showTimeoutMs = 5000;
this.repeatToggleModes = 0;
this.timeBarMinUpdateIntervalMs = 200;
if (attributeSet2 != null) {
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet2, R$styleable.StyledPlayerControlView, i, 0);
try {
i2 = obtainStyledAttributes.getResourceId(R$styleable.StyledPlayerControlView_controller_layout_id, i2);
this.showTimeoutMs = obtainStyledAttributes.getInt(R$styleable.StyledPlayerControlView_show_timeout, this.showTimeoutMs);
this.repeatToggleModes = getRepeatToggleModes(obtainStyledAttributes, this.repeatToggleModes);
boolean z13 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_rewind_button, true);
boolean z14 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_fastforward_button, true);
boolean z15 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_previous_button, true);
boolean z16 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_next_button, true);
boolean z17 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_shuffle_button, false);
boolean z18 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_subtitle_button, false);
boolean z19 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_show_vr_button, false);
setTimeBarMinUpdateInterval(obtainStyledAttributes.getInt(R$styleable.StyledPlayerControlView_time_bar_min_update_interval, this.timeBarMinUpdateIntervalMs));
boolean z20 = obtainStyledAttributes.getBoolean(R$styleable.StyledPlayerControlView_animation_enabled, true);
obtainStyledAttributes.recycle();
z2 = z17;
z3 = z18;
z5 = z13;
z6 = z14;
z7 = z15;
z4 = z20;
z8 = z16;
z = z19;
} catch (Throwable th) {
obtainStyledAttributes.recycle();
throw th;
}
} else {
z = false;
z2 = false;
z3 = false;
z4 = true;
z5 = true;
z6 = true;
z7 = true;
z8 = true;
}
LayoutInflater.from(context).inflate(i2, this);
setDescendantFocusability(262144);
ComponentListener componentListener2 = new ComponentListener();
this.componentListener = componentListener2;
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];
this.controlDispatcher = new DefaultControlDispatcher();
this.updateProgressAction = new Runnable() { // from class: com.google.android.exoplayer2.ui.StyledPlayerControlView$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
StyledPlayerControlView.this.updateProgress();
}
};
this.durationView = (TextView) findViewById(R$id.exo_duration);
this.positionView = (TextView) findViewById(R$id.exo_position);
ImageView imageView2 = (ImageView) findViewById(R$id.exo_subtitle);
this.subtitleButton = imageView2;
if (imageView2 != null) {
imageView2.setOnClickListener(componentListener2);
}
ImageView imageView3 = (ImageView) findViewById(R$id.exo_fullscreen);
this.fullScreenButton = imageView3;
initializeFullScreenButton(imageView3, new View.OnClickListener() { // from class: com.google.android.exoplayer2.ui.StyledPlayerControlView$$ExternalSyntheticLambda1
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
StyledPlayerControlView.this.onFullScreenButtonClicked(view);
}
});
ImageView imageView4 = (ImageView) findViewById(R$id.exo_minimal_fullscreen);
this.minimalFullScreenButton = imageView4;
initializeFullScreenButton(imageView4, new View.OnClickListener() { // from class: com.google.android.exoplayer2.ui.StyledPlayerControlView$$ExternalSyntheticLambda1
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
StyledPlayerControlView.this.onFullScreenButtonClicked(view);
}
});
View findViewById = findViewById(R$id.exo_settings);
this.settingsButton = findViewById;
if (findViewById != null) {
findViewById.setOnClickListener(componentListener2);
}
View findViewById2 = findViewById(R$id.exo_playback_speed);
this.playbackSpeedButton = findViewById2;
if (findViewById2 != null) {
findViewById2.setOnClickListener(componentListener2);
}
View findViewById3 = findViewById(R$id.exo_audio_track);
this.audioTrackButton = findViewById3;
if (findViewById3 != null) {
findViewById3.setOnClickListener(componentListener2);
}
TimeBar timeBar = (TimeBar) findViewById(R$id.exo_progress);
View findViewById4 = findViewById(R$id.exo_progress_placeholder);
if (timeBar != null) {
this.timeBar = timeBar;
componentListener = componentListener2;
z9 = z4;
z10 = z;
textView = null;
} else if (findViewById4 != null) {
textView = null;
componentListener = componentListener2;
z9 = z4;
z10 = z;
DefaultTimeBar defaultTimeBar = new DefaultTimeBar(context, null, 0, attributeSet2, R$style.ExoStyledControls_TimeBar);
defaultTimeBar.setId(R$id.exo_progress);
defaultTimeBar.setLayoutParams(findViewById4.getLayoutParams());
ViewGroup viewGroup = (ViewGroup) findViewById4.getParent();
int indexOfChild = viewGroup.indexOfChild(findViewById4);
viewGroup.removeView(findViewById4);
viewGroup.addView(defaultTimeBar, indexOfChild);
this.timeBar = defaultTimeBar;
} else {
componentListener = componentListener2;
z9 = z4;
z10 = z;
textView = null;
this.timeBar = null;
}
TimeBar timeBar2 = this.timeBar;
ComponentListener componentListener3 = componentListener;
if (timeBar2 != null) {
timeBar2.addListener(componentListener3);
}
View findViewById5 = findViewById(R$id.exo_play_pause);
this.playPauseButton = findViewById5;
if (findViewById5 != null) {
findViewById5.setOnClickListener(componentListener3);
}
View findViewById6 = findViewById(R$id.exo_prev);
this.previousButton = findViewById6;
if (findViewById6 != null) {
findViewById6.setOnClickListener(componentListener3);
}
View findViewById7 = findViewById(R$id.exo_next);
this.nextButton = findViewById7;
if (findViewById7 != null) {
findViewById7.setOnClickListener(componentListener3);
}
Typeface font = ResourcesCompat.getFont(context, R$font.roboto_medium_numbers);
View findViewById8 = findViewById(R$id.exo_rew);
TextView textView2 = findViewById8 == null ? (TextView) findViewById(R$id.exo_rew_with_amount) : textView;
this.rewindButtonTextView = textView2;
if (textView2 != null) {
textView2.setTypeface(font);
}
findViewById8 = findViewById8 == null ? textView2 : findViewById8;
this.rewindButton = findViewById8;
if (findViewById8 != null) {
findViewById8.setOnClickListener(componentListener3);
}
View findViewById9 = findViewById(R$id.exo_ffwd);
TextView textView3 = findViewById9 == null ? (TextView) findViewById(R$id.exo_ffwd_with_amount) : null;
this.fastForwardButtonTextView = textView3;
if (textView3 != null) {
textView3.setTypeface(font);
}
findViewById9 = findViewById9 == null ? textView3 : findViewById9;
this.fastForwardButton = findViewById9;
if (findViewById9 != null) {
findViewById9.setOnClickListener(componentListener3);
}
ImageView imageView5 = (ImageView) findViewById(R$id.exo_repeat_toggle);
this.repeatToggleButton = imageView5;
if (imageView5 != null) {
imageView5.setOnClickListener(componentListener3);
}
ImageView imageView6 = (ImageView) findViewById(R$id.exo_shuffle);
this.shuffleButton = imageView6;
if (imageView6 != null) {
imageView6.setOnClickListener(componentListener3);
}
this.resources = context.getResources();
this.buttonAlphaEnabled = r6.getInteger(R$integer.exo_media_button_opacity_percentage_enabled) / 100.0f;
this.buttonAlphaDisabled = this.resources.getInteger(R$integer.exo_media_button_opacity_percentage_disabled) / 100.0f;
View findViewById10 = findViewById(R$id.exo_vr);
this.vrButton = findViewById10;
if (findViewById10 != null) {
updateButton(false, findViewById10);
}
StyledPlayerControlViewLayoutManager styledPlayerControlViewLayoutManager = new StyledPlayerControlViewLayoutManager(this);
this.controlViewLayoutManager = styledPlayerControlViewLayoutManager;
boolean z21 = z10;
styledPlayerControlViewLayoutManager.setAnimationEnabled(z9);
boolean z22 = z3;
this.settingsAdapter = new SettingsAdapter(new String[]{this.resources.getString(R$string.exo_controls_playback_speed), this.resources.getString(R$string.exo_track_selection_title_audio)}, new Drawable[]{this.resources.getDrawable(R$drawable.exo_styled_controls_speed), this.resources.getDrawable(R$drawable.exo_styled_controls_audiotrack)});
this.settingsWindowMargin = this.resources.getDimensionPixelSize(R$dimen.exo_settings_offset);
RecyclerView recyclerView = (RecyclerView) LayoutInflater.from(context).inflate(R$layout.exo_styled_settings_list, (ViewGroup) null);
this.settingsView = recyclerView;
recyclerView.setAdapter(this.settingsAdapter);
this.settingsView.setLayoutManager(new LinearLayoutManager(getContext()));
PopupWindow popupWindow = new PopupWindow((View) this.settingsView, -2, -2, true);
this.settingsWindow = popupWindow;
if (Util.SDK_INT < 23) {
z11 = false;
popupWindow.setBackgroundDrawable(new ColorDrawable(0));
} else {
z11 = false;
}
this.settingsWindow.setOnDismissListener(componentListener3);
this.needToHideBars = true;
this.trackNameProvider = new DefaultTrackNameProvider(getResources());
this.subtitleOnButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_subtitle_on);
this.subtitleOffButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_subtitle_off);
this.subtitleOnContentDescription = this.resources.getString(R$string.exo_controls_cc_enabled_description);
this.subtitleOffContentDescription = this.resources.getString(R$string.exo_controls_cc_disabled_description);
this.textTrackSelectionAdapter = new TextTrackSelectionAdapter();
this.audioTrackSelectionAdapter = new AudioTrackSelectionAdapter();
this.playbackSpeedAdapter = new PlaybackSpeedAdapter(this.resources.getStringArray(R$array.exo_playback_speeds), this.resources.getIntArray(R$array.exo_speed_multiplied_by_100));
this.fullScreenExitDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_fullscreen_exit);
this.fullScreenEnterDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_fullscreen_enter);
this.repeatOffButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_repeat_off);
this.repeatOneButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_repeat_one);
this.repeatAllButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_repeat_all);
this.shuffleOnButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_shuffle_on);
this.shuffleOffButtonDrawable = this.resources.getDrawable(R$drawable.exo_styled_controls_shuffle_off);
this.fullScreenExitContentDescription = this.resources.getString(R$string.exo_controls_fullscreen_exit_description);
this.fullScreenEnterContentDescription = this.resources.getString(R$string.exo_controls_fullscreen_enter_description);
this.repeatOffButtonContentDescription = this.resources.getString(R$string.exo_controls_repeat_off_description);
this.repeatOneButtonContentDescription = this.resources.getString(R$string.exo_controls_repeat_one_description);
this.repeatAllButtonContentDescription = this.resources.getString(R$string.exo_controls_repeat_all_description);
this.shuffleOnContentDescription = this.resources.getString(R$string.exo_controls_shuffle_on_description);
this.shuffleOffContentDescription = this.resources.getString(R$string.exo_controls_shuffle_off_description);
this.controlViewLayoutManager.setShowButton((ViewGroup) findViewById(R$id.exo_bottom_bar), true);
this.controlViewLayoutManager.setShowButton(findViewById9, z6);
this.controlViewLayoutManager.setShowButton(findViewById8, z5);
this.controlViewLayoutManager.setShowButton(findViewById6, z7);
this.controlViewLayoutManager.setShowButton(findViewById7, z8);
this.controlViewLayoutManager.setShowButton(imageView6, z2);
this.controlViewLayoutManager.setShowButton(this.subtitleButton, z22);
this.controlViewLayoutManager.setShowButton(findViewById10, z21);
StyledPlayerControlViewLayoutManager styledPlayerControlViewLayoutManager2 = this.controlViewLayoutManager;
if (this.repeatToggleModes != 0) {
z12 = true;
imageView = imageView5;
} else {
imageView = imageView5;
z12 = z11;
}
styledPlayerControlViewLayoutManager2.setShowButton(imageView, z12);
addOnLayoutChangeListener(new View.OnLayoutChangeListener() { // from class: com.google.android.exoplayer2.ui.StyledPlayerControlView$$ExternalSyntheticLambda2
@Override // android.view.View.OnLayoutChangeListener
public final void onLayoutChange(View view, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10) {
StyledPlayerControlView.this.onLayoutChange(view, i3, i4, i5, i6, i7, i8, i9, i10);
}
});
}
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.controlViewLayoutManager.setShowButton(this.rewindButton, z);
updateNavigation();
}
public void setShowFastForwardButton(boolean z) {
this.controlViewLayoutManager.setShowButton(this.fastForwardButton, z);
updateNavigation();
}
public void setShowPreviousButton(boolean z) {
this.controlViewLayoutManager.setShowButton(this.previousButton, z);
updateNavigation();
}
public void setShowNextButton(boolean z) {
this.controlViewLayoutManager.setShowButton(this.nextButton, z);
updateNavigation();
}
public void setShowTimeoutMs(int i) {
this.showTimeoutMs = i;
if (isFullyVisible()) {
this.controlViewLayoutManager.resetHideCallbacks();
}
}
public void setRepeatToggleModes(int i) {
this.repeatToggleModes = i;
this.controlViewLayoutManager.setShowButton(this.repeatToggleButton, i != 0);
updateRepeatModeButton();
}
public void setShowShuffleButton(boolean z) {
this.controlViewLayoutManager.setShowButton(this.shuffleButton, z);
updateShuffleButton();
}
public void setShowSubtitleButton(boolean z) {
this.controlViewLayoutManager.setShowButton(this.subtitleButton, z);
}
public void setShowVrButton(boolean z) {
this.controlViewLayoutManager.setShowButton(this.vrButton, z);
}
public void setVrButtonListener(@Nullable View.OnClickListener onClickListener) {
View view = this.vrButton;
if (view != null) {
view.setOnClickListener(onClickListener);
updateButton(onClickListener != null, this.vrButton);
}
}
public void setAnimationEnabled(boolean z) {
this.controlViewLayoutManager.setAnimationEnabled(z);
}
public void setTimeBarMinUpdateInterval(int i) {
this.timeBarMinUpdateIntervalMs = Util.constrainValue(i, 16, 1000);
}
public void setOnFullScreenModeChangedListener(@Nullable OnFullScreenModeChangedListener onFullScreenModeChangedListener) {
updateFullScreenButtonVisibility(this.fullScreenButton, onFullScreenModeChangedListener != null);
updateFullScreenButtonVisibility(this.minimalFullScreenButton, onFullScreenModeChangedListener != null);
}
public void show() {
this.controlViewLayoutManager.show();
}
public void hide() {
this.controlViewLayoutManager.hide();
}
public void hideImmediately() {
this.controlViewLayoutManager.hideImmediately();
}
public boolean isFullyVisible() {
return this.controlViewLayoutManager.isFullyVisible();
}
public boolean isVisible() {
return getVisibility() == 0;
}
public void notifyOnVisibilityChange() {
Iterator it = this.visibilityListeners.iterator();
while (it.hasNext()) {
((VisibilityListener) it.next()).onVisibilityChange(getVisibility());
}
}
public void updateAll() {
updatePlayPauseButton();
updateNavigation();
updateRepeatModeButton();
updateShuffleButton();
updateTrackLists();
updatePlaybackSpeedList();
updateTimeline();
}
public final void updatePlayPauseButton() {
if (isVisible() && this.isAttachedToWindow && this.playPauseButton != null) {
if (shouldShowPauseButton()) {
((ImageView) this.playPauseButton).setImageDrawable(this.resources.getDrawable(R$drawable.exo_styled_controls_pause));
this.playPauseButton.setContentDescription(this.resources.getString(R$string.exo_controls_pause_description));
} else {
((ImageView) this.playPauseButton).setImageDrawable(this.resources.getDrawable(R$drawable.exo_styled_controls_play));
this.playPauseButton.setContentDescription(this.resources.getString(R$string.exo_controls_play_description));
}
}
}
public final void updateNavigation() {
if (isVisible() && this.isAttachedToWindow) {
updateButton(false, this.previousButton);
updateButton(false, this.rewindButton);
updateButton(false, this.fastForwardButton);
updateButton(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, imageView);
return;
}
updateButton(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.controlViewLayoutManager.getShowButton(imageView)) {
updateButton(false, this.shuffleButton);
return;
}
updateButton(false, this.shuffleButton);
this.shuffleButton.setImageDrawable(this.shuffleOffButtonDrawable);
this.shuffleButton.setContentDescription(this.shuffleOffContentDescription);
}
}
public final void updateTrackLists() {
initTrackSelectionAdapter();
updateButton(this.textTrackSelectionAdapter.getItemCount() > 0, this.subtitleButton);
}
public final void initTrackSelectionAdapter() {
this.textTrackSelectionAdapter.clear();
this.audioTrackSelectionAdapter.clear();
}
public final void updateProgress() {
if (isVisible() && this.isAttachedToWindow) {
TextView textView = this.positionView;
if (textView != null && !this.scrubbing) {
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 updateSettingsWindowSize() {
this.settingsView.measure(0, 0);
this.settingsWindow.setWidth(Math.min(this.settingsView.getMeasuredWidth(), getWidth() - (this.settingsWindowMargin * 2)));
this.settingsWindow.setHeight(Math.min(getHeight() - (this.settingsWindowMargin * 2), this.settingsView.getMeasuredHeight()));
}
public final void displaySettingsWindow(RecyclerView.Adapter adapter) {
this.settingsView.setAdapter(adapter);
updateSettingsWindowSize();
this.needToHideBars = false;
this.settingsWindow.dismiss();
this.needToHideBars = true;
this.settingsWindow.showAsDropDown(this, (getWidth() - this.settingsWindow.getWidth()) - this.settingsWindowMargin, (-this.settingsWindow.getHeight()) - this.settingsWindowMargin);
}
public void requestPlayPauseFocus() {
View view = this.playPauseButton;
if (view != null) {
view.requestFocus();
}
}
public final void updateButton(boolean z, View view) {
if (view == null) {
return;
}
view.setEnabled(z);
view.setAlpha(z ? this.buttonAlphaEnabled : this.buttonAlphaDisabled);
}
public final void onSettingViewClicked(int i) {
if (i == 0) {
displaySettingsWindow(this.playbackSpeedAdapter);
} else if (i == 1) {
displaySettingsWindow(this.audioTrackSelectionAdapter);
} else {
this.settingsWindow.dismiss();
}
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.controlViewLayoutManager.onAttachedToWindow();
this.isAttachedToWindow = true;
if (isFullyVisible()) {
this.controlViewLayoutManager.resetHideCallbacks();
}
updateAll();
}
@Override // android.view.ViewGroup, android.view.View
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
this.controlViewLayoutManager.onDetachedFromWindow();
this.isAttachedToWindow = false;
removeCallbacks(this.updateProgressAction);
this.controlViewLayoutManager.removeHideCallbacks();
}
@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;
}
@Override // android.widget.FrameLayout, android.view.ViewGroup, android.view.View
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
this.controlViewLayoutManager.onLayout(z, i, i2, i3, i4);
}
public final void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
int i9 = i4 - i2;
int i10 = i8 - i6;
if (!(i3 - i == i7 - i5 && i9 == i10) && this.settingsWindow.isShowing()) {
updateSettingsWindowSize();
this.settingsWindow.update(view, (getWidth() - this.settingsWindow.getWidth()) - this.settingsWindowMargin, (-this.settingsWindow.getHeight()) - this.settingsWindowMargin, -1, -1);
}
}
public static void initializeFullScreenButton(View view, View.OnClickListener onClickListener) {
if (view == null) {
return;
}
view.setVisibility(8);
view.setOnClickListener(onClickListener);
}
public static void updateFullScreenButtonVisibility(View view, boolean z) {
if (view == null) {
return;
}
if (z) {
view.setVisibility(0);
} else {
view.setVisibility(8);
}
}
public static int getRepeatToggleModes(TypedArray typedArray, int i) {
return typedArray.getInt(R$styleable.StyledPlayerControlView_repeat_toggle_modes, i);
}
public final class ComponentListener implements Player.Listener, TimeBar.OnScrubListener, View.OnClickListener, PopupWindow.OnDismissListener {
public ComponentListener() {
}
@Override // com.google.android.exoplayer2.ui.TimeBar.OnScrubListener
public void onScrubStart(TimeBar timeBar, long j) {
StyledPlayerControlView.this.scrubbing = true;
if (StyledPlayerControlView.this.positionView != null) {
StyledPlayerControlView.this.positionView.setText(Util.getStringForTime(StyledPlayerControlView.this.formatBuilder, StyledPlayerControlView.this.formatter, j));
}
StyledPlayerControlView.this.controlViewLayoutManager.removeHideCallbacks();
}
@Override // com.google.android.exoplayer2.ui.TimeBar.OnScrubListener
public void onScrubMove(TimeBar timeBar, long j) {
if (StyledPlayerControlView.this.positionView != null) {
StyledPlayerControlView.this.positionView.setText(Util.getStringForTime(StyledPlayerControlView.this.formatBuilder, StyledPlayerControlView.this.formatter, j));
}
}
@Override // com.google.android.exoplayer2.ui.TimeBar.OnScrubListener
public void onScrubStop(TimeBar timeBar, long j, boolean z) {
StyledPlayerControlView.this.scrubbing = false;
if (!z) {
StyledPlayerControlView.access$1600(StyledPlayerControlView.this);
}
StyledPlayerControlView.this.controlViewLayoutManager.resetHideCallbacks();
}
@Override // android.widget.PopupWindow.OnDismissListener
public void onDismiss() {
if (StyledPlayerControlView.this.needToHideBars) {
StyledPlayerControlView.this.controlViewLayoutManager.resetHideCallbacks();
}
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
StyledPlayerControlView.access$1600(StyledPlayerControlView.this);
}
}
public class SettingsAdapter extends RecyclerView.Adapter {
public final Drawable[] iconIds;
public final String[] mainTexts;
public final String[] subTexts;
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public long getItemId(int i) {
return i;
}
public SettingsAdapter(String[] strArr, Drawable[] drawableArr) {
this.mainTexts = strArr;
this.subTexts = new String[strArr.length];
this.iconIds = drawableArr;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public SettingViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
return StyledPlayerControlView.this.new SettingViewHolder(LayoutInflater.from(StyledPlayerControlView.this.getContext()).inflate(R$layout.exo_styled_settings_list_item, viewGroup, false));
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(SettingViewHolder settingViewHolder, int i) {
settingViewHolder.mainTextView.setText(this.mainTexts[i]);
if (this.subTexts[i] == null) {
settingViewHolder.subTextView.setVisibility(8);
} else {
settingViewHolder.subTextView.setText(this.subTexts[i]);
}
if (this.iconIds[i] == null) {
settingViewHolder.iconView.setVisibility(8);
} else {
settingViewHolder.iconView.setImageDrawable(this.iconIds[i]);
}
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
return this.mainTexts.length;
}
}
public final class SettingViewHolder extends RecyclerView.ViewHolder {
public final ImageView iconView;
public final TextView mainTextView;
public final TextView subTextView;
public SettingViewHolder(View view) {
super(view);
if (Util.SDK_INT < 26) {
view.setFocusable(true);
}
this.mainTextView = (TextView) view.findViewById(R$id.exo_main_text);
this.subTextView = (TextView) view.findViewById(R$id.exo_sub_text);
this.iconView = (ImageView) view.findViewById(R$id.exo_icon);
view.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.exoplayer2.ui.StyledPlayerControlView$SettingViewHolder$$ExternalSyntheticLambda0
@Override // android.view.View.OnClickListener
public final void onClick(View view2) {
StyledPlayerControlView.SettingViewHolder.this.lambda$new$0(view2);
}
});
}
public final /* synthetic */ void lambda$new$0(View view) {
StyledPlayerControlView.this.onSettingViewClicked(getAdapterPosition());
}
}
public final class PlaybackSpeedAdapter extends RecyclerView.Adapter {
public final String[] playbackSpeedTexts;
public final int[] playbackSpeedsMultBy100;
public int selectedIndex;
public PlaybackSpeedAdapter(String[] strArr, int[] iArr) {
this.playbackSpeedTexts = strArr;
this.playbackSpeedsMultBy100 = iArr;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public SubSettingViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
return new SubSettingViewHolder(LayoutInflater.from(StyledPlayerControlView.this.getContext()).inflate(R$layout.exo_styled_sub_settings_list_item, viewGroup, false));
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(SubSettingViewHolder subSettingViewHolder, final int i) {
String[] strArr = this.playbackSpeedTexts;
if (i < strArr.length) {
subSettingViewHolder.textView.setText(strArr[i]);
}
subSettingViewHolder.checkView.setVisibility(i == this.selectedIndex ? 0 : 4);
subSettingViewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.exoplayer2.ui.StyledPlayerControlView$PlaybackSpeedAdapter$$ExternalSyntheticLambda0
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
StyledPlayerControlView.PlaybackSpeedAdapter.this.lambda$onBindViewHolder$0(i, view);
}
});
}
public final /* synthetic */ void lambda$onBindViewHolder$0(int i, View view) {
if (i != this.selectedIndex) {
StyledPlayerControlView.this.setPlaybackSpeed(this.playbackSpeedsMultBy100[i] / 100.0f);
}
StyledPlayerControlView.this.settingsWindow.dismiss();
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
return this.playbackSpeedTexts.length;
}
}
public final class TextTrackSelectionAdapter extends TrackSelectionAdapter {
public TextTrackSelectionAdapter() {
super();
}
@Override // com.google.android.exoplayer2.ui.StyledPlayerControlView.TrackSelectionAdapter, androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(SubSettingViewHolder subSettingViewHolder, int i) {
super.onBindViewHolder(subSettingViewHolder, i);
if (i > 0) {
subSettingViewHolder.checkView.setVisibility(((TrackInfo) this.tracks.get(i + (-1))).selected ? 0 : 4);
}
}
}
public final class AudioTrackSelectionAdapter extends TrackSelectionAdapter {
public AudioTrackSelectionAdapter() {
super();
}
}
public abstract class TrackSelectionAdapter extends RecyclerView.Adapter {
public List rendererIndices = new ArrayList();
public List tracks = new ArrayList();
public TrackSelectionAdapter() {
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public SubSettingViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
return new SubSettingViewHolder(LayoutInflater.from(StyledPlayerControlView.this.getContext()).inflate(R$layout.exo_styled_sub_settings_list_item, viewGroup, false));
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public void onBindViewHolder(SubSettingViewHolder subSettingViewHolder, int i) {
StyledPlayerControlView.access$4800(StyledPlayerControlView.this);
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public int getItemCount() {
if (this.tracks.isEmpty()) {
return 0;
}
return this.tracks.size() + 1;
}
public void clear() {
this.tracks = Collections.emptyList();
}
}
public static class SubSettingViewHolder extends RecyclerView.ViewHolder {
public final View checkView;
public final TextView textView;
public SubSettingViewHolder(View view) {
super(view);
if (Util.SDK_INT < 26) {
view.setFocusable(true);
}
this.textView = (TextView) view.findViewById(R$id.exo_text);
this.checkView = view.findViewById(R$id.exo_check);
}
}
}