This commit is contained in:
M66B 2019-01-27 18:43:27 +00:00
parent 83931fabec
commit be6a725713
1 changed files with 3 additions and 12 deletions

View File

@ -21,11 +21,9 @@ package eu.faircode.email;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.util.Base64; import android.util.Base64;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -80,18 +78,11 @@ public class FragmentWebView extends FragmentBase {
settings.setDisplayZoomControls(false); settings.setDisplayZoomControls(false);
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
webview.setWebViewClient(new WebViewClient() { webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (prefs.getBoolean("webview", false)) { if (getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
view.loadUrl(url); Helper.view(getContext(), getViewLifecycleOwner(), Uri.parse(url), true);
setSubtitle(url); return true;
} else {
if (getViewLifecycleOwner().getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
Helper.view(getContext(), getViewLifecycleOwner(), Uri.parse(url), true);
return true;
}
} }
return false; return false;
} }