mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Prevent using view state and use state saved in fragment instead.
The system may destroy views at any time and may not have created the view at all. Use the state saved in the fragment to be independant of the existance of the view. PiperOrigin-RevId: 234156285
This commit is contained in:
parent
c6195dbbaf
commit
cedfa19988
1 changed files with 10 additions and 8 deletions
|
|
@ -145,7 +145,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||
*/
|
||||
public boolean getIsDisabled(int rendererIndex) {
|
||||
TrackSelectionViewFragment rendererView = tabFragments.get(rendererIndex);
|
||||
return rendererView != null && rendererView.trackSelectionView.getIsDisabled();
|
||||
return rendererView != null && rendererView.isDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -157,9 +157,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||
*/
|
||||
public List<SelectionOverride> getOverrides(int rendererIndex) {
|
||||
TrackSelectionViewFragment rendererView = tabFragments.get(rendererIndex);
|
||||
return rendererView == null
|
||||
? Collections.emptyList()
|
||||
: rendererView.trackSelectionView.getOverrides();
|
||||
return rendererView == null ? Collections.emptyList() : rendererView.overrides;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -269,10 +267,13 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||
private boolean allowAdaptiveSelections;
|
||||
private boolean allowMultipleOverrides;
|
||||
|
||||
private boolean isDisabled;
|
||||
private List<SelectionOverride> overrides;
|
||||
/* package */ boolean isDisabled;
|
||||
/* package */ List<SelectionOverride> overrides;
|
||||
|
||||
/* package */ TrackSelectionView trackSelectionView;
|
||||
public TrackSelectionViewFragment() {
|
||||
// Retain instance across orientation changes to prevent loosing access to init data.
|
||||
setRetainInstance(true);
|
||||
}
|
||||
|
||||
public void init(
|
||||
MappedTrackInfo mappedTrackInfo,
|
||||
|
|
@ -301,7 +302,8 @@ public final class TrackSelectionDialog extends DialogFragment {
|
|||
View rootView =
|
||||
inflater.inflate(
|
||||
R.layout.track_selection_dialog_tab, container, /* attachToRoot= */ false);
|
||||
trackSelectionView = rootView.findViewById(R.id.download_dialog_track_selection_view);
|
||||
TrackSelectionView trackSelectionView =
|
||||
rootView.findViewById(R.id.download_dialog_track_selection_view);
|
||||
trackSelectionView.setShowDisableOption(true);
|
||||
trackSelectionView.setAllowMultipleOverrides(allowMultipleOverrides);
|
||||
trackSelectionView.setAllowAdaptiveSelections(allowAdaptiveSelections);
|
||||
|
|
|
|||
Loading…
Reference in a new issue