Ensure TalkBack announces the selected playback speed in the UI menu

Issue: google/ExoPlayer#10298
#minor-release
PiperOrigin-RevId: 457991028
(cherry picked from commit bf86b603a30211ec2b48a78223683f758e6d5f83)
This commit is contained in:
ibaker 2022-06-29 16:10:11 +00:00 committed by Rohit Singh
parent d3b5f71f25
commit 315bf6b898

View File

@ -1817,7 +1817,13 @@ public class StyledPlayerControlView extends FrameLayout {
if (position < playbackSpeedTexts.length) {
holder.textView.setText(playbackSpeedTexts[position]);
}
holder.checkView.setVisibility(position == selectedIndex ? VISIBLE : INVISIBLE);
if (position == selectedIndex) {
holder.itemView.setSelected(true);
holder.checkView.setVisibility(VISIBLE);
} else {
holder.itemView.setSelected(false);
holder.checkView.setVisibility(INVISIBLE);
}
holder.itemView.setOnClickListener(
v -> {
if (position != selectedIndex) {