Skip to content

Commit eea2b74

Browse files
committed
Fix player formatters resetting too early on language change
formatters() is called again by the player before the user has a chance to click on the language in the language chooser. So the correct solution would probably be to attach to https://developer.android.com/reference/android/content/Intent#ACTION_LOCALE_CHANGED, but let's keep it simple. I added `PlayerHelper.resetFormat();` in `ContentSettingsFragment.onDestroy()` and it works. It will mean the player formatters will be reset every time the user exits content settings, but whatever.
1 parent 893a1cb commit eea2b74

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/src/main/java/org/schabi/newpipe/settings/ContentSettingsFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ private void setupAppLanguagePreferences() {
5454
final Intent intent = new Intent(Settings.ACTION_APP_LOCALE_SETTINGS)
5555
.setData(Uri.fromParts("package", requireContext().getPackageName(), null));
5656
startActivity(intent);
57-
PlayerHelper.resetFormat();
5857
return true;
5958
});
6059
newAppLanguagePref.setVisible(true);
@@ -66,7 +65,6 @@ private void setupAppLanguagePreferences() {
6665
final String systemLang = getString(R.string.default_localization_key);
6766
final String tag = systemLang.equals(language) ? null : language;
6867
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(tag));
69-
PlayerHelper.resetFormat();
7068
return true;
7169
});
7270
}
@@ -110,5 +108,6 @@ public void onDestroy() {
110108
NewPipe.setupLocalization(
111109
Localization.getPreferredLocalization(context),
112110
Localization.getPreferredContentCountry(context));
111+
PlayerHelper.resetFormat();
113112
}
114113
}

0 commit comments

Comments
 (0)