Include a high-resolution option in the default resolution settings.
This commit is contained in:
parent
b1ab261890
commit
d1a82a85cd
4 changed files with 108 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import static org.schabi.newpipe.extractor.ServiceList.YouTube;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.net.ConnectivityManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
|
@ -239,6 +240,30 @@ public final class ListHelper {
|
|||
videoOnlyStreams, ascendingOrder, preferVideoOnlyStreams);
|
||||
}
|
||||
|
||||
public static List<String> getSortedResolutionList(
|
||||
final Resources resources,
|
||||
final int defaultResolutionKey,
|
||||
final int additionalResolutionKey,
|
||||
final boolean showHigherResolutions) {
|
||||
final List<String> defaultResolution = new ArrayList<String>(Arrays.asList(
|
||||
resources.getStringArray(defaultResolutionKey)));
|
||||
if (!showHigherResolutions) {
|
||||
return defaultResolution;
|
||||
}
|
||||
final List<String> additionalResolutions = Arrays.asList(
|
||||
resources.getStringArray(additionalResolutionKey));
|
||||
defaultResolution.addAll(1, additionalResolutions);
|
||||
return defaultResolution;
|
||||
}
|
||||
|
||||
public static boolean isHighResolutionSelected(final String selectedResolution,
|
||||
final int additionalResolutionKey,
|
||||
final Resources resources) {
|
||||
return Arrays.asList(resources.getStringArray(
|
||||
additionalResolutionKey))
|
||||
.contains(selectedResolution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the list of audio streams and return a list with the preferred stream for
|
||||
* each audio track. Streams are sorted with the preferred language in the first position.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue