mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Review: Update according to review
This commit is contained in:
parent
425bd2d801
commit
ed58280d23
2 changed files with 5 additions and 7 deletions
|
|
@ -62,7 +62,7 @@ public final class TrackSelectionDialogBuilder {
|
|||
@Nullable private TrackNameProvider trackNameProvider;
|
||||
private boolean isDisabled;
|
||||
private List<SelectionOverride> overrides;
|
||||
private Comparator<Format> comparator;
|
||||
@Nullable private Comparator<Format> comparator;
|
||||
|
||||
/**
|
||||
* Creates a builder for a track selection dialog.
|
||||
|
|
@ -199,9 +199,7 @@ public final class TrackSelectionDialogBuilder {
|
|||
}
|
||||
|
||||
public void setComparator(Comparator<Format> comparator) {
|
||||
if(this.comparator != comparator) {
|
||||
this.comparator = comparator;
|
||||
}
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ public class TrackSelectionView extends LinearLayout {
|
|||
* one override for each track group. If {@link #setAllowMultipleOverrides(boolean)} hasn't
|
||||
* been set to {@code true}, only the first override is used.
|
||||
* @param listener An optional listener for track selection updates.
|
||||
* @param comparator An optional comparator to order track selection
|
||||
*/
|
||||
public void init(
|
||||
MappedTrackInfo mappedTrackInfo,
|
||||
|
|
@ -258,7 +259,7 @@ public class TrackSelectionView extends LinearLayout {
|
|||
defaultView.setEnabled(true);
|
||||
|
||||
trackGroups = mappedTrackInfo.getTrackGroups(rendererIndex);
|
||||
sortedTrackGroups = sortedTrackGroups != null ? sortedTrackGroups : initSortedTrackGroups(trackGroups);
|
||||
sortedTrackGroups = initSortedTrackGroups(trackGroups);
|
||||
|
||||
// Add per-track views.
|
||||
trackViews = new CheckedTextView[sortedTrackGroups.length][];
|
||||
|
|
@ -411,9 +412,8 @@ public class TrackSelectionView extends LinearLayout {
|
|||
int sortedTrackIndex = trackIndex;
|
||||
if(sortedTrackGroups != trackGroups) {
|
||||
Format selectedFormat = sortedTrackGroups.get(rendererIndex).getFormat(trackIndex);
|
||||
int trackHash = selectedFormat.hashCode();
|
||||
for (int formatIndex = 0; formatIndex < trackGroups.get(groupIndex).length; formatIndex++) {
|
||||
if(trackGroups.get(groupIndex).getFormat(formatIndex).hashCode() == trackHash) {
|
||||
if(trackGroups.get(groupIndex).getFormat(formatIndex) == selectedFormat) {
|
||||
sortedTrackIndex = formatIndex;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue