From 3108c903dd043de3a9d7fc4ac17bb8591d05b361 Mon Sep 17 00:00:00 2001 From: Robin Date: Sun, 24 Nov 2019 16:24:39 +0100 Subject: [PATCH] squashed commit --- .../java/org/schabi/newpipe/player/VideoPlayer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java index a92ab410e..0734139e1 100644 --- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java @@ -290,8 +290,13 @@ public abstract class VideoPlayer extends BasePlayer String userPreferredLanguage = PreferenceManager.getDefaultSharedPreferences(context) .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("("); // Add option for turning off caption @@ -326,7 +331,7 @@ public abstract class VideoPlayer extends BasePlayer return true; }); // apply caption language from previous user preference - if(userPreferredLanguage != null && (captionLanguage.equals(userPreferredLanguage) || + if (userPreferredLanguage != null && (captionLanguage.equals(userPreferredLanguage) || searchForAutogenerated && captionLanguage.startsWith(userPreferredLanguage) || userPreferredLanguage.contains("(") && captionLanguage.startsWith(userPreferredLanguage.substring(0,