Never open external links in our WebView
This commit is contained in:
parent
79c06745fb
commit
67e2029d56
1 changed files with 4 additions and 4 deletions
|
@ -16,9 +16,11 @@ import android.webkit.WebResourceRequest;
|
|||
import android.webkit.WebResourceResponse;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.fsck.k9.mailstore.AttachmentResolver;
|
||||
import com.fsck.k9.ui.R;
|
||||
import com.fsck.k9.view.MessageWebView.OnPageFinishedListener;
|
||||
import timber.log.Timber;
|
||||
|
||||
|
@ -56,15 +58,13 @@ public class K9WebViewClient extends WebViewClient {
|
|||
Context context = webView.getContext();
|
||||
Intent intent = createBrowserViewIntent(uri, context);
|
||||
|
||||
boolean overridingUrlLoading = false;
|
||||
try {
|
||||
context.startActivity(intent);
|
||||
overridingUrlLoading = true;
|
||||
} catch (ActivityNotFoundException ex) {
|
||||
// If no application can handle the URL, assume that the WebView can handle it.
|
||||
Toast.makeText(context, R.string.error_activity_not_found, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
return overridingUrlLoading;
|
||||
return true;
|
||||
}
|
||||
|
||||
private Intent createBrowserViewIntent(Uri uri, Context context) {
|
||||
|
|
Loading…
Reference in a new issue