1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 09:52:16 -05:00

Add activity flags to browser view intent

This commit is contained in:
cketti 2015-04-04 01:06:14 +02:00
parent ba8cb6c85d
commit babd3a530f

View File

@ -60,6 +60,7 @@ public abstract class K9WebViewClient extends WebViewClient {
Context context = webView.getContext();
Intent intent = createBrowserViewIntent(uri, context);
addActivityFlags(intent);
boolean overridingUrlLoading = false;
try {
@ -80,6 +81,8 @@ public abstract class K9WebViewClient extends WebViewClient {
return intent;
}
protected abstract void addActivityFlags(Intent intent);
protected WebResourceResponse shouldInterceptRequest(WebView webView, Uri uri) {
if (!CID_SCHEME.equals(uri.getScheme())) {
return RESULT_DO_NOT_INTERCEPT;
@ -131,16 +134,21 @@ public abstract class K9WebViewClient extends WebViewClient {
}
@SuppressWarnings("deprecation")
private static class PreLollipopWebViewClient extends K9WebViewClient {
protected PreLollipopWebViewClient(Part part) {
super(part);
}
@SuppressWarnings("deprecation")
@Override
public WebResourceResponse shouldInterceptRequest(WebView webView, String url) {
return shouldInterceptRequest(webView, Uri.parse(url));
}
@Override
protected void addActivityFlags(Intent intent) {
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
}
}
@TargetApi(VERSION_CODES.LOLLIPOP)
@ -153,5 +161,10 @@ public abstract class K9WebViewClient extends WebViewClient {
public WebResourceResponse shouldInterceptRequest(WebView webView, WebResourceRequest request) {
return shouldInterceptRequest(webView, request.getUrl());
}
@Override
protected void addActivityFlags(Intent intent) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
}
}
}