1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-11-11 20:53:01 +00:00

and more fixes

* fix content length reading
* use float overflow. Expensive, double is used instead
* fix invalid cast after click the mission body
* use a list for maximum attemps (downloads)
* minor clean up (DownloadManager.java)
* dont pass SharedPreferences instace to DownloadManager
* use a switch instead of checkbox for cross_network_downloads
* notify media scanner after deleting a finished download
This commit is contained in:
kapodamy
2018-11-24 00:14:37 -03:00
parent d647555e3a
commit f3d4d4747a
12 changed files with 111 additions and 52 deletions

View File

@@ -404,11 +404,26 @@ public class DownloadDialog extends DialogFragment implements RadioGroup.OnCheck
private int getSubtitleIndexBy(List<SubtitlesStream> streams) {
Localization loc = NewPipe.getPreferredLocalization();
for (int i = 0; i < streams.size(); i++) {
Locale streamLocale = streams.get(i).getLocale();
String tag = streamLocale.getLanguage().concat("-").concat(streamLocale.getCountry());
if (tag.equalsIgnoreCase(loc.getLanguage())) {
return i;
}
}
// fallback
// 1st loop match country & language
// 2nd loop match language only
String lang = loc.getLanguage().substring(0, loc.getLanguage().indexOf("-"));
for (int j = 0; j < 2; j++) {
for (int i = 0; i < streams.size(); i++) {
Locale streamLocale = streams.get(i).getLocale();
if (streamLocale.getLanguage().equals(loc.getLanguage())) {
if (j > 0 || streamLocale.getCountry().equals(loc.getCountry())) {
if (streamLocale.getLanguage().equalsIgnoreCase(lang)) {
if (j > 0 || streamLocale.getCountry().equalsIgnoreCase(loc.getCountry())) {
return i;
}
}