2
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-08-21 17:47:50 +00:00

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.
This commit is contained in:
Stypox 2025-07-28 15:29:06 +02:00
parent 893a1cb699
commit eea2b7417e
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -54,7 +54,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
final Intent intent = new Intent(Settings.ACTION_APP_LOCALE_SETTINGS)
.setData(Uri.fromParts("package", requireContext().getPackageName(), null));
startActivity(intent);
PlayerHelper.resetFormat();
return true;
});
newAppLanguagePref.setVisible(true);
@ -66,7 +65,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
final String systemLang = getString(R.string.default_localization_key);
final String tag = systemLang.equals(language) ? null : language;
AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(tag));
PlayerHelper.resetFormat();
return true;
});
}
@ -110,5 +108,6 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
NewPipe.setupLocalization(
Localization.getPreferredLocalization(context),
Localization.getPreferredContentCountry(context));
PlayerHelper.resetFormat();
}
}