Respect the deprecation of updateConfiguration

This commit is contained in:
goapunk
2018-09-19 18:25:40 +02:00
committed by akwizgran
parent 40e14d3e94
commit 4415598d3d

View File

@@ -72,13 +72,6 @@ public class Localizer {
public Context setLocale(Context context) {
Resources res = context.getResources();
Configuration conf = res.getConfiguration();
Locale currentLocale;
if (SDK_INT >= 24) {
currentLocale = conf.getLocales().get(0);
} else
currentLocale = conf.locale;
if (locale.equals(currentLocale))
return context;
Locale.setDefault(locale);
updateConfiguration(conf, locale);
Configuration systemConfiguration =
@@ -89,7 +82,7 @@ public class Localizer {
Resources.getSystem().updateConfiguration(systemConfiguration,
Resources.getSystem().getDisplayMetrics());
if (SDK_INT >= 17)
context.createConfigurationContext(conf);
return context.createConfigurationContext(conf);
//noinspection deprecation
res.updateConfiguration(conf, res.getDisplayMetrics());
return context;