Tweak the parameter name in Util.shouldShowPlayButton

The previous name sounds a bit like it refers to the action of
'playing', rather than which button is shown (which is kind of the
opposite!).

PiperOrigin-RevId: 743908736
This commit is contained in:
ibaker 2025-04-04 05:39:13 -07:00 committed by Copybara-Service
parent 72bb474604
commit 6c4c4bdea4

View File

@ -3689,7 +3689,7 @@ public final class Util {
*/ */
@EnsuresNonNullIf(result = false, expression = "#1") @EnsuresNonNullIf(result = false, expression = "#1")
public static boolean shouldShowPlayButton(@Nullable Player player) { public static boolean shouldShowPlayButton(@Nullable Player player) {
return shouldShowPlayButton(player, /* playIfSuppressed= */ true); return shouldShowPlayButton(player, /* shouldShowPlayIfSuppressed= */ true);
} }
/** /**
@ -3700,17 +3700,18 @@ public final class Util {
* #handlePauseButtonAction} to handle the interaction with the play or pause button UI element. * #handlePauseButtonAction} to handle the interaction with the play or pause button UI element.
* *
* @param player The {@link Player}. May be {@code null}. * @param player The {@link Player}. May be {@code null}.
* @param playIfSuppressed Whether to show a play button if playback is {@linkplain * @param shouldShowPlayIfSuppressed Whether to show a play button if playback is {@linkplain
* Player#getPlaybackSuppressionReason() suppressed}. * Player#getPlaybackSuppressionReason() suppressed}.
*/ */
@UnstableApi @UnstableApi
@EnsuresNonNullIf(result = false, expression = "#1") @EnsuresNonNullIf(result = false, expression = "#1")
public static boolean shouldShowPlayButton(@Nullable Player player, boolean playIfSuppressed) { public static boolean shouldShowPlayButton(
@Nullable Player player, boolean shouldShowPlayIfSuppressed) {
return player == null return player == null
|| !player.getPlayWhenReady() || !player.getPlayWhenReady()
|| player.getPlaybackState() == Player.STATE_IDLE || player.getPlaybackState() == Player.STATE_IDLE
|| player.getPlaybackState() == Player.STATE_ENDED || player.getPlaybackState() == Player.STATE_ENDED
|| (playIfSuppressed || (shouldShowPlayIfSuppressed
&& player.getPlaybackSuppressionReason() != Player.PLAYBACK_SUPPRESSION_REASON_NONE); && player.getPlaybackSuppressionReason() != Player.PLAYBACK_SUPPRESSION_REASON_NONE);
} }