Idle Tower v2.48版本的 MD5 值为:56f20496f6a85726b376356ed2ecee23
以下内容为反编译后的 h.java 源代码,内容仅作参考
package com.mbridge.msdk.click;
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.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.common.net.HttpHeaders;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.same.report.l;
import com.mbridge.msdk.foundation.tools.y;
import java.util.HashMap;
public class h {
boolean b;
boolean c;
private int e;
private int f;
private com.mbridge.msdk.c.b h;
private a i;
private String j;
private String k;
private WebView l;
private boolean m;
private String n;
private int o;
private boolean q;
private static final String d = h.class.getSimpleName();
public static long f5843a = 0;
private boolean p = false;
private final Runnable r = new Runnable() {
@Override
public final void run() {
h.this.p = true;
h.this.o = 1;
h.m(h.this);
}
};
private final Runnable s = new Runnable() {
@Override
public final void run() {
h.this.p = true;
h.this.o = 2;
h.m(h.this);
}
};
private Handler g = new Handler(Looper.getMainLooper());
public interface a {
void a(int i, String str, String str2, String str3);
void a(String str, boolean z, String str2);
boolean a(String str);
boolean b(String str);
boolean c(String str);
}
public h() {
this.e = 15000;
this.f = 3000;
com.mbridge.msdk.c.b b = com.mbridge.msdk.c.c.a().b(com.mbridge.msdk.foundation.controller.a.d().g());
this.h = b;
if (b == null) {
this.h = com.mbridge.msdk.c.c.a().b();
}
this.m = this.h.U();
this.e = (int) this.h.Z();
this.f = (int) this.h.Z();
}
public final void a(String str, String str2, Context context, String str3, String str4, a aVar) {
if (aVar == null) {
throw new NullPointerException("OverrideUrlLoadingListener can not be null");
}
this.k = str4;
this.j = str3;
this.i = aVar;
a(str, str2, context);
}
public final void a(String str, String str2, Context context, String str3, a aVar) {
if (aVar == null) {
throw new NullPointerException("OverrideUrlLoadingListener can not be null");
}
this.j = str3;
this.i = aVar;
a(str, str2, context);
}
private void a(final String str, final String str2, final Context context) {
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
a(str, str2, context, this.j);
} else {
this.g.post(new Runnable() {
@Override
public final void run() {
h hVar = h.this;
hVar.a(str, str2, context, hVar.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("utf-8");
this.f = 2000;
this.e = 2000;
y.b(d, this.k);
this.l.loadDataWithBaseURL(str3, this.k, "*/*", "utf-8", str3);
return;
}
if (this.m) {
HashMap hashMap = new HashMap();
if (this.l.getUrl() != null) {
hashMap.put(HttpHeaders.REFERER, this.l.getUrl());
}
this.l.loadUrl(str3, hashMap);
return;
}
this.l.loadUrl(str3);
} catch (Throwable th) {
try {
if (this.i != null) {
this.i.a(0, this.j, th.getMessage(), this.n);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void a(final 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() {
@Override
public final void onPageStarted(WebView webView2, String str3, Bitmap bitmap) {
try {
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
if (h.this.q) {
h.this.o = 0;
h.c(h.this);
return;
}
h.this.c = false;
if (webView2.getTag() == null) {
webView2.setTag("has_first_started");
} else {
h.this.b = true;
}
synchronized (h.d) {
h.this.j = str3;
if (h.this.i != null && h.this.i.a(str3)) {
h.this.q = true;
h.c(h.this);
} else {
h.e(h.this);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
synchronized (h.d) {
h.this.c = true;
h.this.d();
if (h.this.q) {
h.this.c();
h.c(h.this);
return true;
}
h.this.j = str3;
if (h.this.i == null || !h.this.i.b(str3)) {
if (!h.this.m) {
h.this.l.loadUrl(str3);
} else {
HashMap hashMap = new HashMap();
if (h.this.l.getUrl() != null) {
hashMap.put(HttpHeaders.REFERER, h.this.l.getUrl());
}
h.this.l.loadUrl(str3, hashMap);
}
return true;
}
h.this.q = true;
h.this.c();
h.c(h.this);
return true;
}
}
@Override
public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
synchronized (h.d) {
h.this.q = true;
h.this.b();
h.c(h.this);
}
if (h.this.i != null) {
h.this.i.a(i, webView2.getUrl(), str3, h.this.n);
}
}
@Override
public final void onReceivedSslError(WebView webView2, SslErrorHandler sslErrorHandler, SslError sslError) {
try {
if (MBridgeConstans.IS_SP_CBT_CF && sslErrorHandler != null) {
sslErrorHandler.cancel();
}
if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str)) {
return;
}
new l(context).a(str, str2, webView2.getUrl());
} 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 {
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
if (!h.this.q && !h.this.c) {
h.l(h.this);
}
if (h.this.i != null) {
h.this.i.c(webView2.getUrl());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
}
public void b() {
d();
c();
}
public void c() {
this.g.removeCallbacks(this.s);
}
public void d() {
this.g.removeCallbacks(this.r);
}
static void c(h hVar) {
synchronized (d) {
try {
hVar.b();
if (hVar.i != null) {
hVar.i.a(hVar.j, hVar.p, hVar.n);
}
} catch (Exception e) {
y.d(d, e.getMessage());
} catch (Throwable th) {
y.d(d, th.getMessage());
}
}
}
static void e(h hVar) {
hVar.c();
hVar.g.postDelayed(hVar.s, hVar.e);
}
static void l(h hVar) {
hVar.d();
hVar.g.postDelayed(hVar.r, hVar.f);
}
static void m(h hVar) {
synchronized (d) {
try {
try {
hVar.b();
hVar.l.destroy();
if (hVar.i != null) {
hVar.i.a(hVar.j, hVar.p, hVar.n);
}
} catch (Exception e) {
y.d(d, e.getMessage());
}
} finally {
}
}
}
}