- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
162 lines
5.8 KiB
Java
162 lines
5.8 KiB
Java
package com.mbridge.msdk.mbsignalcommon.base;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.webkit.WebSettings;
|
|
import android.webkit.WebView;
|
|
import android.webkit.WebViewClient;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.unity3d.services.core.di.ServiceProvider;
|
|
import java.lang.reflect.Method;
|
|
|
|
@SuppressLint({"NewApi"})
|
|
/* loaded from: classes4.dex */
|
|
public class BaseWebView extends WebView {
|
|
protected Context a;
|
|
private View.OnTouchListener b;
|
|
private View.OnTouchListener c;
|
|
public long lastTouchTime;
|
|
public b mWebViewClient;
|
|
|
|
@Override // android.view.View
|
|
public void setOnTouchListener(View.OnTouchListener onTouchListener) {
|
|
this.b = onTouchListener;
|
|
}
|
|
|
|
public BaseWebView(Context context) {
|
|
super(context);
|
|
this.lastTouchTime = 0L;
|
|
this.c = new View.OnTouchListener() { // from class: com.mbridge.msdk.mbsignalcommon.base.BaseWebView.1
|
|
@Override // android.view.View.OnTouchListener
|
|
public final boolean onTouch(View view, MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() == 0) {
|
|
BaseWebView.this.lastTouchTime = System.currentTimeMillis();
|
|
}
|
|
if (BaseWebView.this.b != null) {
|
|
return BaseWebView.this.b.onTouch(view, motionEvent);
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
this.a = context;
|
|
a();
|
|
}
|
|
|
|
public BaseWebView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.lastTouchTime = 0L;
|
|
this.c = new View.OnTouchListener() { // from class: com.mbridge.msdk.mbsignalcommon.base.BaseWebView.1
|
|
@Override // android.view.View.OnTouchListener
|
|
public final boolean onTouch(View view, MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() == 0) {
|
|
BaseWebView.this.lastTouchTime = System.currentTimeMillis();
|
|
}
|
|
if (BaseWebView.this.b != null) {
|
|
return BaseWebView.this.b.onTouch(view, motionEvent);
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
this.a = context;
|
|
a();
|
|
}
|
|
|
|
public BaseWebView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.lastTouchTime = 0L;
|
|
this.c = new View.OnTouchListener() { // from class: com.mbridge.msdk.mbsignalcommon.base.BaseWebView.1
|
|
@Override // android.view.View.OnTouchListener
|
|
public final boolean onTouch(View view, MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() == 0) {
|
|
BaseWebView.this.lastTouchTime = System.currentTimeMillis();
|
|
}
|
|
if (BaseWebView.this.b != null) {
|
|
return BaseWebView.this.b.onTouch(view, motionEvent);
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
this.a = context;
|
|
a();
|
|
}
|
|
|
|
public void setFilter(a aVar) {
|
|
b bVar = this.mWebViewClient;
|
|
if (bVar == null || !(bVar instanceof b)) {
|
|
return;
|
|
}
|
|
bVar.a(aVar);
|
|
}
|
|
|
|
public void a() {
|
|
if (this.mWebViewClient == null) {
|
|
b bVar = new b();
|
|
this.mWebViewClient = bVar;
|
|
setWebViewClient(bVar);
|
|
}
|
|
setHorizontalScrollBarEnabled(false);
|
|
setVerticalScrollBarEnabled(false);
|
|
WebSettings settings = getSettings();
|
|
settings.setJavaScriptEnabled(true);
|
|
settings.setAppCacheEnabled(true);
|
|
settings.setAppCacheMaxSize(ServiceProvider.HTTP_CACHE_DISK_SIZE);
|
|
settings.setAllowFileAccess(true);
|
|
settings.setBuiltInZoomControls(true);
|
|
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
|
settings.setDomStorageEnabled(true);
|
|
settings.setSupportZoom(false);
|
|
settings.setSavePassword(false);
|
|
settings.setDatabaseEnabled(true);
|
|
settings.setUseWideViewPort(true);
|
|
settings.setLoadWithOverviewMode(true);
|
|
settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
|
|
try {
|
|
settings.setSafeBrowsingEnabled(false);
|
|
} catch (Throwable th) {
|
|
af.b("BaseWebView", th.getMessage());
|
|
}
|
|
settings.setMediaPlaybackRequiresUserGesture(false);
|
|
settings.setAllowFileAccessFromFileURLs(false);
|
|
settings.setAllowUniversalAccessFromFileURLs(false);
|
|
try {
|
|
settings.setMixedContentMode(0);
|
|
} catch (Exception e) {
|
|
af.b("BaseWebView", e.getMessage());
|
|
}
|
|
settings.setDatabaseEnabled(true);
|
|
String path = this.a.getDir("database", 0).getPath();
|
|
settings.setDatabasePath(path);
|
|
settings.setGeolocationEnabled(true);
|
|
settings.setGeolocationDatabasePath(path);
|
|
try {
|
|
Method declaredMethod = WebSettings.class.getDeclaredMethod("setDisplayZoomControls", Boolean.TYPE);
|
|
declaredMethod.setAccessible(true);
|
|
declaredMethod.invoke(settings, Boolean.FALSE);
|
|
} catch (Exception e2) {
|
|
af.b("BaseWebView", e2.getMessage());
|
|
}
|
|
super.setOnTouchListener(this.c);
|
|
}
|
|
|
|
public void setTransparent() {
|
|
setLayerType(1, null);
|
|
setBackgroundColor(0);
|
|
}
|
|
|
|
@Override // android.webkit.WebView
|
|
public void reload() {
|
|
super.reload();
|
|
}
|
|
|
|
@Override // android.webkit.WebView
|
|
public void setWebViewClient(WebViewClient webViewClient) {
|
|
super.setWebViewClient(webViewClient);
|
|
if (webViewClient instanceof b) {
|
|
this.mWebViewClient = (b) webViewClient;
|
|
}
|
|
}
|
|
}
|