mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 22:29:53 +01:00
Respect the deprecation of updateConfiguration
This commit is contained in:
@@ -72,13 +72,6 @@ public class Localizer {
|
|||||||
public Context setLocale(Context context) {
|
public Context setLocale(Context context) {
|
||||||
Resources res = context.getResources();
|
Resources res = context.getResources();
|
||||||
Configuration conf = res.getConfiguration();
|
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);
|
Locale.setDefault(locale);
|
||||||
updateConfiguration(conf, locale);
|
updateConfiguration(conf, locale);
|
||||||
Configuration systemConfiguration =
|
Configuration systemConfiguration =
|
||||||
@@ -89,7 +82,7 @@ public class Localizer {
|
|||||||
Resources.getSystem().updateConfiguration(systemConfiguration,
|
Resources.getSystem().updateConfiguration(systemConfiguration,
|
||||||
Resources.getSystem().getDisplayMetrics());
|
Resources.getSystem().getDisplayMetrics());
|
||||||
if (SDK_INT >= 17)
|
if (SDK_INT >= 17)
|
||||||
context.createConfigurationContext(conf);
|
return context.createConfigurationContext(conf);
|
||||||
//noinspection deprecation
|
//noinspection deprecation
|
||||||
res.updateConfiguration(conf, res.getDisplayMetrics());
|
res.updateConfiguration(conf, res.getDisplayMetrics());
|
||||||
return context;
|
return context;
|
||||||
|
|||||||
Reference in New Issue
Block a user