Execute scripts when not removing tracking

This commit is contained in:
M66B
2019-03-11 08:02:26 +00:00
parent 03a54f6453
commit 432fb7739d
3 changed files with 24 additions and 2 deletions

View File

@@ -71,6 +71,7 @@ import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -1408,8 +1409,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibImages.setVisibility(View.GONE);
tvBody.setVisibility(View.GONE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean remove_tracking = prefs.getBoolean("remove_tracking", true);
// For performance reasons the WebView is created when needed only
if (!(vwBody instanceof WebView)) {
// For performance reasons the WebView is created when needed only
WebView webView = new WebView(context) {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -1448,6 +1452,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
});
if (!remove_tracking)
webView.setWebChromeClient(new WebChromeClient());
webView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(
String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {