mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
Add dummy webview creation before setting locale
This commit is contained in:
parent
308a7e5f67
commit
5d375bf4a4
@ -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) {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user