mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Don't show track selection tabs if there's only one
PiperOrigin-RevId: 237025639
This commit is contained in:
parent
3500f07be6
commit
a4754bb741
1 changed files with 4 additions and 3 deletions
|
|
@ -58,7 +58,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||||
private DialogInterface.OnDismissListener onDismissListener;
|
private DialogInterface.OnDismissListener onDismissListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and initialized a dialog with a {@link DefaultTrackSelector} and automatically updates
|
* Creates and initializes a dialog with a {@link DefaultTrackSelector} and automatically updates
|
||||||
* the track selector's parameters when tracks are selected.
|
* the track selector's parameters when tracks are selected.
|
||||||
*
|
*
|
||||||
* @param trackSelector A {@link DefaultTrackSelector}.
|
* @param trackSelector A {@link DefaultTrackSelector}.
|
||||||
|
|
@ -104,7 +104,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||||
public TrackSelectionDialog() {
|
public TrackSelectionDialog() {
|
||||||
tabFragments = new SparseArray<>();
|
tabFragments = new SparseArray<>();
|
||||||
tabTitles = new ArrayList<>();
|
tabTitles = new ArrayList<>();
|
||||||
// Retain instance across orientation changes to prevent loosing access to init data.
|
// Retain instance across activity re-creation to prevent losing access to init data.
|
||||||
setRetainInstance(true);
|
setRetainInstance(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,6 +211,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||||
Button okButton = dialogView.findViewById(R.id.track_selection_dialog_ok_button);
|
Button okButton = dialogView.findViewById(R.id.track_selection_dialog_ok_button);
|
||||||
viewPager.setAdapter(new FragmentAdapter(getChildFragmentManager()));
|
viewPager.setAdapter(new FragmentAdapter(getChildFragmentManager()));
|
||||||
tabLayout.setupWithViewPager(viewPager);
|
tabLayout.setupWithViewPager(viewPager);
|
||||||
|
tabLayout.setVisibility(tabFragments.size() > 1 ? View.VISIBLE : View.GONE);
|
||||||
cancelButton.setOnClickListener(view -> dismiss());
|
cancelButton.setOnClickListener(view -> dismiss());
|
||||||
okButton.setOnClickListener(
|
okButton.setOnClickListener(
|
||||||
view -> {
|
view -> {
|
||||||
|
|
@ -271,7 +272,7 @@ public final class TrackSelectionDialog extends DialogFragment {
|
||||||
/* package */ List<SelectionOverride> overrides;
|
/* package */ List<SelectionOverride> overrides;
|
||||||
|
|
||||||
public TrackSelectionViewFragment() {
|
public TrackSelectionViewFragment() {
|
||||||
// Retain instance across orientation changes to prevent loosing access to init data.
|
// Retain instance across activity re-creation to prevent losing access to init data.
|
||||||
setRetainInstance(true);
|
setRetainInstance(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue