Disable the language/role flag preferences when selecting "none"

Just clearing the overrides only helps if a text override was
previously set. If the text is shown because of app defined track
selection parameters for language or role flags, the "none" button is
currently not working and we need to clear these flags explicitly.

PiperOrigin-RevId: 682373821
This commit is contained in:
tonihei 2024-10-04 10:39:54 -07:00 committed by Copybara-Service
parent 47021c8777
commit af6ad43ca0
2 changed files with 6 additions and 1 deletions

View File

@ -116,6 +116,8 @@
to a click interaction
([#1590](https://github.com/androidx/media/issues/1590),
[#184](https://github.com/androidx/media/issues/184)).
* Fix bug where the "None" choice in the text selection is not working if
there are app-defined text track selection preferences.
* Downloads:
* OkHttp Extension:
* Cronet Extension:

View File

@ -2136,7 +2136,8 @@ public class PlayerControlView extends FrameLayout {
@Override
public void onBindViewHolderAtZeroPosition(SubSettingViewHolder holder) {
// CC options include "Off" at the first position, which disables text rendering.
// CC options include "None" at the zero position, which disables text rendering except for
// forced text tracks that can't be disabled (and are also not shown in the selection list).
holder.textView.setText(R.string.exo_track_selection_none);
boolean isTrackSelectionOff = true;
for (int i = 0; i < tracks.size(); i++) {
@ -2157,6 +2158,8 @@ public class PlayerControlView extends FrameLayout {
.buildUpon()
.clearOverridesOfType(C.TRACK_TYPE_TEXT)
.setIgnoredTextSelectionFlags(~C.SELECTION_FLAG_FORCED)
.setPreferredTextLanguage(null)
.setPreferredTextRoleFlags(0)
.build());
settingsWindow.dismiss();
}