Remove 'styled' from styledPlayerControlView field name

This class is already called StyledPlayerControlViewLayoutManager, it
seems unecessary to repeate the 'styled' word again in this context.

PiperOrigin-RevId: 420711161
This commit is contained in:
ibaker 2022-01-10 10:50:24 +00:00 committed by bachinger
parent bc12306267
commit 220179ccbb

View File

@ -48,7 +48,7 @@ import java.util.List;
// Int for defining the UX state where the views are being animated to be shown. // Int for defining the UX state where the views are being animated to be shown.
private static final int UX_STATE_ANIMATING_SHOW = 4; private static final int UX_STATE_ANIMATING_SHOW = 4;
private final StyledPlayerControlView styledPlayerControlView; private final StyledPlayerControlView playerControlView;
@Nullable private final View controlsBackground; @Nullable private final View controlsBackground;
@Nullable private final ViewGroup centerControls; @Nullable private final ViewGroup centerControls;
@ -84,8 +84,8 @@ import java.util.List;
private boolean animationEnabled; private boolean animationEnabled;
@SuppressWarnings({"nullness:method.invocation", "nullness:methodref.receiver.bound"}) @SuppressWarnings({"nullness:method.invocation", "nullness:methodref.receiver.bound"})
public StyledPlayerControlViewLayoutManager(StyledPlayerControlView styledPlayerControlView) { public StyledPlayerControlViewLayoutManager(StyledPlayerControlView playerControlView) {
this.styledPlayerControlView = styledPlayerControlView; this.playerControlView = playerControlView;
showAllBarsRunnable = this::showAllBars; showAllBarsRunnable = this::showAllBars;
hideAllBarsRunnable = this::hideAllBars; hideAllBarsRunnable = this::hideAllBars;
hideProgressBarRunnable = this::hideProgressBar; hideProgressBarRunnable = this::hideProgressBar;
@ -97,26 +97,25 @@ import java.util.List;
shownButtons = new ArrayList<>(); shownButtons = new ArrayList<>();
// Relating to Center View // Relating to Center View
controlsBackground = styledPlayerControlView.findViewById(R.id.exo_controls_background); controlsBackground = playerControlView.findViewById(R.id.exo_controls_background);
centerControls = styledPlayerControlView.findViewById(R.id.exo_center_controls); centerControls = playerControlView.findViewById(R.id.exo_center_controls);
// Relating to Minimal Layout // Relating to Minimal Layout
minimalControls = styledPlayerControlView.findViewById(R.id.exo_minimal_controls); minimalControls = playerControlView.findViewById(R.id.exo_minimal_controls);
// Relating to Bottom Bar View // Relating to Bottom Bar View
bottomBar = styledPlayerControlView.findViewById(R.id.exo_bottom_bar); bottomBar = playerControlView.findViewById(R.id.exo_bottom_bar);
// Relating to Bottom Bar Left View // Relating to Bottom Bar Left View
timeView = styledPlayerControlView.findViewById(R.id.exo_time); timeView = playerControlView.findViewById(R.id.exo_time);
timeBar = styledPlayerControlView.findViewById(R.id.exo_progress); timeBar = playerControlView.findViewById(R.id.exo_progress);
// Relating to Bottom Bar Right View // Relating to Bottom Bar Right View
basicControls = styledPlayerControlView.findViewById(R.id.exo_basic_controls); basicControls = playerControlView.findViewById(R.id.exo_basic_controls);
extraControls = styledPlayerControlView.findViewById(R.id.exo_extra_controls); extraControls = playerControlView.findViewById(R.id.exo_extra_controls);
extraControlsScrollView = extraControlsScrollView = playerControlView.findViewById(R.id.exo_extra_controls_scroll_view);
styledPlayerControlView.findViewById(R.id.exo_extra_controls_scroll_view); overflowShowButton = playerControlView.findViewById(R.id.exo_overflow_show);
overflowShowButton = styledPlayerControlView.findViewById(R.id.exo_overflow_show); View overflowHideButton = playerControlView.findViewById(R.id.exo_overflow_hide);
View overflowHideButton = styledPlayerControlView.findViewById(R.id.exo_overflow_hide);
if (overflowShowButton != null && overflowHideButton != null) { if (overflowShowButton != null && overflowHideButton != null) {
overflowShowButton.setOnClickListener(this::onOverflowButtonClick); overflowShowButton.setOnClickListener(this::onOverflowButtonClick);
overflowHideButton.setOnClickListener(this::onOverflowButtonClick); overflowHideButton.setOnClickListener(this::onOverflowButtonClick);
@ -194,7 +193,7 @@ import java.util.List;
} }
}); });
Resources resources = styledPlayerControlView.getResources(); Resources resources = playerControlView.getResources();
float translationYForProgressBar = float translationYForProgressBar =
resources.getDimension(R.dimen.exo_styled_bottom_bar_height) resources.getDimension(R.dimen.exo_styled_bottom_bar_height)
- resources.getDimension(R.dimen.exo_styled_progress_bar_height); - resources.getDimension(R.dimen.exo_styled_progress_bar_height);
@ -213,7 +212,7 @@ import java.util.List;
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
setUxState(UX_STATE_ONLY_PROGRESS_VISIBLE); setUxState(UX_STATE_ONLY_PROGRESS_VISIBLE);
if (needToShowBars) { if (needToShowBars) {
styledPlayerControlView.post(showAllBarsRunnable); playerControlView.post(showAllBarsRunnable);
needToShowBars = false; needToShowBars = false;
} }
} }
@ -236,7 +235,7 @@ import java.util.List;
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
setUxState(UX_STATE_NONE_VISIBLE); setUxState(UX_STATE_NONE_VISIBLE);
if (needToShowBars) { if (needToShowBars) {
styledPlayerControlView.post(showAllBarsRunnable); playerControlView.post(showAllBarsRunnable);
needToShowBars = false; needToShowBars = false;
} }
} }
@ -258,7 +257,7 @@ import java.util.List;
public void onAnimationEnd(Animator animation) { public void onAnimationEnd(Animator animation) {
setUxState(UX_STATE_NONE_VISIBLE); setUxState(UX_STATE_NONE_VISIBLE);
if (needToShowBars) { if (needToShowBars) {
styledPlayerControlView.post(showAllBarsRunnable); playerControlView.post(showAllBarsRunnable);
needToShowBars = false; needToShowBars = false;
} }
} }
@ -352,10 +351,10 @@ import java.util.List;
} }
public void show() { public void show() {
if (!styledPlayerControlView.isVisible()) { if (!playerControlView.isVisible()) {
styledPlayerControlView.setVisibility(View.VISIBLE); playerControlView.setVisibility(View.VISIBLE);
styledPlayerControlView.updateAll(); playerControlView.updateAll();
styledPlayerControlView.requestPlayPauseFocus(); playerControlView.requestPlayPauseFocus();
} }
showAllBars(); showAllBars();
} }
@ -395,7 +394,7 @@ import java.util.List;
return; return;
} }
removeHideCallbacks(); removeHideCallbacks();
int showTimeoutMs = styledPlayerControlView.getShowTimeoutMs(); int showTimeoutMs = playerControlView.getShowTimeoutMs();
if (showTimeoutMs > 0) { if (showTimeoutMs > 0) {
if (!animationEnabled) { if (!animationEnabled) {
postDelayedRunnable(hideControllerRunnable, showTimeoutMs); postDelayedRunnable(hideControllerRunnable, showTimeoutMs);
@ -408,22 +407,22 @@ import java.util.List;
} }
public void removeHideCallbacks() { public void removeHideCallbacks() {
styledPlayerControlView.removeCallbacks(hideControllerRunnable); playerControlView.removeCallbacks(hideControllerRunnable);
styledPlayerControlView.removeCallbacks(hideAllBarsRunnable); playerControlView.removeCallbacks(hideAllBarsRunnable);
styledPlayerControlView.removeCallbacks(hideMainBarRunnable); playerControlView.removeCallbacks(hideMainBarRunnable);
styledPlayerControlView.removeCallbacks(hideProgressBarRunnable); playerControlView.removeCallbacks(hideProgressBarRunnable);
} }
public void onAttachedToWindow() { public void onAttachedToWindow() {
styledPlayerControlView.addOnLayoutChangeListener(onLayoutChangeListener); playerControlView.addOnLayoutChangeListener(onLayoutChangeListener);
} }
public void onDetachedFromWindow() { public void onDetachedFromWindow() {
styledPlayerControlView.removeOnLayoutChangeListener(onLayoutChangeListener); playerControlView.removeOnLayoutChangeListener(onLayoutChangeListener);
} }
public boolean isFullyVisible() { public boolean isFullyVisible() {
return uxState == UX_STATE_ALL_VISIBLE && styledPlayerControlView.isVisible(); return uxState == UX_STATE_ALL_VISIBLE && playerControlView.isVisible();
} }
public void setShowButton(@Nullable View button, boolean showButton) { public void setShowButton(@Nullable View button, boolean showButton) {
@ -451,14 +450,14 @@ import java.util.List;
int prevUxState = this.uxState; int prevUxState = this.uxState;
this.uxState = uxState; this.uxState = uxState;
if (uxState == UX_STATE_NONE_VISIBLE) { if (uxState == UX_STATE_NONE_VISIBLE) {
styledPlayerControlView.setVisibility(View.GONE); playerControlView.setVisibility(View.GONE);
} else if (prevUxState == UX_STATE_NONE_VISIBLE) { } else if (prevUxState == UX_STATE_NONE_VISIBLE) {
styledPlayerControlView.setVisibility(View.VISIBLE); playerControlView.setVisibility(View.VISIBLE);
} }
// TODO(insun): Notify specific uxState. Currently reuses legacy visibility listener for API // TODO(insun): Notify specific uxState. Currently reuses legacy visibility listener for API
// compatibility. // compatibility.
if (prevUxState != uxState) { if (prevUxState != uxState) {
styledPlayerControlView.notifyOnVisibilityChange(); playerControlView.notifyOnVisibilityChange();
} }
} }
@ -550,7 +549,7 @@ import java.util.List;
private void postDelayedRunnable(Runnable runnable, long interval) { private void postDelayedRunnable(Runnable runnable, long interval) {
if (interval >= 0) { if (interval >= 0) {
styledPlayerControlView.postDelayed(runnable, interval); playerControlView.postDelayed(runnable, interval);
} }
} }
@ -571,13 +570,13 @@ import java.util.List;
private boolean useMinimalMode() { private boolean useMinimalMode() {
int width = int width =
styledPlayerControlView.getWidth() playerControlView.getWidth()
- styledPlayerControlView.getPaddingLeft() - playerControlView.getPaddingLeft()
- styledPlayerControlView.getPaddingRight(); - playerControlView.getPaddingRight();
int height = int height =
styledPlayerControlView.getHeight() playerControlView.getHeight()
- styledPlayerControlView.getPaddingBottom() - playerControlView.getPaddingBottom()
- styledPlayerControlView.getPaddingTop(); - playerControlView.getPaddingTop();
int centerControlWidth = int centerControlWidth =
getWidthWithMargins(centerControls) getWidthWithMargins(centerControls)
@ -607,7 +606,7 @@ import java.util.List;
if (timeBar != null) { if (timeBar != null) {
MarginLayoutParams timeBarParams = (MarginLayoutParams) timeBar.getLayoutParams(); MarginLayoutParams timeBarParams = (MarginLayoutParams) timeBar.getLayoutParams();
int timeBarMarginBottom = int timeBarMarginBottom =
styledPlayerControlView playerControlView
.getResources() .getResources()
.getDimensionPixelSize(R.dimen.exo_styled_progress_margin_bottom); .getDimensionPixelSize(R.dimen.exo_styled_progress_margin_bottom);
timeBarParams.bottomMargin = (isMinimalMode ? 0 : timeBarMarginBottom); timeBarParams.bottomMargin = (isMinimalMode ? 0 : timeBarMarginBottom);
@ -646,9 +645,9 @@ import java.util.List;
} }
int width = int width =
styledPlayerControlView.getWidth() playerControlView.getWidth()
- styledPlayerControlView.getPaddingLeft() - playerControlView.getPaddingLeft()
- styledPlayerControlView.getPaddingRight(); - playerControlView.getPaddingRight();
// Reset back to all controls being basic controls and the overflow not being needed. The last // Reset back to all controls being basic controls and the overflow not being needed. The last
// child of extraControls is the overflow hide button, which shouldn't be moved back. // child of extraControls is the overflow hide button, which shouldn't be moved back.