mirror of
https://github.com/androidx/media.git
synced 2025-05-04 06:00:37 +08:00
Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320 (cherry picked from commit 345f2345c74ccbbf3dd49f125b1b81938b0a9995)
This commit is contained in:
parent
4b3c74fb37
commit
cebc0fa374
@ -986,6 +986,9 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||
((ImageView) playPauseButton)
|
||||
.setImageDrawable(getDrawable(getContext(), resources, drawableRes));
|
||||
playPauseButton.setContentDescription(resources.getString(stringRes));
|
||||
|
||||
boolean enablePlayPause = shouldEnablePlayPauseButton();
|
||||
updateButton(enablePlayPause, playPauseButton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1503,6 +1506,10 @@ public class StyledPlayerControlView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldEnablePlayPauseButton() {
|
||||
return player != null && !player.getCurrentTimeline().isEmpty();
|
||||
}
|
||||
|
||||
private boolean shouldShowPauseButton() {
|
||||
return player != null
|
||||
&& player.getPlaybackState() != Player.STATE_ENDED
|
||||
|
Loading…
x
Reference in New Issue
Block a user