VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce
以下内容为反编译后的 bo.java 源代码,内容仅作参考
package com.chartboost.sdk.impl;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import com.chartboost.sdk.Libraries.CBLogging;
import com.chartboost.sdk.Libraries.CBUtility;
import com.chartboost.sdk.Model.CBError;
import com.chartboost.sdk.f;
import com.facebook.ads.AudienceNetworkActivity;
import com.ironsource.sdk.utils.Constants;
import java.io.File;
import org.json.JSONArray;
import org.json.JSONObject;
public class bo extends com.chartboost.sdk.f {
private b A;
final com.chartboost.sdk.Tracking.a k;
final com.chartboost.sdk.e l;
final SharedPreferences m;
public String n;
String o;
protected int p;
long q;
long r;
boolean s;
private final com.chartboost.sdk.impl.b t;
private final af u;
private String v;
private JSONObject w;
private float x;
private float y;
private boolean z;
public enum b {
NONE,
IDLE,
PLAYING,
PAUSED
}
public class c extends f.a {
public bn c;
public bm d;
public RelativeLayout e;
public RelativeLayout f;
public c(Context context, String str) {
super(context);
setFocusable(false);
com.chartboost.sdk.g a = com.chartboost.sdk.g.a();
this.e = (RelativeLayout) a.a((com.chartboost.sdk.g) new RelativeLayout(context));
this.f = (RelativeLayout) a.a((com.chartboost.sdk.g) new RelativeLayout(context));
this.c = (bn) a.a((com.chartboost.sdk.g) new bn(context));
com.chartboost.sdk.h.a(context, this.c, bo.this.m);
this.c.setWebViewClient(new a());
this.d = (bm) a.a((com.chartboost.sdk.g) new bm(this.e, this.f, null, this.c, bo.this));
this.c.setWebChromeClient(this.d);
if (g.a().a(19)) {
bn bnVar = this.c;
bn.setWebContentsDebuggingEnabled(true);
}
this.c.loadDataWithBaseURL(bo.this.o, str, "text/html", AudienceNetworkActivity.WEBVIEW_ENCODING, null);
this.e.addView(this.c);
this.c.getSettings().setSupportZoom(false);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
this.e.setLayoutParams(layoutParams);
this.c.setLayoutParams(layoutParams);
this.c.setBackgroundColor(0);
this.f.setVisibility(8);
this.f.setLayoutParams(layoutParams);
addView(this.e);
addView(this.f);
bo.this.q = System.currentTimeMillis();
CBUtility.c().postDelayed(new Runnable() {
@Override
public void run() {
if (!bo.this.s) {
CBLogging.a("CBWebViewProtocol", "Webview seems to be taking more time loading the html content, so closing the view.");
bo.this.k.a(bo.this.f.q().d(), bo.this.f.f, bo.this.f.p(), "Webview seems to be taking more time loading the html content, so closing the view.", true);
bo.this.a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
}
}
}, 3000L);
}
@Override
protected void a(int i, int i2) {
}
}
public bo(com.chartboost.sdk.Model.a aVar, com.chartboost.sdk.impl.b bVar, af afVar, SharedPreferences sharedPreferences, com.chartboost.sdk.Tracking.a aVar2, com.chartboost.sdk.e eVar) {
super(aVar);
this.n = "UNKNOWN";
this.v = null;
this.o = null;
this.p = 1;
this.x = 0.0f;
this.y = 0.0f;
this.z = false;
this.q = 0L;
this.r = 0L;
this.s = false;
this.A = b.NONE;
this.t = bVar;
this.u = afVar;
this.k = aVar2;
this.l = eVar;
this.m = sharedPreferences;
}
@Override
protected f.a b(Context context) {
return new c(context, this.v);
}
@Override
public boolean a(JSONObject jSONObject) {
File file = com.chartboost.sdk.Libraries.g.e().a;
this.w = com.chartboost.sdk.Libraries.d.a(jSONObject, "events");
if (file == null) {
CBLogging.b("CBWebViewProtocol", "External Storage path is unavailable or media not mounted");
a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
return false;
}
this.o = "file://" + file.getAbsolutePath() + "/";
if (g.a().a((CharSequence) this.f.j)) {
CBLogging.b("CBWebViewProtocol", "Invalid adId being passed in th response");
a(CBError.CBImpressionError.ERROR_DISPLAYING_VIEW);
return false;
}
String str = this.f.k;
if (str == null) {
CBLogging.b("CBWebViewProtocol", "No html data found in memory");
a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
return false;
}
JSONObject a2 = com.chartboost.sdk.Libraries.d.a(jSONObject, Constants.ParametersKeys.WEB_VIEW);
if (a2 == null) {
CBLogging.b("CBWebViewProtocol", "No webview element in response");
a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
return false;
}
if (!this.t.a(a2, file)) {
CBLogging.b("CBWebViewProtocol", "Missing assets for template");
a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
return false;
}
this.v = str;
b();
return true;
}
@Override
public void h() {
super.h();
}
public void b(String str) {
JSONArray optJSONArray;
if (this.w != null && !TextUtils.isEmpty(str) && (optJSONArray = this.w.optJSONArray(str)) != null) {
for (int i = 0; i < optJSONArray.length(); i++) {
String optString = optJSONArray.optString(i);
if (!optString.isEmpty()) {
this.u.a(optString);
CBLogging.a("CBWebViewProtocol", "###### Sending VAST Tracking Event: " + optString);
}
}
}
}
public void c(String str) {
this.k.a(this.f.q().d(), this.f.f, this.f.p(), str);
}
public void d(String str) {
String str2 = g.a().a((CharSequence) str) ? "Unknown Webview error" : str;
this.k.a(this.f.q().d(), this.f.f, this.f.p(), str2, true);
CBLogging.b("CBWebViewProtocol", "Webview error occurred closing the webview" + str2);
a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
h();
}
public void e(String str) {
if (g.a().a((CharSequence) str)) {
str = "Unknown Webview warning message";
}
this.k.b(this.f.q().d(), this.f.f, this.f.p(), str);
CBLogging.d("CBWebViewProtocol", "Webview warning occurred closing the webview" + str);
}
private class a extends WebViewClient {
private a() {
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
bo.this.s = true;
bo.this.r = System.currentTimeMillis();
CBLogging.a("CBWebViewProtocol", "Total web view load response time " + ((bo.this.r - bo.this.q) / 1000));
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
bo.this.a(CBError.CBImpressionError.ERROR_LOADING_WEB_VIEW);
bo.this.s = true;
bo.this.l.d(bo.this.f);
CBLogging.a("CBWebViewProtocol", "Webview seems to have some issues loading html, onRecievedError callback triggered");
bo.this.k.a(bo.this.f.q().d(), bo.this.f.f, bo.this.f.p(), "Webview seems to have some issues loading html, onRecievedError callback triggered", true);
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url) {
return false;
}
}
@Override
public boolean l() {
if (this.A != b.PLAYING) {
c e = e();
if (e != null && e.d != null) {
e.d.onHideCustomView();
}
h();
}
return true;
}
@Override
public void m() {
super.m();
final c e = e();
if (e != null && e.c != null) {
CBUtility.c().post(new Runnable() {
@Override
public void run() {
try {
if (e != null && e.c != null) {
CBLogging.a("CBWebViewProtocol", "Calling native to javascript: javascript:Chartboost.EventHandler.handleNativeEvent(\"onForeground\", \"\")");
e.c.loadUrl("javascript:Chartboost.EventHandler.handleNativeEvent(\"onForeground\", \"\")");
}
} catch (Exception e2) {
com.chartboost.sdk.Tracking.a.a(bo.class, "onResume Runnable.run", e2);
}
}
});
this.k.d(this.n, this.f.p());
}
}
@Override
public void n() {
super.n();
final c e = e();
if (e != null && e.c != null) {
CBUtility.c().post(new Runnable() {
@Override
public void run() {
if (e != null && e.c != null) {
CBLogging.a("CBWebViewProtocol", "Calling native to javascript: javascript:Chartboost.EventHandler.handleNativeEvent(\"onBackground\", \"\")");
e.c.loadUrl("javascript:Chartboost.EventHandler.handleNativeEvent(\"onBackground\", \"\")");
}
}
});
this.k.e(this.n, this.f.p());
}
}
public void o() {
if (this.p <= 1) {
this.f.f();
this.p++;
}
}
@Override
public void d() {
c e = e();
if (e != null) {
if (e.c != null) {
CBLogging.a("CBWebViewProtocol", "Destroying the webview object and cleaning up the references");
e.c.destroy();
e.c = null;
}
if (e.d != null) {
e.d = null;
}
if (e.e != null) {
e.e = null;
}
if (e.f != null) {
e.f = null;
}
}
super.d();
}
public void p() {
this.k.c(this.n, this.f.p());
}
public void a(b bVar) {
this.A = bVar;
}
@Override
public c e() {
return (c) super.e();
}
public void a(float f) {
this.y = f;
}
public void b(float f) {
this.x = f;
}
@Override
public float j() {
return this.x;
}
@Override
public float k() {
return this.y;
}
public void r() {
if (!this.z) {
this.k.d("", this.f.p());
this.f.r();
this.z = true;
}
}
}