AI Chat v1.1.8版本的 MD5 值为:1bcdce875f86738c8cfbf1e5f4064353
以下内容为反编译后的 MBridgeH5EndCardView.java 源代码,内容仅作参考
package com.mbridge.msdk.video.module;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.anythink.expressad.atsignalcommon.mraid.CallMraidJS;
import com.anythink.expressad.atsignalcommon.windvane.AbsFeedBackForH5;
import com.anythink.expressad.foundation.d.r;
import com.google.android.gms.ads.AdError;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.click.g;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.m;
import com.mbridge.msdk.foundation.tools.ab;
import com.mbridge.msdk.foundation.tools.ac;
import com.mbridge.msdk.foundation.tools.ag;
import com.mbridge.msdk.foundation.tools.t;
import com.mbridge.msdk.foundation.tools.x;
import com.mbridge.msdk.foundation.webview.BrowserView;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import com.mbridge.msdk.out.Campaign;
import com.mbridge.msdk.videocommon.download.h;
import com.mbridge.msdk.widget.FeedBackButton;
import java.io.File;
import java.util.HashMap;
import org.json.JSONObject;
public class MBridgeH5EndCardView extends MBridgeBaseView implements g, com.mbridge.msdk.mbsignalcommon.mraid.b, com.mbridge.msdk.video.signal.g {
private boolean A;
private int B;
private int C;
private boolean D;
private boolean E;
private int F;
private long G;
private boolean H;
private boolean I;
private boolean J;
private boolean K;
private boolean L;
private boolean M;
private boolean N;
private boolean O;
private String P;
private boolean Q;
private boolean R;
public View n;
public RelativeLayout o;
public ImageView p;
public WindVaneWebView q;
public Handler r;
public String s;
public boolean t;
public boolean u;
public String v;
public Handler w;
public boolean x;
private FeedBackButton y;
private boolean z;
public class a implements Runnable {
private MBridgeH5EndCardView b;
public a(MBridgeH5EndCardView mBridgeH5EndCardView) {
this.b = mBridgeH5EndCardView;
}
@Override
public final void run() {
Handler handler;
try {
Thread.sleep(300L);
} catch (InterruptedException e) {
x.d("CloseRunnable", e.getMessage());
}
MBridgeH5EndCardView mBridgeH5EndCardView = this.b;
if (mBridgeH5EndCardView == null || (handler = mBridgeH5EndCardView.w) == null) {
return;
}
handler.sendEmptyMessage(100);
}
}
public class b implements Runnable {
private MBridgeH5EndCardView b;
public b(MBridgeH5EndCardView mBridgeH5EndCardView) {
this.b = mBridgeH5EndCardView;
}
@Override
public final void run() {
MBridgeH5EndCardView mBridgeH5EndCardView = this.b;
if (mBridgeH5EndCardView == null || mBridgeH5EndCardView.E) {
return;
}
this.b.E = true;
this.b.t = false;
MBridgeH5EndCardView.this.reportRenderResult("timeout", 5);
this.b.e.a(127, "");
x.a(MBridgeBaseView.TAG, "notify TYPE_NOTIFY_SHOW_NATIVE_ENDCARD");
}
}
public static class c implements Runnable {
private MBridgeH5EndCardView a;
private int b;
public c(MBridgeH5EndCardView mBridgeH5EndCardView, int i) {
this.a = mBridgeH5EndCardView;
this.b = i;
}
@Override
public final void run() {
MBridgeH5EndCardView mBridgeH5EndCardView = this.a;
if (mBridgeH5EndCardView == null || mBridgeH5EndCardView.b == null) {
return;
}
try {
if (!mBridgeH5EndCardView.D) {
this.a.D = true;
String str = (ag.b(this.a.b.getendcard_url()) && this.a.b.getendcard_url().contains(".zip")) ? "1" : "2";
m mVar = new m(r.k, 12, (this.b * 1000) + "", this.a.b.getendcard_url(), this.a.b.getId(), this.a.v, "ready timeout", str);
try {
if (this.a.b.getAdType() == 287) {
mVar.h("3");
} else if (this.a.b.getAdType() == 94) {
mVar.h("1");
} else if (this.a.b.getAdType() == 42) {
mVar.h("2");
}
} catch (Exception e) {
e.printStackTrace();
}
mVar.k(this.a.b.getRequestId());
mVar.l(this.a.b.getRequestIdNotice());
mVar.b(this.a.b.getAdSpaceT());
com.mbridge.msdk.foundation.same.report.c.a(mVar, this.a.v);
this.a.isLoadSuccess();
return;
}
x.b(MBridgeBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return");
} catch (Throwable th) {
x.b(MBridgeBaseView.TAG, th.getMessage(), th);
}
}
}
public class d implements Runnable {
private MBridgeH5EndCardView b;
public d(MBridgeH5EndCardView mBridgeH5EndCardView) {
this.b = mBridgeH5EndCardView;
}
@Override
public final void run() {
MBridgeH5EndCardView mBridgeH5EndCardView = this.b;
if (mBridgeH5EndCardView != null) {
mBridgeH5EndCardView.L = true;
}
}
}
public class e implements Runnable {
private MBridgeH5EndCardView b;
public e(MBridgeH5EndCardView mBridgeH5EndCardView) {
this.b = mBridgeH5EndCardView;
}
@Override
public final void run() {
MBridgeH5EndCardView mBridgeH5EndCardView = this.b;
if (mBridgeH5EndCardView != null) {
mBridgeH5EndCardView.M = true;
}
}
}
public class f implements Runnable {
private MBridgeH5EndCardView b;
public f(MBridgeH5EndCardView mBridgeH5EndCardView) {
this.b = mBridgeH5EndCardView;
}
@Override
public final void run() {
MBridgeH5EndCardView mBridgeH5EndCardView = this.b;
if (mBridgeH5EndCardView != null) {
if (!mBridgeH5EndCardView.N) {
MBridgeH5EndCardView.this.setCloseVisible(0);
}
this.b.I = true;
}
}
}
public MBridgeH5EndCardView(Context context) {
super(context);
this.z = false;
this.r = new Handler();
this.t = false;
this.u = false;
this.A = false;
this.B = 1;
this.C = 1;
this.D = false;
this.E = false;
this.F = 1;
this.G = 0L;
this.H = false;
this.I = false;
this.J = false;
this.K = false;
this.L = false;
this.M = false;
this.N = false;
this.O = false;
this.P = "";
this.w = new Handler(Looper.getMainLooper()) {
@Override
public final void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100) {
return;
}
if (MBridgeH5EndCardView.this.H) {
MBridgeH5EndCardView.this.e.a(122, "");
}
MBridgeH5EndCardView.this.e.a(103, "");
}
};
this.Q = false;
this.R = false;
this.x = false;
}
public static void f(MBridgeH5EndCardView mBridgeH5EndCardView) {
if (com.mbridge.msdk.foundation.b.b.a().b()) {
com.mbridge.msdk.foundation.b.b a2 = com.mbridge.msdk.foundation.b.b.a();
a2.c(mBridgeH5EndCardView.v + "_1");
mBridgeH5EndCardView.b.setCampaignUnitId(mBridgeH5EndCardView.v);
com.mbridge.msdk.foundation.b.b a3 = com.mbridge.msdk.foundation.b.b.a();
a3.a(mBridgeH5EndCardView.v + "_2", mBridgeH5EndCardView.b);
com.mbridge.msdk.foundation.b.b a4 = com.mbridge.msdk.foundation.b.b.a();
a4.a(mBridgeH5EndCardView.v + "_2", new com.mbridge.msdk.foundation.b.a() {
@Override
public final void a() {
String str;
try {
JSONObject jSONObject = new JSONObject();
if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
jSONObject.put("status", 1);
}
str = jSONObject.toString();
} catch (Throwable th) {
x.b(MBridgeBaseView.TAG, th.getMessage(), th);
str = "";
}
com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, AbsFeedBackForH5.a, Base64.encodeToString(str.getBytes(), 2));
}
@Override
public final void b() {
String str;
try {
JSONObject jSONObject = new JSONObject();
if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
jSONObject.put("status", 2);
}
str = jSONObject.toString();
} catch (Throwable th) {
x.b(MBridgeBaseView.TAG, th.getMessage(), th);
str = "";
}
com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, AbsFeedBackForH5.a, Base64.encodeToString(str.getBytes(), 2));
}
@Override
public final void a(String str) {
String str2;
try {
JSONObject jSONObject = new JSONObject();
if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
jSONObject.put("status", 2);
}
str2 = jSONObject.toString();
} catch (Throwable th) {
x.b(MBridgeBaseView.TAG, th.getMessage(), th);
str2 = "";
}
com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, AbsFeedBackForH5.a, Base64.encodeToString(str2.getBytes(), 2));
}
});
com.mbridge.msdk.foundation.b.b a5 = com.mbridge.msdk.foundation.b.b.a();
FeedBackButton b2 = a5.b(mBridgeH5EndCardView.v + "_2");
mBridgeH5EndCardView.y = b2;
if (b2 != null) {
RelativeLayout.LayoutParams layoutParams = null;
try {
layoutParams = (RelativeLayout.LayoutParams) b2.getLayoutParams();
} catch (Exception e2) {
e2.printStackTrace();
}
if (layoutParams == null) {
layoutParams = new RelativeLayout.LayoutParams(com.mbridge.msdk.foundation.b.b.a, com.mbridge.msdk.foundation.b.b.b);
}
layoutParams.addRule(9);
ViewGroup viewGroup = (ViewGroup) mBridgeH5EndCardView.y.getParent();
if (viewGroup != null) {
viewGroup.removeView(mBridgeH5EndCardView.y);
}
mBridgeH5EndCardView.o.addView(mBridgeH5EndCardView.y, layoutParams);
mBridgeH5EndCardView.o.postDelayed(new Runnable() {
@Override
public final void run() {
MBridgeH5EndCardView.this.y.setVisibility(0);
}
}, 200L);
}
}
}
public boolean canBackPress() {
ImageView imageView = this.p;
return imageView != null && imageView.getVisibility() == 0;
}
@Override
public void close() {
try {
onCloseViewClick();
} catch (Exception e2) {
x.d(MBridgeBaseView.TAG, e2.getMessage());
}
}
@Override
public void defaultShow() {
super.defaultShow();
}
public void excuteEndCardShowTask(int i) {
this.r.postDelayed(new c(this, i), i * 1000);
}
public void excuteTask() {
if (this.A || this.B <= -1) {
return;
}
this.r.postDelayed(new f(this), this.B * 1000);
}
public void executeEndCardShow(int i) {
this.r.postDelayed(new b(this), i * 1000);
}
@Override
public void expand(String str, boolean z) {
}
@Override
public CampaignEx getMraidCampaign() {
return this.b;
}
public void handlerPlayableException(String str) {
if (this.u) {
return;
}
this.u = true;
this.t = false;
if (this.b != null) {
m mVar = new m();
mVar.k(this.b.getRequestId());
mVar.l(this.b.getRequestIdNotice());
mVar.n(this.b.getId());
mVar.p(str);
com.mbridge.msdk.foundation.same.report.c.d(mVar, this.a.getApplicationContext(), this.v);
}
}
@Override
public void init(Context context) {
int findLayout = findLayout("mbridge_reward_endcard_h5");
if (findLayout >= 0) {
View inflate = this.c.inflate(findLayout, (ViewGroup) null);
this.n = inflate;
try {
this.p = (ImageView) inflate.findViewById(findID("mbridge_windwv_close"));
this.o = (RelativeLayout) inflate.findViewById(findID("mbridge_windwv_content_rl"));
this.q = new WindVaneWebView(getContext());
this.q.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
this.o.addView(this.q);
this.f = isNotNULL(this.p, this.q);
} catch (Exception unused) {
this.f = false;
}
addView(this.n, b());
c();
e();
}
}
public void install(CampaignEx campaignEx) {
}
public boolean isLoadSuccess() {
return this.t;
}
public boolean isPlayable() {
return this.A;
}
@Override
public void notifyCloseBtn(int i) {
if (i == 0) {
this.J = true;
} else if (i != 1) {
} else {
this.K = true;
}
}
public void onBackPress() {
boolean z;
if (this.I || (((z = this.J) && this.K) || (!(z || !this.L || this.x) || (!z && this.M && this.x)))) {
onCloseViewClick();
}
}
public void onCloseViewClick() {
try {
if (this.q != null) {
com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) this.q, "onSystemDestory", "");
new Thread(new a(this)).start();
} else {
this.e.a(103, "");
this.e.a(119, "webview is null when closing webview");
}
} catch (Exception e2) {
this.e.a(103, "");
com.mbridge.msdk.video.module.a.a aVar = this.e;
aVar.a(119, "close webview exception" + e2.getMessage());
x.a(MBridgeBaseView.TAG, e2.getMessage());
}
}
@Override
public void onFinishRedirection(Campaign campaign, String str) {
ab.a((ViewGroup) this);
}
@Override
public void onRedirectionFailed(Campaign campaign, String str) {
ab.a((ViewGroup) this);
}
@Override
public void onSelfConfigurationChanged(Configuration configuration) {
super.onSelfConfigurationChanged(configuration);
orientation(configuration);
}
@Override
public void onStartRedirection(Campaign campaign, String str) {
ab.a(campaign, this);
}
@Override
public void onVisibilityChanged(View view, int i) {
super.onVisibilityChanged(view, i);
if (i != 0 || this.O) {
return;
}
this.O = true;
setFocusableInTouchMode(true);
requestFocus();
requestFocusFromTouch();
}
@Override
public void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
CampaignEx campaignEx = this.b;
if (campaignEx == null || !campaignEx.isMraid()) {
return;
}
if (z) {
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(this.q, "true");
} else {
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(this.q, "false");
}
}
@Override
public void open(String str) {
try {
String clickURL = this.b.getClickURL();
if (!TextUtils.isEmpty(str)) {
this.b.setClickURL(str);
CampaignEx mraidCampaign = getMraidCampaign();
if (mraidCampaign != null) {
new com.mbridge.msdk.foundation.same.report.d(getContext()).b(mraidCampaign.getRequestId(), mraidCampaign.getRequestIdNotice(), mraidCampaign.getId(), this.v, str, this.b.isBidCampaign());
}
}
com.mbridge.msdk.click.a aVar = new com.mbridge.msdk.click.a(getContext(), this.v);
aVar.a(this);
aVar.a(this.b);
this.b.setClickURL(clickURL);
this.e.a(126, "");
} catch (Exception e2) {
x.d(MBridgeBaseView.TAG, e2.getMessage());
}
}
public void orientation(Configuration configuration) {
try {
JSONObject jSONObject = new JSONObject();
if (configuration.orientation == 2) {
jSONObject.put("orientation", "landscape");
} else {
jSONObject.put("orientation", "portrait");
}
com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) this.q, "orientation", Base64.encodeToString(jSONObject.toString().getBytes(), 2));
} catch (Exception e2) {
e2.printStackTrace();
}
}
public void preLoadData(com.mbridge.msdk.video.signal.factory.b bVar) {
int n;
String a2 = a();
if (this.f && this.b != null && !TextUtils.isEmpty(a2)) {
this.G = System.currentTimeMillis();
try {
reportRenderResult("start", 0);
} catch (Exception unused) {
}
BrowserView.MBDownloadListener mBDownloadListener = new BrowserView.MBDownloadListener(this.b);
mBDownloadListener.setTitle(this.b.getAppName());
this.q.setDownloadListener(mBDownloadListener);
this.q.setCampaignId(this.b.getId());
setCloseVisible(8);
this.q.setApiManagerJSFactory(bVar);
if (this.b.isMraid()) {
this.q.setMraidObject(this);
}
this.q.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() {
@Override
public final void a(WebView webView, String str) {
super.a(webView, str);
MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this;
if (mBridgeH5EndCardView.u) {
return;
}
mBridgeH5EndCardView.t = true;
x.a(MBridgeBaseView.TAG, "onPageFinished,url:" + str);
MBridgeH5EndCardView.this.e.a(100, "");
if (MBridgeH5EndCardView.this.b != null) {
m mVar = new m();
mVar.k(MBridgeH5EndCardView.this.b.getRequestId());
mVar.l(MBridgeH5EndCardView.this.b.getRequestIdNotice());
mVar.n(MBridgeH5EndCardView.this.b.getId());
mVar.d(1);
mVar.q(String.valueOf(System.currentTimeMillis() - MBridgeH5EndCardView.this.G));
mVar.p("onPageFinished");
String str2 = "2";
if (MBridgeH5EndCardView.this.b.getAdType() == 287) {
mVar.h("3");
} else if (MBridgeH5EndCardView.this.b.getAdType() == 94) {
mVar.h("1");
} else if (MBridgeH5EndCardView.this.b.getAdType() == 42) {
mVar.h("2");
}
if (MBridgeH5EndCardView.this.b.isMraid()) {
mVar.a(m.a);
} else {
mVar.f(MBridgeH5EndCardView.this.b.getendcard_url());
if (ag.b(MBridgeH5EndCardView.this.b.getendcard_url()) && MBridgeH5EndCardView.this.b.getendcard_url().contains(".zip")) {
str2 = "1";
}
mVar.g(str2);
mVar.a(m.b);
}
com.mbridge.msdk.foundation.same.report.c.b(mVar, MBridgeH5EndCardView.this.v);
}
MBridgeH5EndCardView.this.e.a(120, "");
}
@Override
public final void c(WebView webView, int i) {
super.c(webView, i);
MBridgeH5EndCardView.this.F = i;
if (MBridgeH5EndCardView.this.E) {
return;
}
MBridgeH5EndCardView.this.E = true;
if (i == 1) {
MBridgeH5EndCardView.this.reportRenderResult("success", 4);
return;
}
MBridgeH5EndCardView.this.e.a(127, "");
MBridgeH5EndCardView.this.reportRenderResult("failed", 6);
}
@Override
public final void a(WebView webView, int i, String str, String str2) {
super.a(webView, i, str, str2);
if (MBridgeH5EndCardView.this.u) {
return;
}
x.a(MBridgeBaseView.TAG, "onReceivedError,url:" + str2);
com.mbridge.msdk.video.module.a.a aVar = MBridgeH5EndCardView.this.e;
aVar.a(118, "onReceivedError " + i + str);
MBridgeH5EndCardView.this.reportRenderResult(str, 3);
MBridgeH5EndCardView.this.e.a(127, "");
MBridgeH5EndCardView.this.e.a(129, "");
MBridgeH5EndCardView.this.u = true;
}
@Override
public final void a(WebView webView, int i) {
super.a(webView, i);
x.b(com.anythink.expressad.atsignalcommon.a.b.f459d, "h5EncardView readyStatus:" + i + "- isError" + MBridgeH5EndCardView.this.u);
MBridgeH5EndCardView.this.F = i;
if (MBridgeH5EndCardView.this.u) {
return;
}
MBridgeH5EndCardView.a(MBridgeH5EndCardView.this, System.currentTimeMillis() - MBridgeH5EndCardView.this.G, false);
}
});
if (TextUtils.isEmpty(this.b.getMraid())) {
try {
this.G = System.currentTimeMillis();
String str = this.b.getendcard_url();
com.mbridge.msdk.videocommon.d.c a3 = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.a.d().g(), this.v);
if (this.A && ag.b(str) && (str.contains("wfr=1") || (a3 != null && a3.n() > 0))) {
if (str.contains("wfr=1")) {
String[] split = str.split("&");
if (split != null && split.length > 0) {
for (String str2 : split) {
if (ag.b(str2) && str2.contains("to") && str2.split("=") != null && str2.split("=").length > 0) {
n = ac.a((Object) str2.split("=")[1]);
break;
}
}
}
n = 20;
} else {
if (a3 != null && a3.n() > 0) {
n = a3.n();
}
n = 20;
}
if (n >= 0) {
excuteEndCardShowTask(n);
} else {
excuteEndCardShowTask(20);
}
}
} catch (Throwable th) {
x.b(MBridgeBaseView.TAG, th.getMessage(), th);
}
}
setHtmlSource(h.a().b(a2));
if (TextUtils.isEmpty(this.s)) {
x.a(MBridgeBaseView.TAG, "load url:" + a2);
this.q.loadUrl(a2);
} else {
x.a(MBridgeBaseView.TAG, "load html...");
this.q.loadDataWithBaseURL(a2, this.s, "text/html", "UTF-8", null);
}
} else {
reportRenderResult("PL URL IS NULL", 3);
this.e.a(127, "");
this.e.a(129, "");
}
this.x = false;
}
public void readyStatus(int i) {
}
public void release() {
Handler handler = this.r;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
this.r = null;
}
Handler handler2 = this.w;
if (handler2 != null) {
handler2.removeCallbacksAndMessages(null);
this.w = null;
}
this.o.removeAllViews();
this.q.release();
this.q = null;
}
public void reportRenderResult(String str, int i) {
if (this.b == null || this.u) {
return;
}
m mVar = new m();
mVar.k(this.b.getRequestId());
mVar.l(this.b.getRequestIdNotice());
mVar.n(this.b.getId());
mVar.d(i);
mVar.q(String.valueOf(System.currentTimeMillis() - this.G));
mVar.p(str);
String str2 = "2";
if (this.b.getAdType() == 287) {
mVar.h("3");
} else if (this.b.getAdType() == 94) {
mVar.h("1");
} else if (this.b.getAdType() == 42) {
mVar.h("2");
}
if (this.b.isMraid()) {
mVar.a(m.a);
} else {
mVar.f(this.b.getendcard_url());
if (ag.b(this.b.getendcard_url()) && this.b.getendcard_url().contains(".zip")) {
str2 = "1";
}
mVar.g(str2);
mVar.a(m.b);
}
com.mbridge.msdk.foundation.same.report.c.b(mVar, this.v);
}
public void setCloseDelayShowTime(int i) {
this.B = i;
}
public void setCloseVisible(int i) {
if (this.f) {
this.p.setVisibility(i);
}
}
public void setCloseVisibleForMraid(int i) {
if (this.f) {
this.N = true;
if (i == 4) {
this.p.setImageDrawable(new ColorDrawable(16711680));
} else {
this.p.setImageResource(findDrawable("mbridge_reward_close"));
}
this.p.setVisibility(0);
}
}
public void setError(boolean z) {
this.u = z;
}
public void setHtmlSource(String str) {
this.s = str;
}
public void setLoadPlayable(boolean z) {
this.x = z;
}
public void setNotchValue(String str, int i, int i2, int i3, int i4) {
this.P = str;
CampaignEx campaignEx = this.b;
if (campaignEx == null || campaignEx.getAdSpaceT() == 2) {
return;
}
x.d(MBridgeBaseView.TAG, "NOTCH H5ENDCARD " + String.format("%1s-%2s-%3s-%4s", Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4)));
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.p.getLayoutParams();
int b2 = ac.b(getContext(), 20.0f);
layoutParams.setMargins(i + b2, i3 + b2, i2 + b2, i4 + b2);
this.p.setLayoutParams(layoutParams);
}
public void setPlayCloseBtnTm(int i) {
this.C = i;
}
public void setUnitId(String str) {
this.v = str;
}
public void startCounterEndCardShowTimer() {
try {
String str = this.b.getendcard_url();
int i = 15;
if (ag.b(str) && str.contains("wfl=1")) {
String[] split = str.split("&");
if (split != null && split.length > 0) {
for (String str2 : split) {
if (ag.b(str2) && str2.contains("timeout") && str2.split("=") != null && str2.split("=").length > 0) {
i = ac.a((Object) str2.split("=")[1]);
}
}
}
executeEndCardShow(i);
}
} catch (Throwable th) {
x.a(MBridgeBaseView.TAG, th.getMessage());
}
}
@Override
public void toggleCloseBtn(int i) {
int visibility = this.p.getVisibility();
if (i == 1) {
this.I = true;
visibility = 0;
} else if (i == 2) {
this.I = false;
visibility = 8;
if (this.x) {
if (!this.R && !this.J) {
this.R = true;
int i2 = this.C;
if (i2 == 0) {
this.M = true;
} else {
this.M = false;
if (i2 > -1) {
this.r.postDelayed(new e(this), this.C * 1000);
}
}
}
} else if (!this.Q && !this.J) {
this.Q = true;
int i3 = this.B;
if (i3 == 0) {
this.L = true;
} else {
this.L = false;
if (i3 > -1) {
this.r.postDelayed(new d(this), this.B * 1000);
}
}
}
}
setCloseVisible(visibility);
}
@Override
public void unload() {
close();
}
@Override
public void useCustomClose(boolean z) {
try {
setCloseVisibleForMraid(z ? 4 : 0);
} catch (Exception e2) {
x.d(MBridgeBaseView.TAG, e2.getMessage());
}
}
public void volumeChange(double d2) {
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(this.q, d2);
}
public void webviewshow() {
WindVaneWebView windVaneWebView = this.q;
if (windVaneWebView != null) {
windVaneWebView.post(new Runnable() {
@Override
public final void run() {
try {
x.a(MBridgeBaseView.TAG, "webviewshow");
int[] iArr = new int[2];
MBridgeH5EndCardView.this.q.getLocationOnScreen(iArr);
x.d(MBridgeBaseView.TAG, "coordinate:" + iArr[0] + "--" + iArr[1]);
JSONObject jSONObject = new JSONObject();
Context f2 = com.mbridge.msdk.foundation.controller.a.d().f();
if (f2 != null) {
jSONObject.put("startX", ac.a(f2, iArr[0]));
jSONObject.put("startY", ac.a(f2, iArr[1]));
jSONObject.put(com.mbridge.msdk.foundation.same.a.k, ac.d(f2));
}
com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, "webviewshow", Base64.encodeToString(jSONObject.toString().toString().getBytes(), 2));
MBridgeH5EndCardView.this.e.a(109, "");
MBridgeH5EndCardView.d(MBridgeH5EndCardView.this);
MBridgeH5EndCardView.this.startCounterEndCardShowTimer();
com.mbridge.msdk.mbsignalcommon.windvane.g a2 = com.mbridge.msdk.mbsignalcommon.windvane.g.a();
MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this;
a2.a((WebView) mBridgeH5EndCardView.q, "oncutoutfetched", Base64.encodeToString(mBridgeH5EndCardView.P.getBytes(), 0));
MBridgeH5EndCardView.f(MBridgeH5EndCardView.this);
} catch (Exception e2) {
e2.printStackTrace();
}
}
});
}
}
public static void d(MBridgeH5EndCardView mBridgeH5EndCardView) {
CampaignEx campaignEx = mBridgeH5EndCardView.b;
if (campaignEx == null || !campaignEx.isMraid()) {
return;
}
int i = mBridgeH5EndCardView.getResources().getConfiguration().orientation;
String str = AdError.UNDEFINED_DOMAIN;
if (i != 0) {
if (i == 1) {
str = "portrait";
} else if (i == 2) {
str = "landscape";
}
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("orientation", str);
jSONObject.put("locked", "true");
} catch (Exception e2) {
e2.printStackTrace();
}
HashMap hashMap = new HashMap();
hashMap.put(CallMraidJS.a, "Interstitial");
hashMap.put(CallMraidJS.b, CallMraidJS.f);
hashMap.put(CallMraidJS.c, "true");
hashMap.put(CallMraidJS.f463d, jSONObject);
if (mBridgeH5EndCardView.getContext() instanceof Activity) {
DisplayMetrics displayMetrics = new DisplayMetrics();
((Activity) mBridgeH5EndCardView.getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBridgeH5EndCardView.q, t.i(mBridgeH5EndCardView.getContext()), t.j(mBridgeH5EndCardView.getContext()));
com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(mBridgeH5EndCardView.q, displayMetrics.widthPixels, displayMetrics.heightPixels);
}
com.mbridge.msdk.mbsignalcommon.mraid.a a2 = com.mbridge.msdk.mbsignalcommon.mraid.a.a();
WindVaneWebView windVaneWebView = mBridgeH5EndCardView.q;
a2.a(windVaneWebView, windVaneWebView.getLeft(), mBridgeH5EndCardView.q.getTop(), mBridgeH5EndCardView.q.getWidth(), mBridgeH5EndCardView.q.getHeight());
com.mbridge.msdk.mbsignalcommon.mraid.a a3 = com.mbridge.msdk.mbsignalcommon.mraid.a.a();
WindVaneWebView windVaneWebView2 = mBridgeH5EndCardView.q;
a3.b(windVaneWebView2, windVaneWebView2.getLeft(), mBridgeH5EndCardView.q.getTop(), mBridgeH5EndCardView.q.getWidth(), mBridgeH5EndCardView.q.getHeight());
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.q, hashMap);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.q, com.mbridge.msdk.mbsignalcommon.mraid.d.a);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.q);
}
public RelativeLayout.LayoutParams b() {
return new RelativeLayout.LayoutParams(-1, -1);
}
@Override
public final void c() {
super.c();
if (this.f) {
this.p.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MBridgeH5EndCardView.this.onCloseViewClick();
}
});
}
}
public void e() {
if (this.f) {
setMatchParent();
}
}
public String a() {
CampaignEx campaignEx = this.b;
if (campaignEx != null) {
this.H = true;
if (campaignEx.isMraid()) {
this.A = false;
String mraid = this.b.getMraid();
if (!TextUtils.isEmpty(mraid)) {
File file = new File(mraid);
try {
if (file.exists() && file.isFile() && file.canRead()) {
mraid = "file:////" + mraid;
} else {
mraid = this.b.getEndScreenUrl();
}
return mraid;
} catch (Throwable th) {
if (MBridgeConstans.DEBUG) {
th.printStackTrace();
return mraid;
}
return mraid;
}
}
return this.b.getEndScreenUrl();
}
String str = this.b.getendcard_url();
if (!ag.a(str)) {
this.A = true;
String b2 = com.mbridge.msdk.videocommon.download.g.a().b(str);
if (TextUtils.isEmpty(b2)) {
try {
String path = Uri.parse(str).getPath();
if (!TextUtils.isEmpty(path) && path.toLowerCase().endsWith(".zip")) {
String endScreenUrl = this.b.getEndScreenUrl();
if (TextUtils.isEmpty(endScreenUrl)) {
return null;
}
this.A = false;
excuteTask();
return endScreenUrl;
}
} catch (Throwable th2) {
x.d(MBridgeBaseView.TAG, th2.getMessage());
}
return str + "&native_adtype=" + this.b.getAdType();
}
return b2 + "&native_adtype=" + this.b.getAdType();
}
this.A = false;
return this.b.getEndScreenUrl();
}
this.H = false;
return null;
}
public MBridgeH5EndCardView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.z = false;
this.r = new Handler();
this.t = false;
this.u = false;
this.A = false;
this.B = 1;
this.C = 1;
this.D = false;
this.E = false;
this.F = 1;
this.G = 0L;
this.H = false;
this.I = false;
this.J = false;
this.K = false;
this.L = false;
this.M = false;
this.N = false;
this.O = false;
this.P = "";
this.w = new Handler(Looper.getMainLooper()) {
@Override
public final void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100) {
return;
}
if (MBridgeH5EndCardView.this.H) {
MBridgeH5EndCardView.this.e.a(122, "");
}
MBridgeH5EndCardView.this.e.a(103, "");
}
};
this.Q = false;
this.R = false;
this.x = false;
}
public static void a(MBridgeH5EndCardView mBridgeH5EndCardView, long j, boolean z) {
String str;
int i;
int i2;
try {
if (mBridgeH5EndCardView.D) {
return;
}
mBridgeH5EndCardView.D = true;
String str2 = (ag.b(mBridgeH5EndCardView.b.getendcard_url()) && mBridgeH5EndCardView.b.getendcard_url().contains(".zip")) ? "1" : "2";
if (z) {
str = "ready timeout";
i = 12;
i2 = 2;
} else if (mBridgeH5EndCardView.F == 2) {
str = "ready no";
i = 11;
i2 = 3;
} else {
str = "ready yes";
i = 10;
i2 = 1;
}
String str3 = str;
String str4 = str;
int i3 = i2;
m mVar = new m(r.k, i, j + "", mBridgeH5EndCardView.b.getendcard_url(), mBridgeH5EndCardView.b.getId(), mBridgeH5EndCardView.v, str3, str2);
try {
if (mBridgeH5EndCardView.b.getAdType() == 287) {
mVar.h("3");
} else if (mBridgeH5EndCardView.b.getAdType() == 94) {
mVar.h("1");
} else if (mBridgeH5EndCardView.b.getAdType() == 42) {
mVar.h("2");
}
} catch (NullPointerException e2) {
e2.printStackTrace();
}
mVar.k(mBridgeH5EndCardView.b.getRequestId());
mVar.l(mBridgeH5EndCardView.b.getRequestIdNotice());
mVar.b(mBridgeH5EndCardView.b.getAdSpaceT());
com.mbridge.msdk.foundation.same.report.c.a(mVar, mBridgeH5EndCardView.v);
if (mBridgeH5EndCardView.isLoadSuccess() || i3 != 1) {
return;
}
mVar.d(i3);
mVar.q(String.valueOf(j));
mVar.n(mBridgeH5EndCardView.b.getId());
mVar.p(str4);
if (mBridgeH5EndCardView.b.isMraid()) {
mVar.a(m.a);
} else {
mVar.f(mBridgeH5EndCardView.b.getendcard_url());
mVar.g(str2);
mVar.a(m.b);
}
com.mbridge.msdk.foundation.same.report.c.b(mVar, mBridgeH5EndCardView.v);
} catch (Throwable th) {
x.b(MBridgeBaseView.TAG, th.getMessage(), th);
}
}
}