Add dummy webview creation before setting locale

This commit is contained in:
mhutti1 2018-05-20 17:39:34 +01:00 committed by Isaac Hutt
parent 308a7e5f67
commit 5d375bf4a4
2 changed files with 6 additions and 2 deletions

View File

@ -352,6 +352,9 @@ public class KiwixMobileActivity extends BaseActivity implements WebViewCallback
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
super.onCreate(savedInstanceState);
new WebView(this).destroy(); // Workaround for buggy webviews see #710
wifiOnly = sharedPreferenceUtil.getPrefWifiOnly();
nightMode = KiwixSettingsActivity.nightMode(sharedPreferenceUtil);
if (nightMode) {

View File

@ -79,9 +79,11 @@ public class LanguageUtils {
Locale locale = new Locale(language);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
if (Build.VERSION.SDK_INT >= 17) {
config.setLocale(locale);
config.setLayoutDirection(locale);
} else {
config.locale = locale;
}
context.getResources()
.updateConfiguration(config, context.getResources().getDisplayMetrics());
@ -108,7 +110,6 @@ public class LanguageUtils {
return mLocaleMap.get(iso3.toUpperCase());
}
@TargetApi(Build.VERSION_CODES.N)
public static Locale getCurrentLocale(Context context){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
return context.getResources().getConfiguration().getLocales().get(0);