超媒网络 v3.0.0版本的 MD5 值为:e72248abb238993f421967424d9a9515
以下内容为反编译后的 GT3GtWebView.java 源代码,内容仅作参考
package com.geetest.sdk.dialog.views;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.JsPromptResult;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.ehking.sdk.wepay.ui.activity.AddBankCardActivity;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONObject;
import p.a.y.e.a.s.e.net.a40;
import p.a.y.e.a.s.e.net.e4;
import p.a.y.e.a.s.e.net.n40;
import p.a.y.e.a.s.e.net.r5;
import p.a.y.e.a.s.e.net.te2;
import p.a.y.e.a.s.e.net.w40;
public class GT3GtWebView extends WebView {
private static final String lite_continue = GT3GtWebView.class.getSimpleName();
private static final String[] lite_strictfp = {"getClass", "hashCode", "notify", "notifyAll", "equals", "toString", "wait"};
private Handler lite_abstract;
private n40 lite_boolean;
public boolean lite_default;
private boolean lite_extends;
private String lite_finally;
private a40 lite_package;
private Runnable lite_private;
private Context lite_static;
private String lite_switch;
private HashMap<String, Object> lite_throws;
public class b extends WebChromeClient {
private b() {
}
@Override
public final boolean onJsPrompt(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
if ((webView instanceof GT3GtWebView) && GT3GtWebView.this.lite_char(webView, str, str2, str3, jsPromptResult)) {
return true;
}
return super.onJsPrompt(webView, str, str2, str3, jsPromptResult);
}
@Override
public final void onProgressChanged(WebView webView, int i) {
GT3GtWebView.this.lite_new(webView);
String str = GT3GtWebView.lite_continue;
w40.lite_int(str, "onProgressChanged-->newProgress: " + i);
super.onProgressChanged(webView, i);
}
@Override
public final void onReceivedTitle(WebView webView, String str) {
GT3GtWebView.this.lite_new(webView);
}
}
public class c extends WebViewClient {
private GT3GtWebView lite_do;
public c(GT3GtWebView gT3GtWebView) {
this.lite_do = gT3GtWebView;
}
@Override
public void doUpdateVisitedHistory(WebView webView, String str, boolean z) {
GT3GtWebView.this.lite_new(webView);
super.doUpdateVisitedHistory(webView, str, z);
}
@Override
public void onLoadResource(WebView webView, String str) {
GT3GtWebView.this.lite_new(webView);
String str2 = GT3GtWebView.lite_continue;
w40.lite_if(str2, "onLoadResource-->url: " + str);
super.onLoadResource(webView, str);
}
@Override
public void onPageFinished(WebView webView, String str) {
String str2 = GT3GtWebView.lite_continue;
w40.lite_if(str2, "Webview-->onPageFinished-->url: " + str);
GT3GtWebView.this.lite_new(webView);
super.onPageFinished(webView, str);
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
String str2 = GT3GtWebView.lite_continue;
w40.lite_if(str2, "Webview-->onPageStarted-->url: " + str);
GT3GtWebView.this.lite_new(webView);
super.onPageStarted(webView, str, bitmap);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
if (GT3GtWebView.this.lite_boolean != null) {
String str = null;
try {
int i = Build.VERSION.SDK_INT;
str = "onReceivedError-->url: " + webResourceRequest.getUrl();
w40.lite_if(GT3GtWebView.lite_continue, "onReceivedError-->url: " + webResourceRequest.getUrl());
if (i >= 23) {
str = "onReceivedError-->Description: " + ((Object) webResourceError.getDescription()) + "-->onReceivedError-->ErrorCode: " + webResourceError.getErrorCode();
w40.lite_if(GT3GtWebView.lite_continue, "onReceivedError-->Description: " + ((Object) webResourceError.getDescription()));
w40.lite_if(GT3GtWebView.lite_continue, "onReceivedError-->ErrorCode: " + webResourceError.getErrorCode());
}
} catch (Exception e) {
e.printStackTrace();
}
w40.lite_if(GT3GtWebView.lite_continue, "webview加载出错 错误码:204_1 中间页地址有误或加载失败");
n40 n40Var = GT3GtWebView.this.lite_boolean;
if (TextUtils.isEmpty(str)) {
str = "Webview-->onReceivedError: webview load error !";
}
n40Var.lite_for("204_1", str);
}
if (GT3GtWebView.this.lite_abstract != null) {
try {
GT3GtWebView.this.lite_abstract.removeCallbacks(GT3GtWebView.this.lite_private);
GT3GtWebView.this.lite_abstract.removeMessages(1);
} catch (Exception unused) {
}
}
super.onReceivedError(webView, webResourceRequest, webResourceError);
}
@Override
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
List<String> lite_new;
try {
String uri = webResourceRequest.getUrl().toString();
String substring = uri.substring(0, uri.indexOf("?"));
String str = GT3GtWebView.lite_continue;
w40.lite_if(str, "onReceivedHttpError-->getStatusCode: " + webResourceResponse.getStatusCode());
String str2 = GT3GtWebView.lite_continue;
w40.lite_if(str2, "onReceivedHttpError-->url: " + uri);
if (!TextUtils.isEmpty(GT3GtWebView.this.lite_finally) && TextUtils.equals(substring, GT3GtWebView.this.lite_finally.substring(0, GT3GtWebView.this.lite_finally.indexOf("?"))) && (lite_new = GT3GtWebView.this.lite_package.lite_super().lite_new()) != null && lite_new.size() > 1) {
GT3GtWebView gT3GtWebView = this.lite_do;
StringBuilder sb = new StringBuilder();
sb.append(String.format("https://%s/static/appweb/app3-index.html", lite_new.get(1)));
sb.append(uri.substring(uri.indexOf("?")));
gT3GtWebView.loadUrl(sb.toString());
}
} catch (Exception e) {
e.printStackTrace();
}
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
if (GT3GtWebView.this.lite_boolean != null) {
String str = GT3GtWebView.lite_continue;
StringBuilder b = r5.b("onReceivedSslError-->webview加载出错 错误码:204_2 网络证书有误, ");
b.append(sslError.toString());
w40.lite_if(str, b.toString());
n40 n40Var = GT3GtWebView.this.lite_boolean;
StringBuilder b2 = r5.b("Webview-->onReceivedSslError: ");
b2.append(sslError.toString());
n40Var.lite_for("204_2", b2.toString());
}
if (GT3GtWebView.this.lite_abstract != null) {
try {
GT3GtWebView.this.lite_abstract.removeCallbacks(GT3GtWebView.this.lite_private);
GT3GtWebView.this.lite_abstract.removeMessages(1);
} catch (Exception unused) {
}
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
if (webView != null && str != null && GT3GtWebView.this.lite_static != null) {
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.addFlags(268435456);
intent.setData(Uri.parse(str));
GT3GtWebView.this.lite_static.startActivity(intent);
} catch (Exception unused) {
}
}
String str2 = GT3GtWebView.lite_continue;
w40.lite_int(str2, "shouldOverrideUrlLoading-->url: " + str);
return true;
}
}
public GT3GtWebView(Context context) {
super(context);
this.lite_switch = null;
this.lite_throws = new HashMap<>();
this.lite_extends = false;
this.lite_abstract = null;
lite_int(context);
}
private void lite_byte(String str, Object obj, StringBuilder sb) {
Method[] methods;
if (TextUtils.isEmpty(str) || obj == null || sb == null) {
return;
}
Class<?> cls = obj.getClass();
sb.append("if(typeof(window.");
sb.append(str);
sb.append(")!='undefined'){");
sb.append(" console.log('window." + str + "_js_interface_name is exist!!');");
sb.append("}else {");
sb.append(" window.");
sb.append(str);
sb.append("={");
for (Method method : cls.getMethods()) {
String name = method.getName();
if (!lite_goto(name)) {
sb.append(" ");
sb.append(name);
sb.append(":function(");
int length = method.getParameterTypes().length;
if (length > 0) {
int i = length - 1;
for (int i2 = 0; i2 < i; i2++) {
sb.append("arg");
sb.append(i2);
sb.append(te2.lite_const);
}
sb.append("arg");
sb.append(i);
}
sb.append(") {");
if (method.getReturnType() != Void.TYPE) {
r5.L(sb, " return ", "prompt('", "GtApp:", "'+");
} else {
r5.K(sb, " prompt('", "GtApp:", "'+");
}
r5.L(sb, "JSON.stringify({", "obj", ":'", str);
r5.L(sb, "',", "func", ":'", name);
r5.K(sb, "',", "args", ":[");
if (length > 0) {
int i3 = length - 1;
for (int i4 = 0; i4 < i3; i4++) {
sb.append("arg");
sb.append(i4);
sb.append(te2.lite_const);
}
sb.append("arg");
sb.append(i3);
}
r5.K(sb, "]})", ");", " }, ");
}
}
sb.append(" };");
sb.append(e4.lite_int);
}
private boolean lite_case(JsPromptResult jsPromptResult, String str, String str2, Object[] objArr) {
Object obj = this.lite_throws.get(str);
boolean z = false;
if (obj == null) {
jsPromptResult.cancel();
return false;
}
Class<?>[] clsArr = null;
int length = objArr != null ? objArr.length : 0;
if (length > 0) {
clsArr = new Class[length];
for (int i = 0; i < length; i++) {
clsArr[i] = lite_if(objArr[i]);
}
}
try {
Object invoke = obj.getClass().getMethod(str2, clsArr).invoke(obj, objArr);
jsPromptResult.confirm(invoke == null || invoke.getClass() == Void.TYPE ? "" : invoke.toString());
z = true;
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (Exception e2) {
e2.printStackTrace();
}
jsPromptResult.cancel();
return z;
}
public boolean lite_char(WebView webView, String str, String str2, String str3, JsPromptResult jsPromptResult) {
int length;
if (str2.startsWith("GtApp:")) {
try {
JSONObject jSONObject = new JSONObject(str2.substring(6));
String string = jSONObject.getString("obj");
String string2 = jSONObject.getString("func");
JSONArray jSONArray = jSONObject.getJSONArray("args");
Object[] objArr = null;
if (jSONArray != null && (length = jSONArray.length()) > 0) {
objArr = new Object[length];
for (int i = 0; i < length; i++) {
objArr[i] = jSONArray.get(i);
}
}
if (lite_case(jsPromptResult, string, string2, objArr)) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
jsPromptResult.cancel();
return false;
}
return false;
}
private String lite_class() {
if (this.lite_throws.size() == 0) {
this.lite_switch = null;
return null;
}
StringBuilder b2 = r5.b("javascript:(function JsAddJavascriptInterface_(){");
for (Map.Entry<String, Object> entry : this.lite_throws.entrySet()) {
try {
lite_byte(entry.getKey(), entry.getValue(), b2);
} catch (Exception e) {
e.printStackTrace();
}
}
b2.append("})()");
return b2.toString();
}
private boolean lite_final() {
return true;
}
private boolean lite_goto(String str) {
for (String str2 : lite_strictfp) {
if (str2.equals(str)) {
return true;
}
}
return false;
}
private Class<?> lite_if(Object obj) {
Class<?> cls = obj.getClass();
return cls == Integer.class ? Integer.TYPE : cls == Boolean.class ? Boolean.TYPE : String.class;
}
private void lite_int(Context context) {
this.lite_static = context;
}
public void lite_new(WebView webView) {
if (webView instanceof GT3GtWebView) {
lite_super();
}
}
private boolean lite_short() {
return true;
}
private void lite_super() {
if (!TextUtils.isEmpty(this.lite_switch)) {
lite_throw();
return;
}
this.lite_switch = lite_class();
lite_throw();
}
private void lite_throw() {
if (TextUtils.isEmpty(this.lite_switch)) {
return;
}
loadUrl(this.lite_switch);
}
private boolean lite_while() {
if (!lite_final() || lite_short()) {
return false;
}
super.removeJavascriptInterface("searchBoxJavaBridge_");
return true;
}
@Override
@SuppressLint({"JavascriptInterface"})
public void addJavascriptInterface(Object obj, String str) {
if (TextUtils.isEmpty(str)) {
return;
}
if (lite_short()) {
super.addJavascriptInterface(obj, str);
} else {
this.lite_throws.put(str, obj);
}
}
@Override
public void destroy() {
w40.lite_if(lite_continue, "GT3GtWebView-->destroy");
this.lite_default = true;
this.lite_static = null;
this.lite_boolean = null;
super.destroy();
}
public Handler getMyHandler() {
return this.lite_abstract;
}
public Runnable getRunnable() {
return this.lite_private;
}
public void lite_for() {
WebSettings settings = getSettings();
this.lite_default = false;
settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setDomStorageEnabled(true);
settings.setAppCacheEnabled(true);
settings.setUseWideViewPort(true);
settings.setCacheMode(1);
settings.setTextZoom(100);
setOverScrollMode(2);
setScrollContainer(false);
setHorizontalScrollBarEnabled(false);
setVerticalScrollBarEnabled(false);
onResume();
super.setWebChromeClient(new b());
super.setWebViewClient(new c(this));
lite_while();
}
public boolean lite_this() {
return this.lite_extends;
}
@Override
public void loadUrl(String str, Map<String, String> map) {
if (this.lite_default) {
return;
}
super.loadUrl(str, map);
}
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
Log.e(lite_continue, "onDetachedFromWindow: ");
if (this.lite_extends) {
loadUrl(AddBankCardActivity.WHITE_SPACE);
}
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
String str = lite_continue;
StringBuilder b2 = r5.b("webView硬件加速是否开启:");
b2.append(canvas.isHardwareAccelerated());
w40.lite_int(str, b2.toString());
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onResume() {
super.onResume();
resumeTimers();
}
@Override
public void removeJavascriptInterface(String str) {
if (lite_short()) {
super.removeJavascriptInterface(str);
return;
}
this.lite_throws.remove(str);
this.lite_switch = null;
lite_super();
}
public void setDataBean(a40 a40Var) {
this.lite_package = a40Var;
}
public void setMyHandler(Handler handler) {
this.lite_abstract = handler;
}
public void setObservable(n40 n40Var) {
this.lite_boolean = n40Var;
}
public void setRunnable(Runnable runnable) {
this.lite_private = runnable;
}
public void setStaticUrl(String str) {
this.lite_finally = str;
}
public void setTimeout(int i) {
}
public void setVoice(boolean z) {
this.lite_extends = z;
}
}