Spermatid v6.1.8版本的 MD5 值为:a375ce51a42d528ba6e2583c10478296
以下内容为反编译后的 X5WebView.java 源代码,内容仅作参考
package com.maoyanym.views;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import com.maoyanym.utils.p;
import com.maoyanym.views.CommonWebView;
import com.tencent.smtt.export.external.extension.interfaces.IX5WebViewExtension;
import com.tencent.smtt.export.external.interfaces.SslError;
import com.tencent.smtt.export.external.interfaces.SslErrorHandler;
import com.tencent.smtt.sdk.CookieManager;
import com.tencent.smtt.sdk.CookieSyncManager;
import com.tencent.smtt.sdk.DownloadListener;
import com.tencent.smtt.sdk.QbSdk;
import com.tencent.smtt.sdk.WebBackForwardList;
import com.tencent.smtt.sdk.WebChromeClient;
import com.tencent.smtt.sdk.WebHistoryItem;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebStorage;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
import java.util.Map;
public class X5WebView extends WebView implements DownloadListener {
private CommonWebView.a2 f18308a;
private CommonWebView.y1 f18309b;
private CommonWebView f18310c;
private boolean f18311d;
private float f18312e;
private boolean f18313f;
public class a extends WebViewClient {
public final CommonWebView f18314a;
public a(CommonWebView commonWebView) {
this.f18314a = commonWebView;
}
public void onPageFinished(WebView webView, String str) {
if (X5WebView.this.f18308a != null) {
X5WebView.this.f18308a.a(this.f18314a, str);
}
super.onPageFinished(webView, str);
}
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
if (X5WebView.this.f18308a != null) {
X5WebView.this.f18308a.a(this.f18314a, str, bitmap);
}
super.onPageStarted(webView, str, bitmap);
}
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
if (X5WebView.this.f18308a != null) {
X5WebView.this.f18308a.a(this.f18314a, new f(sslErrorHandler), new e(sslError));
} else {
super.onReceivedSslError(webView, sslErrorHandler, sslError);
}
}
public void onScaleChanged(WebView webView, float f10, float f11) {
X5WebView.this.f18312e = f11;
}
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
if (X5WebView.this.f18308a == null || !X5WebView.this.f18308a.b(this.f18314a, str)) {
return super.shouldOverrideUrlLoading(webView, str);
}
return true;
}
}
public class b extends WebChromeClient {
public final CommonWebView f18316a;
public b(CommonWebView commonWebView) {
this.f18316a = commonWebView;
}
public void onProgressChanged(WebView webView, int i10) {
if (X5WebView.this.f18309b != null) {
X5WebView.this.f18309b.a(this.f18316a, i10);
}
}
public void onReceivedTitle(WebView webView, String str) {
if (X5WebView.this.f18309b != null) {
X5WebView.this.f18309b.a(this.f18316a, str);
}
}
}
public class c extends WebViewClient {
public final X5WebView f18318a;
public c(X5WebView x5WebView) {
this.f18318a = x5WebView;
}
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
try {
String cookie = CookieManager.getInstance().getCookie("http://boardy.huanqiu.com");
CookieManager.getInstance().removeAllCookie();
CookieManager.getInstance().removeSessionCookie();
if (p.c(cookie)) {
for (String str2 : cookie.split(";")) {
String trim = str2.trim();
String[] split = trim.split("=");
if (split.length > 1) {
String trim2 = split[0].trim();
if (!trim2.startsWith("smuc") && !trim2.startsWith("smub")) {
CookieManager.getInstance().setCookie("http://boardy.huanqiu.com", trim);
}
this.f18318a.loadUrl("javascript:localStorage.removeItem('" + trim2 + "')");
}
}
}
} catch (Exception e10) {
e10.printStackTrace();
}
X5WebView.this.reload();
}
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
webView.loadUrl(str);
return true;
}
}
public class d extends WebViewClient {
public final X5WebView f18320a;
public final String f18321b;
public d(X5WebView x5WebView, String str) {
this.f18320a = x5WebView;
this.f18321b = str;
}
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
try {
CookieSyncManager.createInstance(com.maoyanym.b.a.j());
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= 21) {
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
cookieManager.flush();
} else {
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
CookieSyncManager.getInstance().sync();
}
this.f18320a.loadUrl("javascript:localStorage.clear()");
X5WebView.this.loadUrl("javascript:" + this.f18321b + "()");
} catch (Exception e10) {
e10.printStackTrace();
}
}
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
webView.loadUrl(str);
return true;
}
}
public static class e implements CommonWebView.v1 {
private SslError f18323a;
public e(SslError sslError) {
this.f18323a = sslError;
}
@Override
public String a() {
SslError sslError = this.f18323a;
return sslError != null ? sslError.getUrl() : "";
}
@Override
public int b() {
SslError sslError = this.f18323a;
if (sslError != null) {
return sslError.getPrimaryError();
}
return -1;
}
}
public static class f implements CommonWebView.w1 {
private SslErrorHandler f18324a;
public f(SslErrorHandler sslErrorHandler) {
this.f18324a = sslErrorHandler;
}
@Override
public void a() {
SslErrorHandler sslErrorHandler = this.f18324a;
if (sslErrorHandler != null) {
sslErrorHandler.cancel();
}
}
@Override
public void b() {
SslErrorHandler sslErrorHandler = this.f18324a;
if (sslErrorHandler != null) {
sslErrorHandler.proceed();
}
}
}
public static class g implements CommonWebView.x1 {
private WebBackForwardList f18325a;
public g(WebBackForwardList webBackForwardList) {
this.f18325a = webBackForwardList;
}
@Override
public int a() {
WebBackForwardList webBackForwardList = this.f18325a;
if (webBackForwardList != null) {
return webBackForwardList.getCurrentIndex();
}
return 0;
}
@Override
public CommonWebView.z1 a(int i10) {
WebBackForwardList webBackForwardList = this.f18325a;
if (webBackForwardList == null || i10 < 0 || i10 >= webBackForwardList.getSize()) {
return null;
}
return new h(this.f18325a.getItemAtIndex(i10));
}
}
public static class h implements CommonWebView.z1 {
private WebHistoryItem f18326a;
public h(WebHistoryItem webHistoryItem) {
this.f18326a = webHistoryItem;
}
@Override
public String a() {
WebHistoryItem webHistoryItem = this.f18326a;
if (webHistoryItem != null) {
return webHistoryItem.getUrl();
}
return null;
}
@Override
public String b() {
WebHistoryItem webHistoryItem = this.f18326a;
if (webHistoryItem != null) {
return webHistoryItem.getOriginalUrl();
}
return null;
}
}
public X5WebView(Context context) {
super(context);
this.f18311d = true;
this.f18312e = 1.0f;
this.f18313f = false;
}
public X5WebView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.f18311d = true;
this.f18312e = 1.0f;
this.f18313f = false;
}
public X5WebView(Context context, AttributeSet attributeSet, int i10) {
super(context, attributeSet, i10);
this.f18311d = true;
this.f18312e = 1.0f;
this.f18313f = false;
}
public X5WebView(Context context, AttributeSet attributeSet, int i10, Map<String, Object> map, boolean z10) {
super(context, attributeSet, i10, map, z10);
this.f18311d = true;
this.f18312e = 1.0f;
this.f18313f = false;
}
public X5WebView(Context context, AttributeSet attributeSet, int i10, boolean z10) {
super(context, attributeSet, i10, z10);
this.f18311d = true;
this.f18312e = 1.0f;
this.f18313f = false;
}
public X5WebView(Context context, boolean z10) {
super(context, z10);
this.f18311d = true;
this.f18312e = 1.0f;
this.f18313f = false;
}
public void a(CommonWebView commonWebView) {
IX5WebViewExtension x5WebViewExtension = getX5WebViewExtension();
if (x5WebViewExtension != null) {
this.f18313f = true;
try {
if (p.a(com.maoyanym.b.a.f17742p)) {
com.maoyanym.b.a.f17742p = String.valueOf(QbSdk.getTbsSdkVersion());
}
if (p.a(com.maoyanym.b.a.f17743q)) {
com.maoyanym.b.a.f17743q = String.valueOf(QbSdk.getTbsVersion(com.maoyanym.b.a.j()));
}
} catch (Throwable unused) {
}
Log.i("TBS_LOG_TAG", String.format("x5 core loaded, tv=%s, tsv=%s", com.maoyanym.b.a.f17743q, com.maoyanym.b.a.f17742p));
}
this.f18310c = commonWebView;
getSettings().setJavaScriptEnabled(true);
getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
getSettings().setLoadsImagesAutomatically(true);
getSettings().setAllowFileAccess(true);
addJavascriptInterface(commonWebView, "Client");
CookieManager.getInstance().setAcceptCookie(true);
int i10 = Build.VERSION.SDK_INT;
if (i10 >= 21) {
getSettings().setMixedContentMode(0);
CookieManager.getInstance().setAcceptThirdPartyCookies(this, true);
}
getSettings().setUseWideViewPort(true);
getSettings().setLoadWithOverviewMode(true);
getSettings().setSaveFormData(true);
getSettings().setSavePassword(true);
getSettings().setDefaultZoom(WebSettings.ZoomDensity.MEDIUM);
getSettings().setSupportZoom(true);
getSettings().setTextZoom(100);
getSettings().setBuiltInZoomControls(true);
if (i10 >= 11) {
getSettings().setDisplayZoomControls(false);
}
if (i10 > 8) {
getSettings().setPluginState(WebSettings.PluginState.ON_DEMAND);
}
getSettings().setAppCacheEnabled(true);
getSettings().setDatabaseEnabled(true);
getSettings().setDomStorageEnabled(true);
setLongClickable(true);
if (x5WebViewExtension != null) {
x5WebViewExtension.setVerticalScrollBarEnabled(false);
x5WebViewExtension.setHorizontalScrollBarEnabled(false);
} else {
getView().setVerticalScrollBarEnabled(false);
getView().setHorizontalScrollBarEnabled(false);
}
setWebViewClient(new a(commonWebView));
setWebChromeClient(new b(commonWebView));
setDownloadListener(this);
this.f18312e = super.getScale();
}
public void a(String str) {
try {
if (!com.maoyanym.c.c.u()) {
X5WebView x5WebView = new X5WebView(getContext());
x5WebView.a(this.f18310c);
x5WebView.setDownloadEnable(false);
x5WebView.setWebViewClient(new d(x5WebView, str));
x5WebView.loadUrl("http://boardy.huanqiu.com");
return;
}
CookieSyncManager.createInstance(com.maoyanym.b.a.j());
CookieManager cookieManager = CookieManager.getInstance();
if (Build.VERSION.SDK_INT >= 21) {
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
cookieManager.flush();
} else {
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
CookieSyncManager.getInstance().sync();
}
WebStorage.getInstance().deleteAllData();
loadUrl("javascript:" + str + "()");
} catch (Exception e10) {
e10.printStackTrace();
}
}
public float getScale() {
return this.f18312e;
}
public String getUA() {
return getSettings().getUserAgentString();
}
public boolean isX5CoreLoaded() {
return this.f18313f;
}
public void k() {
try {
X5WebView x5WebView = new X5WebView(getContext());
x5WebView.a(this.f18310c);
x5WebView.setDownloadEnable(false);
x5WebView.setWebViewClient(new c(x5WebView));
x5WebView.loadUrl("http://boardy.huanqiu.com");
} catch (Exception e10) {
e10.printStackTrace();
}
}
public boolean l() {
try {
String cookie = CookieManager.getInstance().getCookie("http://boardy.huanqiu.com");
if (p.c(cookie)) {
for (String str : cookie.split(";")) {
if (str.contains("smub")) {
return false;
}
}
}
} catch (Exception e10) {
e10.printStackTrace();
}
return true;
}
public void onDownloadStart(String str, String str2, String str3, String str4, long j10) {
if (this.f18311d) {
this.f18310c.onDownloadStart(str, str2, str3, str4, j10);
}
}
public void setCacheMode(int i10) {
getSettings().setCacheMode(i10);
}
public void setCommonWebChromeClient(CommonWebView.y1 y1Var) {
this.f18309b = y1Var;
}
public void setCommonWebViewClient(CommonWebView.a2 a2Var) {
this.f18308a = a2Var;
}
public void setDownloadEnable(boolean z10) {
this.f18311d = z10;
}
public void setJavaScriptEnabled(boolean z10) {
getSettings().setJavaScriptEnabled(z10);
}
public void setMediaPlaybackRequiresUserGesture(boolean z10) {
if (Build.VERSION.SDK_INT < 17) {
return;
}
getSettings().setMediaPlaybackRequiresUserGesture(z10);
}
public CommonWebView.x1 x5copyBackForwardList() {
return new g(super.copyBackForwardList());
}
}