Fix #10437
This commit is contained in:
parent
39bff12057
commit
2fb22fbf2f
8 changed files with 21 additions and 3 deletions
|
@ -63,6 +63,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="0dp">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/content_web_view"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -968,4 +968,16 @@ public class AndroidUtils {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void fixWebViewResetsLocaleToUserDefault(Activity activity) {
|
||||
// issue details: https://issuetracker.google.com/issues/37113860
|
||||
// also see: https://gist.github.com/amake/0ac7724681ac1c178c6f95a5b09f03ce
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplicationContext();
|
||||
app.checkPreferredLocale();
|
||||
activity.getResources().updateConfiguration(
|
||||
new Configuration(app.getResources().getConfiguration()),
|
||||
activity.getResources().getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import android.app.Activity;
|
||||
|
@ -14,6 +15,7 @@ public class ExitActivity extends Activity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.help_activity);
|
||||
AndroidUtils.fixWebViewResetsLocaleToUserDefault(this);
|
||||
dis = getIntent().getBooleanExtra(DISABLE_SERVICE, true);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package net.osmand.plus.activities;
|
||||
|
||||
import android.view.Window;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import android.annotation.SuppressLint;
|
||||
|
@ -43,6 +43,7 @@ public class PrintDialogActivity extends ActionBarProgressActivity {
|
|||
getSupportActionBar().setTitle(R.string.print_route);
|
||||
|
||||
setContentView(R.layout.print_dialog);
|
||||
AndroidUtils.fixWebViewResetsLocaleToUserDefault(this);
|
||||
webView = (WebView) findViewById(R.id.printDialogWebview);
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
|
|
@ -54,6 +54,7 @@ public class HelpArticleDialogFragment extends DialogFragment {
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.fragment_help_article, container, false);
|
||||
AndroidUtils.fixWebViewResetsLocaleToUserDefault(getActivity());
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(AndroidUtils.getNavigationIconResId(getContext()));
|
||||
|
|
|
@ -220,6 +220,7 @@ public class MapillaryImageDialog extends ContextMenuCardDialog {
|
|||
@SuppressLint({"SetJavaScriptEnabled", "AddJavascriptInterface"})
|
||||
private View getWebView() {
|
||||
View view = getMapActivity().getLayoutInflater().inflate(R.layout.mapillary_web_view, null);
|
||||
AndroidUtils.fixWebViewResetsLocaleToUserDefault(getMapActivity());
|
||||
final WebView webView = view.findViewById(R.id.webView);
|
||||
webView.setBackgroundColor(Color.argb(1, 0, 0, 0));
|
||||
final View noInternetView = view.findViewById(R.id.mapillaryNoInternetLayout);
|
||||
|
|
|
@ -17,7 +17,6 @@ import android.view.MotionEvent;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -28,7 +27,6 @@ import androidx.appcompat.widget.PopupMenu;
|
|||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.browser.customtabs.CustomTabsIntent;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.view.MotionEventCompat;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
|
@ -74,6 +72,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View mainView = inflater.inflate(R.layout.wikipedia_dialog_fragment, container, false);
|
||||
AndroidUtils.fixWebViewResetsLocaleToUserDefault(getActivity());
|
||||
|
||||
setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar));
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
|||
}
|
||||
|
||||
final View mainView = inflate(R.layout.fragment_wikivoyage_article_dialog, container);
|
||||
AndroidUtils.fixWebViewResetsLocaleToUserDefault(getActivity());
|
||||
|
||||
setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar));
|
||||
|
||||
|
|
Loading…
Reference in a new issue