Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.mobvista.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.support.graphics.drawable.PathInterpolatorCompat;
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 com.facebook.ads.AdError;
import com.facebook.ads.AudienceNetworkActivity;
import com.mobvista.msdk.MobVistaConstans;
import com.mobvista.msdk.base.utils.h;
import java.util.HashMap;
public class f {
public static long a = 0;
private static final String d = "f";
boolean b;
boolean c;
private int e;
private int f;
private com.mobvista.msdk.b.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 q;
private boolean p = false;
private final Runnable r = new Runnable() {
@Override
public final void run() {
f.n(f.this);
f.this.o = 1;
String str = f.d;
h.d(str, "js超时!超时上限:" + f.this.f + "ms");
f.p(f.this);
}
};
private final Runnable s = new Runnable() {
@Override
public final void run() {
f.n(f.this);
f.this.o = 2;
String str = f.d;
h.d(str, "http超时!超时上限:" + f.this.e + "ms");
f.p(f.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(String str);
boolean b(String str);
boolean c(String str);
}
static boolean e(f fVar) {
fVar.q = true;
return true;
}
static boolean n(f fVar) {
fVar.p = true;
return true;
}
public f(boolean z) {
this.e = 15000;
this.f = PathInterpolatorCompat.MAX_NUM_POINTS;
com.mobvista.msdk.b.b.a();
this.h = com.mobvista.msdk.b.b.b(com.mobvista.msdk.base.controller.a.d().k());
if (this.h == null) {
com.mobvista.msdk.b.b.a();
this.h = com.mobvista.msdk.b.b.b();
}
this.m = this.h.as();
if (z) {
this.e = (int) this.h.al();
this.f = (int) this.h.al();
return;
}
this.e = (int) this.h.an();
this.f = (int) this.h.an();
}
public final void a(String str, String str2, String str3, Context context, String str4, String str5, a aVar) {
if (aVar == null) {
throw new NullPointerException("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) {
if (aVar == null) {
throw new NullPointerException("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(str, str2, str3, context, this.j);
} else {
this.g.post(new Runnable() {
@Override
public final void run() {
f.this.a(str, str2, str3, context, f.this.j);
}
});
}
}
public void b() {
d();
c();
}
public void c() {
this.g.removeCallbacks(this.s);
}
public void d() {
this.g.removeCallbacks(this.r);
}
public void a(final String str, final String str2, final String str3, final Context context, String str4) {
try {
this.l = new WebView(context);
this.l.getSettings().setJavaScriptEnabled(true);
this.l.getSettings().setCacheMode(2);
this.l.getSettings().setLoadsImagesAutomatically(false);
this.l.setWebViewClient(new WebViewClient() {
@Override
public final void onPageStarted(WebView webView, String str5, Bitmap bitmap) {
try {
webView.loadUrl("javascript:window.navigator.vibrate([]);");
boolean z = false;
if (f.this.q) {
f.this.o = 0;
f.c(f.this);
return;
}
f.this.c = false;
if (webView.getTag() == null) {
webView.setTag("has_first_started");
} else {
f.this.b = true;
}
synchronized (f.d) {
String str6 = "加载页面-开始:";
if (f.this.b || f.this.c) {
z = true;
}
if (z) {
str6 = "加载页面-开始:(重定向)";
}
if (URLUtil.isHttpsUrl(str5)) {
h.d(f.d, str6 + str5);
} else {
h.b(f.d, str6 + str5);
}
f.this.j = str5;
if (f.this.i != null && f.this.i.a(str5)) {
f.e(f.this);
f.c(f.this);
} else {
f.f(f.this);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView, String str5) {
synchronized (f.d) {
String str6 = f.d;
h.a(str6, "override js跳转:" + str5);
f.this.c = true;
f.this.d();
if (f.this.q) {
f.this.c();
f.c(f.this);
return true;
}
f.this.j = str5;
if (f.this.i == null || !f.this.i.b(str5)) {
if (!f.this.m) {
f.this.l.loadUrl(str5);
} else {
HashMap hashMap = new HashMap();
if (f.this.l.getUrl() != null) {
hashMap.put("Referer", f.this.l.getUrl());
}
f.this.l.loadUrl(str5, hashMap);
}
return true;
}
f.e(f.this);
f.this.c();
f.c(f.this);
return true;
}
}
@Override
public final void onReceivedError(WebView webView, int i, String str5, String str6) {
String str7 = f.d;
h.b(str7, "onReceivedError: errno = " + i + ", url: " + webView.getUrl() + ",\n onReceivedError:, description: " + str5 + ", failingUrl: " + str6);
synchronized (f.d) {
f.e(f.this);
f.this.b();
f.c(f.this);
}
if (f.this.i != null) {
f.this.i.a(webView.getUrl(), str5, f.this.n);
}
}
@Override
public final void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
try {
String str5 = f.d;
h.a(str5, "onReceivedSslError IS_SP_CBT_CF:" + MobVistaConstans.IS_SP_CBT_CF);
if (MobVistaConstans.IS_SP_CBT_CF && sslErrorHandler != null) {
sslErrorHandler.cancel();
}
if (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str2)) {
return;
}
new com.mobvista.msdk.base.common.d.a(context).a(str, str2, str3, webView.getUrl());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public final void onPageFinished(WebView webView, String str5) {
super.onPageFinished(webView, str5);
try {
webView.loadUrl("javascript:window.navigator.vibrate([]);");
} catch (Exception e) {
e.printStackTrace();
}
}
});
this.l.setWebChromeClient(new WebChromeClient() {
@Override
public final boolean onJsAlert(WebView webView, String str5, String str6, JsResult jsResult) {
return true;
}
@Override
public final boolean onJsConfirm(WebView webView, String str5, String str6, JsResult jsResult) {
return true;
}
@Override
public final boolean onJsPrompt(WebView webView, String str5, String str6, String str7, JsPromptResult jsPromptResult) {
return true;
}
@Override
public final void onProgressChanged(WebView webView, int i) {
if (i == 100) {
try {
String str5 = f.d;
h.b(str5, "加载页面-进度完成:" + webView.getUrl());
webView.loadUrl("javascript:window.navigator.vibrate([]);");
if (!f.this.q && !f.this.c) {
f.m(f.this);
}
if (f.this.i != null) {
f.this.i.c(webView.getUrl());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
});
if (!TextUtils.isEmpty(this.k)) {
this.l.getSettings().setDefaultTextEncodingName(AudienceNetworkActivity.WEBVIEW_ENCODING);
this.f = AdError.SERVER_ERROR_CODE;
this.e = AdError.SERVER_ERROR_CODE;
h.b(d, this.k);
this.l.loadDataWithBaseURL(str4, this.k, "*/*", AudienceNetworkActivity.WEBVIEW_ENCODING, str4);
} else if (this.m) {
HashMap hashMap = new HashMap();
if (this.l.getUrl() != null) {
hashMap.put("Referer", this.l.getUrl());
}
this.l.loadUrl(str4, hashMap);
} else {
this.l.loadUrl(str4);
}
} catch (Throwable th) {
try {
if (this.i != null) {
this.i.a(this.j, th.getMessage(), this.n);
}
} catch (Exception unused) {
}
}
}
static void c(f fVar) {
synchronized (d) {
try {
fVar.b();
if (fVar.i != null) {
fVar.i.a(fVar.j, fVar.n);
}
} catch (Exception unused) {
h.d(d, "webview colse to failed");
} catch (Throwable unused2) {
h.d(d, "webview colse to failed");
}
}
}
static void f(f fVar) {
fVar.c();
fVar.g.postDelayed(fVar.s, fVar.e);
}
static void m(f fVar) {
fVar.d();
fVar.g.postDelayed(fVar.r, fVar.f);
}
static void p(f fVar) {
synchronized (d) {
try {
fVar.b();
fVar.l.destroy();
if (fVar.i != null) {
fVar.i.a(fVar.j, fVar.n);
}
} catch (Exception unused) {
h.d(d, "webview colse to failed");
} catch (Throwable unused2) {
h.d(d, "webview colse to failed");
}
}
}
}