mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 14:11:00 +00:00
Prevent crash
This commit is contained in:
parent
7618dd949f
commit
86615c4a2d
1 changed files with 18 additions and 15 deletions
|
@ -64,21 +64,24 @@ public class ApplicationEx extends Application
|
||||||
.commit(); // apply won't work here
|
.commit(); // apply won't work here
|
||||||
}
|
}
|
||||||
|
|
||||||
String tag = Locale.getDefault().toLanguageTag();
|
try {
|
||||||
if (!("de-AT".equals(tag) || "de-LI".equals(tag)))
|
String language = prefs.getString("language", null);
|
||||||
tag = null;
|
if (language != null) {
|
||||||
String language = prefs.getString("language", tag);
|
if ("de-AT".equals(language) || "de-LI".equals(language))
|
||||||
if (language != null) {
|
language = "de-DE";
|
||||||
if ("de-AT".equals(language) || "de-LI".equals(language))
|
Locale locale = Locale.forLanguageTag(language);
|
||||||
language = "de-DE";
|
Log.i("Set language=" + language + " locale=" + locale);
|
||||||
Locale locale = Locale.forLanguageTag(language);
|
Locale.setDefault(locale);
|
||||||
EntityLog.log(context, "Set language=" + language + " locale=" + locale);
|
Configuration config;
|
||||||
Locale.setDefault(locale);
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
|
||||||
Configuration config = new Configuration();
|
config = new Configuration(context.getResources().getConfiguration());
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
|
else
|
||||||
config.setTo(context.getResources().getConfiguration());
|
config = new Configuration();
|
||||||
config.setLocale(locale);
|
config.setLocale(locale);
|
||||||
return context.createConfigurationContext(config);
|
return context.createConfigurationContext(config);
|
||||||
|
}
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
|
|
Loading…
Reference in a new issue