From 6c4c4bdea4eaecdf493ac2fb4e40c2ca87b05caf Mon Sep 17 00:00:00 2001 From: ibaker Date: Fri, 4 Apr 2025 05:39:13 -0700 Subject: [PATCH] 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 --- .../src/main/java/androidx/media3/common/util/Util.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/common/src/main/java/androidx/media3/common/util/Util.java b/libraries/common/src/main/java/androidx/media3/common/util/Util.java index b944af038b..78eb8d213f 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/Util.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/Util.java @@ -3689,7 +3689,7 @@ public final class Util { */ @EnsuresNonNullIf(result = false, expression = "#1") 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. * * @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}. */ @UnstableApi @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 || !player.getPlayWhenReady() || player.getPlaybackState() == Player.STATE_IDLE || player.getPlaybackState() == Player.STATE_ENDED - || (playIfSuppressed + || (shouldShowPlayIfSuppressed && player.getPlaybackSuppressionReason() != Player.PLAYBACK_SUPPRESSION_REASON_NONE); }