我要上王者 v1.1版本的 MD5 值为:b7d3566522def961cabeb92cb17f5db9
以下内容为反编译后的 g.java 源代码,内容仅作参考
package com.anythink.expressad.a;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.webkit.JsPromptResult;
import android.webkit.JsResult;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.HashMap;
import java.util.Objects;
public class g {
public static long f2833a = 0;
private static final String d = "g";
private static final int p = 1;
private static final int q = 2;
private static final int r = 0;
boolean f2834b;
boolean c;
private int e;
private int f;
private com.anythink.expressad.d.a h;
private a i;
private String j;
private String k;
private WebView l;
private boolean m;
private String n;
private int o;
private boolean t;
private boolean s = false;
private final Runnable u = new Runnable() {
@Override
public final void run() {
g.n(g.this);
g.this.o = 1;
String unused = g.d;
StringBuilder sb = new StringBuilder("js timeout!timeout limit:");
sb.append(g.this.f);
sb.append("ms");
g.p(g.this);
}
};
private final Runnable v = new Runnable() {
@Override
public final void run() {
g.n(g.this);
g.this.o = 2;
String unused = g.d;
StringBuilder sb = new StringBuilder("http timeout!timeout limit:");
sb.append(g.this.e);
sb.append("ms");
g.p(g.this);
}
};
private Handler g = new Handler(Looper.getMainLooper());
public interface a {
void a(String str, String str2);
void a(String str, String str2, String str3);
boolean a();
boolean a(String str);
boolean b(String str);
}
static boolean e(g gVar) {
gVar.t = true;
return true;
}
static boolean n(g gVar) {
gVar.s = true;
return true;
}
public g(boolean z) {
this.e = com.anythink.expressad.exoplayer.d.f3125a;
this.f = 3000;
com.anythink.expressad.d.b.a();
com.anythink.expressad.foundation.b.a.c().f();
com.anythink.expressad.d.a b2 = com.anythink.expressad.d.b.b();
this.h = b2;
if (b2 == null) {
com.anythink.expressad.d.b.a();
this.h = com.anythink.expressad.d.b.c();
}
this.m = this.h.v();
if (z) {
this.e = (int) this.h.q();
this.f = (int) this.h.q();
return;
}
this.e = (int) this.h.r();
this.f = (int) this.h.r();
}
public final void a(String str, String str2, String str3, Context context, String str4, String str5, a aVar) {
Objects.requireNonNull(aVar, "OverrideUrlLoadingListener can not be null");
this.k = str5;
this.j = str4;
this.i = aVar;
a(str, str2, str3, context);
}
public final void a(String str, String str2, String str3, Context context, String str4, a aVar) {
Objects.requireNonNull(aVar, "OverrideUrlLoadingListener can not be null");
this.j = str4;
this.i = aVar;
a(str, str2, str3, context);
}
private void a(final String str, final String str2, final String str3, final Context context) {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
a(str2, str3, context, this.j);
} else {
this.g.post(new Runnable() {
@Override
public final void run() {
g gVar = g.this;
gVar.a(str2, str3, context, gVar.j);
}
});
}
}
public void a(String str, String str2, Context context, String str3) {
try {
a(context, str, str2);
if (!TextUtils.isEmpty(this.k)) {
this.l.getSettings().setDefaultTextEncodingName(com.anythink.expressad.foundation.g.a.bN);
this.f = 2000;
this.e = 2000;
this.l.loadDataWithBaseURL(str3, this.k, "*/*", com.anythink.expressad.foundation.g.a.bN, str3);
} else if (this.m) {
HashMap hashMap = new HashMap();
if (this.l.getUrl() != null) {
hashMap.put("Referer", this.l.getUrl());
}
this.l.loadUrl(str3, hashMap);
} else {
this.l.loadUrl(str3);
}
} catch (Throwable th) {
try {
a aVar = this.i;
if (aVar != null) {
aVar.a(this.j, th.getMessage(), this.n);
}
} catch (Exception unused) {
}
}
}
private void a(Context context, final String str, final String str2) {
WebView webView = new WebView(context);
this.l = webView;
webView.getSettings().setJavaScriptEnabled(true);
this.l.getSettings().setCacheMode(2);
this.l.getSettings().setLoadsImagesAutomatically(false);
this.l.setWebViewClient(new WebViewClient() {
private boolean a() {
return g.this.f2834b || g.this.c;
}
@Override
public final void onPageStarted(WebView webView2, String str3, Bitmap bitmap) {
try {
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
boolean z = false;
if (g.this.t) {
g.this.o = 0;
g.c(g.this);
return;
}
g.this.c = false;
if (webView2.getTag() == null) {
webView2.setTag("has_first_started");
} else {
g.this.f2834b = true;
}
synchronized (g.d) {
if (g.this.f2834b || g.this.c) {
z = true;
}
String str4 = z ? "load page-start:(redirect)" : "load page-start:";
if (URLUtil.isHttpsUrl(str3)) {
String unused = g.d;
StringBuilder sb = new StringBuilder();
sb.append(str4);
sb.append(str3);
} else {
String unused2 = g.d;
StringBuilder sb2 = new StringBuilder();
sb2.append(str4);
sb2.append(str3);
}
g.this.j = str3;
if (g.this.i != null && g.this.i.a(str3)) {
g.e(g.this);
g.c(g.this);
} else {
g.f(g.this);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
synchronized (g.d) {
String unused = g.d;
g.this.c = true;
g.this.j();
if (g.this.t) {
g.this.h();
g.c(g.this);
return true;
}
g.this.j = str3;
if (g.this.i == null || !g.this.i.b(str3)) {
if (!g.this.m) {
g.this.l.loadUrl(str3);
} else {
HashMap hashMap = new HashMap();
if (g.this.l.getUrl() != null) {
hashMap.put("Referer", g.this.l.getUrl());
}
g.this.l.loadUrl(str3, hashMap);
}
return true;
}
g.e(g.this);
g.this.h();
g.c(g.this);
return true;
}
}
@Override
public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
String unused = g.d;
StringBuilder sb = new StringBuilder("onReceivedError: errno = ");
sb.append(i);
sb.append(", url: ");
sb.append(webView2.getUrl());
sb.append(",\n onReceivedError:, description: ");
sb.append(str3);
sb.append(", failingUrl: ");
sb.append(str4);
synchronized (g.d) {
g.e(g.this);
g.this.f();
g.c(g.this);
}
if (g.this.i != null) {
g.this.i.a(webView2.getUrl(), str3, g.this.n);
}
}
@Override
public final void onReceivedSslError(WebView webView2, SslErrorHandler sslErrorHandler, SslError sslError) {
try {
String unused = g.d;
new StringBuilder("onReceivedSslError IS_SP_CBT_CF:").append(com.anythink.expressad.a.q);
if (com.anythink.expressad.a.q && sslErrorHandler != null) {
sslErrorHandler.cancel();
}
if (TextUtils.isEmpty(str2)) {
return;
}
TextUtils.isEmpty(str);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public final void onPageFinished(WebView webView2, String str3) {
super.onPageFinished(webView2, str3);
try {
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
} catch (Exception e) {
e.printStackTrace();
}
}
});
this.l.setWebChromeClient(new WebChromeClient() {
@Override
public final boolean onJsAlert(WebView webView2, String str3, String str4, JsResult jsResult) {
return true;
}
@Override
public final boolean onJsConfirm(WebView webView2, String str3, String str4, JsResult jsResult) {
return true;
}
@Override
public final boolean onJsPrompt(WebView webView2, String str3, String str4, String str5, JsPromptResult jsPromptResult) {
return true;
}
@Override
public final void onProgressChanged(WebView webView2, int i) {
if (i == 100) {
try {
String unused = g.d;
new StringBuilder("LoadPage-State Complete:").append(webView2.getUrl());
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
if (!g.this.t && !g.this.c) {
g.m(g.this);
}
if (g.this.i != null) {
a aVar = g.this.i;
webView2.getUrl();
aVar.a();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
private void b() {
synchronized (d) {
try {
f();
a aVar = this.i;
if (aVar != null) {
aVar.a(this.j, this.n);
}
} catch (Throwable unused) {
}
}
}
private void c() {
synchronized (d) {
try {
f();
this.l.destroy();
a aVar = this.i;
if (aVar != null) {
aVar.a(this.j, this.n);
}
} catch (Throwable unused) {
}
}
}
private void d() {
h();
this.g.postDelayed(this.v, this.e);
}
private void e() {
j();
this.g.postDelayed(this.u, this.f);
}
public void f() {
j();
h();
}
private void g() {
this.g.postDelayed(this.v, this.e);
}
public void h() {
this.g.removeCallbacks(this.v);
}
private void i() {
this.g.postDelayed(this.u, this.f);
}
public void j() {
this.g.removeCallbacks(this.u);
}
static void c(g gVar) {
synchronized (d) {
try {
gVar.f();
a aVar = gVar.i;
if (aVar != null) {
aVar.a(gVar.j, gVar.n);
}
} catch (Throwable unused) {
}
}
}
static void f(g gVar) {
gVar.h();
gVar.g.postDelayed(gVar.v, gVar.e);
}
static void m(g gVar) {
gVar.j();
gVar.g.postDelayed(gVar.u, gVar.f);
}
static void p(g gVar) {
synchronized (d) {
try {
gVar.f();
gVar.l.destroy();
a aVar = gVar.i;
if (aVar != null) {
aVar.a(gVar.j, gVar.n);
}
} catch (Throwable unused) {
}
}
}
}