Skip to content

Commit

Permalink
Align spelling of fullScreen to fullscreen
Browse files Browse the repository at this point in the history
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 ee4f0c4)
  • Loading branch information
oceanjules authored and ivanbuper committed Nov 5, 2024
1 parent 8fdb233 commit e6849e0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++) {
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -144,7 +144,7 @@ public void onResume() {
initializePlayer();
}

setCurrentOutputView(nonFullScreenView);
setCurrentOutputView(nonFullscreenView);

LegacyPlayerControlView playerControlView = Assertions.checkNotNull(this.playerControlView);
playerControlView.setPlayer(player);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down
8 changes: 4 additions & 4 deletions libraries/ui/src/main/java/androidx/media3/ui/PlayerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit e6849e0

Please sign in to comment.