Disables play/pause button when there's nothing to play
PiperOrigin-RevId: 502571320
This commit is contained in:
parent
39f4a17ad4
commit
d49a16e094
@ -980,6 +980,9 @@ public class PlayerControlView extends FrameLayout {
|
|||||||
((ImageView) playPauseButton)
|
((ImageView) playPauseButton)
|
||||||
.setImageDrawable(getDrawable(getContext(), resources, drawableRes));
|
.setImageDrawable(getDrawable(getContext(), resources, drawableRes));
|
||||||
playPauseButton.setContentDescription(resources.getString(stringRes));
|
playPauseButton.setContentDescription(resources.getString(stringRes));
|
||||||
|
|
||||||
|
boolean enablePlayPause = shouldEnablePlayPauseButton();
|
||||||
|
updateButton(enablePlayPause, playPauseButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1497,6 +1500,10 @@ public class PlayerControlView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldEnablePlayPauseButton() {
|
||||||
|
return player != null && !player.getCurrentTimeline().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean shouldShowPauseButton() {
|
private boolean shouldShowPauseButton() {
|
||||||
return player != null
|
return player != null
|
||||||
&& player.getPlaybackState() != Player.STATE_ENDED
|
&& player.getPlaybackState() != Player.STATE_ENDED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user