From e6849e082ca07093de028804d807f7811fad3055 Mon Sep 17 00:00:00 2001 From: jbibik Date: Tue, 22 Oct 2024 08:27:01 -0700 Subject: [PATCH] Align spelling of fullScreen to fullscreen Currently most of the public APIs use `fullscreen` (apart from the deprecated `PlayerControlView.OnFullScreenModeChangedListener` which will have to remain as is). This code changes mostly private variable naming. PiperOrigin-RevId: 688559509 (cherry picked from commit ee4f0c40bc2575f55f89c4a22f26dabcdc75775a) --- .../media3/demo/surface/MainActivity.java | 26 +++--- .../androidx/media3/ui/PlayerControlView.java | 92 +++++++++---------- .../java/androidx/media3/ui/PlayerView.java | 8 +- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/demos/surface/src/main/java/androidx/media3/demo/surface/MainActivity.java b/demos/surface/src/main/java/androidx/media3/demo/surface/MainActivity.java index bb3d20c094e..67299e595cc 100644 --- a/demos/surface/src/main/java/androidx/media3/demo/surface/MainActivity.java +++ b/demos/surface/src/main/java/androidx/media3/demo/surface/MainActivity.java @@ -62,8 +62,8 @@ public final class MainActivity extends Activity { private boolean isOwner; @Nullable private LegacyPlayerControlView playerControlView; - @Nullable private SurfaceView fullScreenView; - @Nullable private SurfaceView nonFullScreenView; + @Nullable private SurfaceView fullscreenView; + @Nullable private SurfaceView nonFullscreenView; @Nullable private SurfaceView currentOutputView; @Nullable private static ExoPlayer player; @@ -75,13 +75,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); playerControlView = findViewById(R.id.player_control_view); - fullScreenView = findViewById(R.id.full_screen_view); - fullScreenView.setOnClickListener( + fullscreenView = findViewById(R.id.full_screen_view); + fullscreenView.setOnClickListener( v -> { - setCurrentOutputView(nonFullScreenView); - Assertions.checkNotNull(fullScreenView).setVisibility(View.GONE); + setCurrentOutputView(nonFullscreenView); + Assertions.checkNotNull(fullscreenView).setVisibility(View.GONE); }); - attachSurfaceListener(fullScreenView); + attachSurfaceListener(fullscreenView); isOwner = getIntent().getBooleanExtra(OWNER_EXTRA, /* defaultValue= */ true); GridLayout gridLayout = findViewById(R.id.grid_layout); for (int i = 0; i < 9; i++) { @@ -97,8 +97,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { button.setText(getString(R.string.full_screen_label)); button.setOnClickListener( v -> { - setCurrentOutputView(fullScreenView); - Assertions.checkNotNull(fullScreenView).setVisibility(View.VISIBLE); + setCurrentOutputView(fullscreenView); + Assertions.checkNotNull(fullscreenView).setVisibility(View.VISIBLE); }); } else if (i == 2) { Button button = new Button(/* context= */ this); @@ -116,10 +116,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { surfaceView.setOnClickListener( v -> { setCurrentOutputView(surfaceView); - nonFullScreenView = surfaceView; + nonFullscreenView = surfaceView; }); - if (nonFullScreenView == null) { - nonFullScreenView = surfaceView; + if (nonFullscreenView == null) { + nonFullscreenView = surfaceView; } } gridLayout.addView(view); @@ -144,7 +144,7 @@ public void onResume() { initializePlayer(); } - setCurrentOutputView(nonFullScreenView); + setCurrentOutputView(nonFullscreenView); LegacyPlayerControlView playerControlView = Assertions.checkNotNull(this.playerControlView); playerControlView.setPlayer(player); diff --git a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java b/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java index bc41557f8b1..5cf8455122c 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/PlayerControlView.java @@ -390,8 +390,8 @@ public interface OnFullScreenModeChangedListener { @Nullable private final ImageView shuffleButton; @Nullable private final ImageView vrButton; @Nullable private final ImageView subtitleButton; - @Nullable private final ImageView fullScreenButton; - @Nullable private final ImageView minimalFullScreenButton; + @Nullable private final ImageView fullscreenButton; + @Nullable private final ImageView minimalFullscreenButton; @Nullable private final View settingsButton; @Nullable private final View playbackSpeedButton; @Nullable private final View audioTrackButton; @@ -422,10 +422,10 @@ public interface OnFullScreenModeChangedListener { private final Drawable subtitleOffButtonDrawable; private final String subtitleOnContentDescription; private final String subtitleOffContentDescription; - private final Drawable fullScreenExitDrawable; - private final Drawable fullScreenEnterDrawable; - private final String fullScreenExitContentDescription; - private final String fullScreenEnterContentDescription; + private final Drawable fullscreenExitDrawable; + private final Drawable fullscreenEnterDrawable; + private final String fullscreenExitContentDescription; + private final String fullscreenEnterContentDescription; @Nullable private Player player; @Nullable private ProgressUpdateListener progressUpdateListener; @@ -434,7 +434,7 @@ public interface OnFullScreenModeChangedListener { @Nullable private OnFullScreenModeChangedListener onFullScreenModeChangedListener; - private boolean isFullScreen; + private boolean isFullscreen; private boolean isAttachedToWindow; private boolean showMultiWindowTimeBar; private boolean showPlayButtonIfSuppressed; @@ -485,8 +485,8 @@ public PlayerControlView( int fastForwardDrawableResId = R.drawable.exo_styled_controls_simple_fastforward; int previousDrawableResId = R.drawable.exo_styled_controls_previous; int rewindDrawableResId = R.drawable.exo_styled_controls_simple_rewind; - int fullScreenExitDrawableResId = R.drawable.exo_styled_controls_fullscreen_exit; - int fullScreenEnterDrawableResId = R.drawable.exo_styled_controls_fullscreen_enter; + int fullscreenExitDrawableResId = R.drawable.exo_styled_controls_fullscreen_exit; + int fullscreenEnterDrawableResId = R.drawable.exo_styled_controls_fullscreen_enter; int repeatOffDrawableResId = R.drawable.exo_styled_controls_repeat_off; int repeatOneDrawableResId = R.drawable.exo_styled_controls_repeat_one; int repeatAllDrawableResId = R.drawable.exo_styled_controls_repeat_all; @@ -531,12 +531,12 @@ public PlayerControlView( a.getResourceId(R.styleable.PlayerControlView_previous_icon, previousDrawableResId); rewindDrawableResId = a.getResourceId(R.styleable.PlayerControlView_rewind_icon, rewindDrawableResId); - fullScreenExitDrawableResId = + fullscreenExitDrawableResId = a.getResourceId( - R.styleable.PlayerControlView_fullscreen_exit_icon, fullScreenExitDrawableResId); - fullScreenEnterDrawableResId = + R.styleable.PlayerControlView_fullscreen_exit_icon, fullscreenExitDrawableResId); + fullscreenEnterDrawableResId = a.getResourceId( - R.styleable.PlayerControlView_fullscreen_enter_icon, fullScreenEnterDrawableResId); + R.styleable.PlayerControlView_fullscreen_enter_icon, fullscreenEnterDrawableResId); repeatOffDrawableResId = a.getResourceId(R.styleable.PlayerControlView_repeat_off_icon, repeatOffDrawableResId); repeatOneDrawableResId = @@ -605,10 +605,10 @@ public PlayerControlView( subtitleButton.setOnClickListener(componentListener); } - fullScreenButton = findViewById(R.id.exo_fullscreen); - initializeFullScreenButton(fullScreenButton, this::onFullScreenButtonClicked); - minimalFullScreenButton = findViewById(R.id.exo_minimal_fullscreen); - initializeFullScreenButton(minimalFullScreenButton, this::onFullScreenButtonClicked); + fullscreenButton = findViewById(R.id.exo_fullscreen); + initializeFullscreenButton(fullscreenButton, this::onFullscreenButtonClicked); + minimalFullscreenButton = findViewById(R.id.exo_minimal_fullscreen); + initializeFullscreenButton(minimalFullscreenButton, this::onFullscreenButtonClicked); settingsButton = findViewById(R.id.exo_settings); if (settingsButton != null) { @@ -768,16 +768,16 @@ public PlayerControlView( playButtonDrawable = getDrawable(context, resources, playDrawableResId); pauseButtonDrawable = getDrawable(context, resources, pauseDrawableResId); - fullScreenExitDrawable = getDrawable(context, resources, fullScreenExitDrawableResId); - fullScreenEnterDrawable = getDrawable(context, resources, fullScreenEnterDrawableResId); + fullscreenExitDrawable = getDrawable(context, resources, fullscreenExitDrawableResId); + fullscreenEnterDrawable = getDrawable(context, resources, fullscreenEnterDrawableResId); repeatOffButtonDrawable = getDrawable(context, resources, repeatOffDrawableResId); repeatOneButtonDrawable = getDrawable(context, resources, repeatOneDrawableResId); repeatAllButtonDrawable = getDrawable(context, resources, repeatAllDrawableResId); shuffleOnButtonDrawable = getDrawable(context, resources, shuffleOnDrawableResId); shuffleOffButtonDrawable = getDrawable(context, resources, shuffleOffDrawableResId); - fullScreenExitContentDescription = + fullscreenExitContentDescription = resources.getString(R.string.exo_controls_fullscreen_exit_description); - fullScreenEnterContentDescription = + fullscreenEnterContentDescription = resources.getString(R.string.exo_controls_fullscreen_enter_description); repeatOffButtonContentDescription = resources.getString(R.string.exo_controls_repeat_off_description); @@ -1114,8 +1114,8 @@ public void setTimeBarMinUpdateInterval(int minUpdateIntervalMs) { public void setOnFullScreenModeChangedListener( @Nullable OnFullScreenModeChangedListener listener) { onFullScreenModeChangedListener = listener; - updateFullScreenButtonVisibility(fullScreenButton, listener != null); - updateFullScreenButtonVisibility(minimalFullScreenButton, listener != null); + updateFullscreenButtonVisibility(fullscreenButton, listener != null); + updateFullscreenButtonVisibility(minimalFullscreenButton, listener != null); } /** @@ -1574,8 +1574,8 @@ private void seekToTimeBarPosition(Player player, long positionMs) { updateProgress(); } - private void onFullScreenButtonClicked(View v) { - updateIsFullscreen(!isFullScreen); + private void onFullscreenButtonClicked(View v) { + updateIsFullscreen(!isFullscreen); } /** @@ -1589,30 +1589,30 @@ private void onFullScreenButtonClicked(View v) { * @param isFullscreen If the view is in full screen. */ public void updateIsFullscreen(boolean isFullscreen) { - if (this.isFullScreen == isFullscreen) { + if (this.isFullscreen == isFullscreen) { return; } - this.isFullScreen = isFullscreen; - updateFullScreenButtonForState(fullScreenButton, isFullscreen); - updateFullScreenButtonForState(minimalFullScreenButton, isFullscreen); + this.isFullscreen = isFullscreen; + updateFullscreenButtonForState(fullscreenButton, isFullscreen); + updateFullscreenButtonForState(minimalFullscreenButton, isFullscreen); if (onFullScreenModeChangedListener != null) { onFullScreenModeChangedListener.onFullScreenModeChanged(isFullscreen); } } - private void updateFullScreenButtonForState( - @Nullable ImageView fullScreenButton, boolean isFullScreen) { - if (fullScreenButton == null) { + private void updateFullscreenButtonForState( + @Nullable ImageView fullscreenButton, boolean isFullscreen) { + if (fullscreenButton == null) { return; } - if (isFullScreen) { - fullScreenButton.setImageDrawable(fullScreenExitDrawable); - fullScreenButton.setContentDescription(fullScreenExitContentDescription); + if (isFullscreen) { + fullscreenButton.setImageDrawable(fullscreenExitDrawable); + fullscreenButton.setContentDescription(fullscreenExitContentDescription); } else { - fullScreenButton.setImageDrawable(fullScreenEnterDrawable); - fullScreenButton.setContentDescription(fullScreenEnterContentDescription); + fullscreenButton.setImageDrawable(fullscreenEnterDrawable); + fullscreenButton.setContentDescription(fullscreenEnterContentDescription); } } @@ -1775,23 +1775,23 @@ private static boolean canShowMultiWindowTimeBar(Player player, Timeline.Window return true; } - private static void initializeFullScreenButton(View fullScreenButton, OnClickListener listener) { - if (fullScreenButton == null) { + private static void initializeFullscreenButton(View fullscreenButton, OnClickListener listener) { + if (fullscreenButton == null) { return; } - fullScreenButton.setVisibility(GONE); - fullScreenButton.setOnClickListener(listener); + fullscreenButton.setVisibility(GONE); + fullscreenButton.setOnClickListener(listener); } - private static void updateFullScreenButtonVisibility( - @Nullable View fullScreenButton, boolean visible) { - if (fullScreenButton == null) { + private static void updateFullscreenButtonVisibility( + @Nullable View fullscreenButton, boolean visible) { + if (fullscreenButton == null) { return; } if (visible) { - fullScreenButton.setVisibility(VISIBLE); + fullscreenButton.setVisibility(VISIBLE); } else { - fullScreenButton.setVisibility(GONE); + fullscreenButton.setVisibility(GONE); } } diff --git a/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java b/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java index 76773508be3..b766933aebc 100644 --- a/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java +++ b/libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java @@ -208,10 +208,10 @@ public interface FullscreenButtonClickListener { /** * Called when the fullscreen button is clicked. * - * @param isFullScreen {@code true} if the video rendering surface should be fullscreen, {@code + * @param isFullscreen {@code true} if the video rendering surface should be fullscreen, {@code * false} otherwise. */ - void onFullscreenButtonClick(boolean isFullScreen); + void onFullscreenButtonClick(boolean isFullscreen); } /** @@ -1957,9 +1957,9 @@ public void onVisibilityChange(int visibility) { // PlayerControlView.OnFullScreenModeChangedListener implementation @Override - public void onFullScreenModeChanged(boolean isFullScreen) { + public void onFullScreenModeChanged(boolean isFullscreen) { if (fullscreenButtonClickListener != null) { - fullscreenButtonClickListener.onFullscreenButtonClick(isFullScreen); + fullscreenButtonClickListener.onFullscreenButtonClick(isFullscreen); } } }