squashed commit

This commit is contained in:
Robin 2019-11-24 16:24:39 +01:00
parent 8e152df46d
commit 3108c903dd
1 changed files with 8 additions and 3 deletions

View File

@ -290,8 +290,13 @@ public abstract class VideoPlayer extends BasePlayer
String userPreferredLanguage = PreferenceManager.getDefaultSharedPreferences(context) String userPreferredLanguage = PreferenceManager.getDefaultSharedPreferences(context)
.getString(context.getString(R.string.caption_user_set_key), null); .getString(context.getString(R.string.caption_user_set_key), null);
// english (auto-generated) /*
boolean searchForAutogenerated = userPreferredLanguage == null || * only search for autogenerated cc as fallback
* if "(auto-generated)" was not already selected
* we are only looking for "(" instead of "(auto-generated)" to hopefully get all
* internationalized variants such as "(automatisch-erzeugt)" and so on
*/
boolean searchForAutogenerated = userPreferredLanguage != null &&
!userPreferredLanguage.contains("("); !userPreferredLanguage.contains("(");
// Add option for turning off caption // Add option for turning off caption
@ -326,7 +331,7 @@ public abstract class VideoPlayer extends BasePlayer
return true; return true;
}); });
// apply caption language from previous user preference // apply caption language from previous user preference
if(userPreferredLanguage != null && (captionLanguage.equals(userPreferredLanguage) || if (userPreferredLanguage != null && (captionLanguage.equals(userPreferredLanguage) ||
searchForAutogenerated && captionLanguage.startsWith(userPreferredLanguage) || searchForAutogenerated && captionLanguage.startsWith(userPreferredLanguage) ||
userPreferredLanguage.contains("(") && userPreferredLanguage.contains("(") &&
captionLanguage.startsWith(userPreferredLanguage.substring(0, captionLanguage.startsWith(userPreferredLanguage.substring(0,