Encapsulate Formatters in PlayerHelper

and reset them when the language is changed/changing.
This way they will be re-initialized on the next call.

Also Remove a bunch of outdated/non-thread safe code (STRING_FORMATTER)
This commit is contained in:
litetex 2025-07-26 16:06:44 +02:00 committed by Stypox
parent ebd5e1a318
commit 893a1cb699
No known key found for this signature in database
GPG key ID: 4BDF1B40A49FDD23
2 changed files with 57 additions and 17 deletions

View file

@ -16,6 +16,7 @@ import androidx.preference.Preference;
import org.schabi.newpipe.DownloaderImpl;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.player.helper.PlayerHelper;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.image.ImageStrategy;
import org.schabi.newpipe.util.image.PicassoHelper;
@ -53,6 +54,7 @@ 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);
@ -64,6 +66,7 @@ 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;
});
}