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.google.android.gms.ads.AdError; import com.ironsource.v8; import com.mbridge.msdk.MBridgeConstans; import com.mbridge.msdk.foundation.download.download.H5DownLoadManager; import com.mbridge.msdk.foundation.download.download.HTMLResourceManager; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.entity.n; import com.mbridge.msdk.foundation.same.report.h; import com.mbridge.msdk.foundation.tools.ab; import com.mbridge.msdk.foundation.tools.af; import com.mbridge.msdk.foundation.tools.aj; import com.mbridge.msdk.foundation.tools.ak; import com.mbridge.msdk.foundation.tools.ap; import com.mbridge.msdk.foundation.tools.x; import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView; import com.mbridge.msdk.mbsignalcommon.windvane.g; import com.mbridge.msdk.newreward.player.view.hybrid.util.MRAIDCommunicatorUtil; import com.mbridge.msdk.out.Campaign; import java.io.File; import java.util.HashMap; import org.json.JSONObject; /* loaded from: classes4.dex */ public class MBridgeH5EndCardView extends MBridgeH5EndCardViewDiff { private boolean A; private boolean B; private int C; private long D; private boolean E; private boolean F; private boolean G; private boolean H; private boolean I; private boolean J; private boolean K; private boolean L; private String M; private boolean N; private boolean O; protected View m; protected RelativeLayout n; protected ImageView o; protected WindVaneWebView p; protected Handler q; protected String r; protected boolean s; protected boolean t; Handler u; boolean v; private boolean w; private boolean x; private int y; private int z; @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public void expand(String str, boolean z) { } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public CampaignEx getMraidCampaign() { return this.b; } public void install(CampaignEx campaignEx) { } public boolean isLoadSuccess() { return this.s; } public boolean isPlayable() { return this.x; } @Override // com.mbridge.msdk.video.signal.h public void notifyCloseBtn(int i) { if (i == 0) { this.G = true; } else { if (i != 1) { return; } this.H = true; } } public void readyStatus(int i) { } public void setCloseDelayShowTime(int i) { this.y = i; } public void setError(boolean z) { this.t = z; } public void setHtmlSource(String str) { this.r = str; } public void setLoadPlayable(boolean z) { this.v = z; } public void setPlayCloseBtnTm(int i) { this.z = i; } public void setUnitId(String str) { this.unitId = str; } public MBridgeH5EndCardView(Context context) { super(context); this.w = false; this.q = new Handler(); this.s = false; this.t = false; this.x = false; this.y = 1; this.z = 1; this.A = false; this.B = false; this.C = 1; this.D = 0L; this.E = false; this.F = false; this.G = false; this.H = false; this.I = false; this.J = false; this.K = false; this.L = false; this.M = ""; this.u = new Handler(Looper.getMainLooper()) { // from class: com.mbridge.msdk.video.module.MBridgeH5EndCardView.1 @Override // android.os.Handler public final void handleMessage(Message message) { super.handleMessage(message); if (message.what != 100) { return; } if (MBridgeH5EndCardView.this.E) { MBridgeH5EndCardView.this.notifyListener.a(122, ""); } MBridgeH5EndCardView.this.notifyListener.a(103, ""); } }; this.N = false; this.O = false; this.v = false; } public MBridgeH5EndCardView(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.w = false; this.q = new Handler(); this.s = false; this.t = false; this.x = false; this.y = 1; this.z = 1; this.A = false; this.B = false; this.C = 1; this.D = 0L; this.E = false; this.F = false; this.G = false; this.H = false; this.I = false; this.J = false; this.K = false; this.L = false; this.M = ""; this.u = new Handler(Looper.getMainLooper()) { // from class: com.mbridge.msdk.video.module.MBridgeH5EndCardView.1 @Override // android.os.Handler public final void handleMessage(Message message) { super.handleMessage(message); if (message.what != 100) { return; } if (MBridgeH5EndCardView.this.E) { MBridgeH5EndCardView.this.notifyListener.a(122, ""); } MBridgeH5EndCardView.this.notifyListener.a(103, ""); } }; this.N = false; this.O = false; this.v = false; } @Override // com.mbridge.msdk.video.module.MBridgeBaseView public void onSelfConfigurationChanged(Configuration configuration) { super.onSelfConfigurationChanged(configuration); orientation(configuration); } @Override // com.mbridge.msdk.video.module.MBridgeBaseView public void init(Context context) { int findLayout = findLayout("mbridge_reward_endcard_h5"); if (findLayout >= 0) { View inflate = this.c.inflate(findLayout, (ViewGroup) null); this.m = inflate; try { this.o = (ImageView) inflate.findViewById(findID("mbridge_windwv_close")); this.n = (RelativeLayout) inflate.findViewById(findID("mbridge_windwv_content_rl")); WindVaneWebView windVaneWebView = new WindVaneWebView(getContext()); this.p = windVaneWebView; CampaignEx campaignEx = this.b; if (campaignEx != null) { windVaneWebView.setLocalRequestId(campaignEx.getCurrentLocalRid()); } this.p.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); this.n.addView(this.p); this.e = isNotNULL(this.o, this.p); } catch (Exception unused) { this.e = false; } addView(this.m, b()); c(); e(); } } @Override // com.mbridge.msdk.video.module.MBridgeBaseView public final void c() { super.c(); if (this.e) { this.o.setOnClickListener(new View.OnClickListener() { // from class: com.mbridge.msdk.video.module.MBridgeH5EndCardView.2 @Override // android.view.View.OnClickListener public final void onClick(View view) { MBridgeH5EndCardView.this.onCloseViewClick(); } }); } } public void onCloseViewClick() { try { if (this.p != null) { g.a().a((WebView) this.p, "onSystemDestory", ""); new Thread(new a(this)).start(); } else { this.notifyListener.a(103, ""); this.notifyListener.a(119, "webview is null when closing webview"); } } catch (Exception e2) { this.notifyListener.a(103, ""); this.notifyListener.a(119, "close webview exception" + e2.getMessage()); af.a(MBridgeBaseView.TAG, e2.getMessage()); } try { com.mbridge.msdk.foundation.same.report.d.e eVar = new com.mbridge.msdk.foundation.same.report.d.e(); eVar.a("type", 2); com.mbridge.msdk.foundation.same.report.d.d.a().a("2000152", eVar); com.mbridge.msdk.foundation.same.report.d.d.a().a("2000134", this.b); } catch (Throwable th) { if (MBridgeConstans.DEBUG) { th.printStackTrace(); } } } public class a implements Runnable { private MBridgeH5EndCardView b; public a(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } @Override // java.lang.Runnable public final void run() { Handler handler; try { Thread.sleep(300L); } catch (InterruptedException e) { af.b("CloseRunnable", e.getMessage()); } MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView == null || (handler = mBridgeH5EndCardView.u) == null) { return; } handler.sendEmptyMessage(100); } } public void preLoadData(com.mbridge.msdk.video.signal.factory.b bVar) { int o; CampaignEx campaignEx; if (com.mbridge.msdk.foundation.same.b.a().a("new_bridge_reward_video") && (campaignEx = this.b) != null && campaignEx.getAdSpaceT() == 2) { reportRenderResult("PL URL IS NULL", 3); this.notifyListener.a(127, ""); this.notifyListener.a(129, ""); return; } String a2 = a(); if (this.e && this.b != null && !TextUtils.isEmpty(a2) && this.p != null) { this.D = System.currentTimeMillis(); try { reportRenderResult("start", 0); } catch (Exception unused) { } com.mbridge.msdk.foundation.same.g.a aVar = new com.mbridge.msdk.foundation.same.g.a(this.b); aVar.a(this.b.getAppName()); this.p.setDownloadListener(aVar); this.p.setCampaignId(this.b.getId()); this.p.setTempTypeForMetrics(3); CampaignEx campaignEx2 = this.b; if (campaignEx2 != null) { this.p.setCampaignEx(campaignEx2); } setCloseVisible(8); this.p.setApiManagerJSFactory(bVar); if (this.b.isMraid()) { this.p.setMraidObject(this); } final boolean z = a2.contains("wfr=1") || a2.contains("wfl=1"); this.p.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() { // from class: com.mbridge.msdk.video.module.MBridgeH5EndCardView.3 @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView, String str) { super.a(webView, str); MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this; if (mBridgeH5EndCardView.t) { return; } mBridgeH5EndCardView.s = true; mBridgeH5EndCardView.notifyListener.a(100, ""); if (MBridgeH5EndCardView.this.b != null) { n nVar = new n(); nVar.f(MBridgeH5EndCardView.this.b.getRequestId()); nVar.g(MBridgeH5EndCardView.this.b.getRequestIdNotice()); nVar.e(MBridgeH5EndCardView.this.b.getId()); nVar.b(1); nVar.l(String.valueOf(System.currentTimeMillis() - MBridgeH5EndCardView.this.D)); nVar.h("onPageFinished"); String str2 = "2"; if (MBridgeH5EndCardView.this.b.getAdType() == 287) { nVar.d("3"); } else if (MBridgeH5EndCardView.this.b.getAdType() == 94) { nVar.d("1"); } else if (MBridgeH5EndCardView.this.b.getAdType() == 42) { nVar.d("2"); } if (MBridgeH5EndCardView.this.b.isMraid()) { nVar.d(n.a); } else { nVar.n(MBridgeH5EndCardView.this.b.getendcard_url()); if (ap.b(MBridgeH5EndCardView.this.b.getendcard_url()) && MBridgeH5EndCardView.this.b.getendcard_url().contains(".zip")) { str2 = "1"; } nVar.o(str2); nVar.d(n.b); } MBridgeH5EndCardView mBridgeH5EndCardView2 = MBridgeH5EndCardView.this; com.mbridge.msdk.foundation.same.report.g.b(nVar, mBridgeH5EndCardView2.unitId, mBridgeH5EndCardView2.b); } MBridgeH5EndCardView.this.notifyListener.a(120, ""); if (z) { return; } try { com.mbridge.msdk.foundation.same.report.d.e eVar = new com.mbridge.msdk.foundation.same.report.d.e(); eVar.a("type", 3); eVar.a("result", 1); com.mbridge.msdk.foundation.same.report.d.d.a().a("2000155", MBridgeH5EndCardView.this.b, eVar); } catch (Throwable th) { af.b("WindVaneWebView", th.getMessage()); } } @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView, int i, String str, String str2) { super.a(webView, i, str, str2); MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this; if (mBridgeH5EndCardView.t) { return; } mBridgeH5EndCardView.notifyListener.a(118, "onReceivedError " + i + str); MBridgeH5EndCardView.this.reportRenderResult(str, 3); MBridgeH5EndCardView.this.notifyListener.a(127, ""); MBridgeH5EndCardView.this.notifyListener.a(129, ""); MBridgeH5EndCardView.this.t = true; } @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView, int i) { super.a(webView, i); af.c("WindVaneWebView", "h5EncardView readyStatus:" + i + "- isError" + MBridgeH5EndCardView.this.t); MBridgeH5EndCardView.this.C = i; if (!MBridgeH5EndCardView.this.t) { MBridgeH5EndCardView.a(MBridgeH5EndCardView.this, System.currentTimeMillis() - MBridgeH5EndCardView.this.D, false); } if (z) { try { com.mbridge.msdk.foundation.same.report.d.e eVar = new com.mbridge.msdk.foundation.same.report.d.e(); eVar.a("type", 3); eVar.a("result", Integer.valueOf(i)); com.mbridge.msdk.foundation.same.report.d.d.a().a("2000155", MBridgeH5EndCardView.this.b, eVar); } catch (Throwable th) { af.b("WindVaneWebView", th.getMessage()); } } } @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void c(WebView webView, int i) { super.c(webView, i); MBridgeH5EndCardView.this.C = i; if (MBridgeH5EndCardView.this.B) { return; } MBridgeH5EndCardView.this.B = true; if (i == 1) { MBridgeH5EndCardView.this.reportRenderResult("success", 4); } else { MBridgeH5EndCardView.this.notifyListener.a(127, ""); MBridgeH5EndCardView.this.reportRenderResult(v8.h.t, 6); } } @Override // com.mbridge.msdk.mbsignalcommon.b.b, com.mbridge.msdk.mbsignalcommon.windvane.d public final void a(WebView webView) { super.a(webView); MBridgeH5EndCardView.this.setCloseVisible(0); } }); if (TextUtils.isEmpty(this.b.getMraid())) { try { this.D = 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.c.m().k(), this.unitId); if (this.x) { if (ap.b(str)) { if (!str.contains("wfr=1")) { if (a3 != null && a3.o() > 0) { } } if (str.contains("wfr=1")) { String[] split = str.split(v8.i.c); if (split != null && split.length > 0) { for (String str2 : split) { if (ap.b(str2) && str2.contains("to") && str2.split(v8.i.b) != null && str2.split(v8.i.b).length > 0) { o = ak.a((Object) str2.split(v8.i.b)[1]); break; } } } o = 20; } else { if (a3 != null && a3.o() > 0) { o = a3.o(); } o = 20; } if (o >= 0) { excuteEndCardShowTask(o); } else { excuteEndCardShowTask(20); } } } } catch (Throwable th) { af.b(MBridgeBaseView.TAG, th.getMessage(), th); } } setHtmlSource(HTMLResourceManager.getInstance().getHtmlContentFromUrl(a2)); if (TextUtils.isEmpty(this.r)) { this.p.loadUrl(a2); } else { this.p.loadDataWithBaseURL(a2, this.r, "text/html", "UTF-8", null); } } else { reportRenderResult("PL URL IS NULL", 3); this.notifyListener.a(127, ""); this.notifyListener.a(129, ""); } this.v = false; } public void reportRenderResult(String str, int i) { if (this.b == null || this.t) { return; } n nVar = new n(); nVar.f(this.b.getRequestId()); nVar.g(this.b.getRequestIdNotice()); nVar.e(this.b.getId()); nVar.b(i); nVar.l(String.valueOf(System.currentTimeMillis() - this.D)); nVar.h(str); String str2 = "2"; if (this.b.getAdType() == 287) { nVar.d("3"); } else if (this.b.getAdType() == 94) { nVar.d("1"); } else if (this.b.getAdType() == 42) { nVar.d("2"); } if (this.b.isMraid()) { nVar.d(n.a); } else { nVar.n(this.b.getendcard_url()); if (ap.b(this.b.getendcard_url()) && this.b.getendcard_url().contains(".zip")) { str2 = "1"; } nVar.o(str2); nVar.d(n.b); } com.mbridge.msdk.foundation.same.report.g.b(nVar, this.unitId, this.b); } public void startCounterEndCardShowTimer() { try { String str = this.b.getendcard_url(); if (ap.b(str) && str.contains("wfl=1")) { String[] split = str.split(v8.i.c); int i = 15; if (split != null && split.length > 0) { for (String str2 : split) { if (ap.b(str2) && str2.contains("timeout") && str2.split(v8.i.b) != null && str2.split(v8.i.b).length > 0) { i = ak.a((Object) str2.split(v8.i.b)[1]); } } } executeEndCardShow(i); } } catch (Throwable th) { af.a(MBridgeBaseView.TAG, th.getMessage()); } } @Override // com.mbridge.msdk.video.module.MBridgeBaseView public void defaultShow() { super.defaultShow(); } @Override // com.mbridge.msdk.video.signal.h public void toggleCloseBtn(int i) { int visibility = this.o.getVisibility(); if (i == 1) { this.F = true; visibility = 0; } else if (i == 2) { this.F = false; if (this.v) { if (!this.O && !this.G) { this.O = true; int i2 = this.z; if (i2 == 0) { this.J = true; } else { this.J = false; if (i2 > -1) { this.q.postDelayed(new e(this), this.z * 1000); } } } } else if (!this.N && !this.G) { this.N = true; int i3 = this.y; if (i3 == 0) { this.I = true; } else { this.I = false; if (i3 > -1) { this.q.postDelayed(new d(this), this.y * 1000); } } } visibility = 8; } setCloseVisible(visibility); } public class d implements Runnable { private MBridgeH5EndCardView b; public d(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } @Override // java.lang.Runnable public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null) { mBridgeH5EndCardView.I = true; } } } public class e implements Runnable { private MBridgeH5EndCardView b; public e(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } @Override // java.lang.Runnable public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null) { mBridgeH5EndCardView.J = true; } } } public void handlerPlayableException(String str) { if (this.t) { return; } this.t = true; this.s = false; if (this.b != null) { n nVar = new n(); nVar.f(this.b.getRequestId()); nVar.g(this.b.getRequestIdNotice()); nVar.e(this.b.getId()); nVar.h(str); com.mbridge.msdk.foundation.same.report.g.a(nVar, this.a.getApplicationContext(), this.unitId); } } public void webviewshow() { WindVaneWebView windVaneWebView = this.p; if (windVaneWebView != null) { windVaneWebView.post(new Runnable() { // from class: com.mbridge.msdk.video.module.MBridgeH5EndCardView.4 @Override // java.lang.Runnable public final void run() { String str; try { af.a(MBridgeBaseView.TAG, "webviewshow"); try { int[] iArr = new int[2]; MBridgeH5EndCardView.this.p.getLocationOnScreen(iArr); af.b(MBridgeBaseView.TAG, "coordinate:" + iArr[0] + "--" + iArr[1]); JSONObject jSONObject = new JSONObject(); Context c2 = com.mbridge.msdk.foundation.controller.c.m().c(); if (c2 != null) { jSONObject.put("startX", ak.b(c2, iArr[0])); jSONObject.put("startY", ak.b(c2, iArr[1])); jSONObject.put(com.mbridge.msdk.foundation.same.a.l, ak.d(c2)); } str = jSONObject.toString(); } catch (Throwable th) { af.b(MBridgeBaseView.TAG, th.getMessage(), th); str = ""; } g.a().a((WebView) MBridgeH5EndCardView.this.p, "webviewshow", Base64.encodeToString(str.toString().getBytes(), 2)); MBridgeH5EndCardView.this.notifyListener.a(109, ""); MBridgeH5EndCardView.d(MBridgeH5EndCardView.this); MBridgeH5EndCardView.this.startCounterEndCardShowTimer(); g a2 = g.a(); MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this; a2.a((WebView) mBridgeH5EndCardView.p, "oncutoutfetched", Base64.encodeToString(mBridgeH5EndCardView.M.getBytes(), 0)); MBridgeH5EndCardView.f(MBridgeH5EndCardView.this); } catch (Exception e2) { e2.printStackTrace(); } } }); } } public void orientation(Configuration configuration) { try { JSONObject jSONObject = new JSONObject(); if (configuration.orientation == 2) { jSONObject.put("orientation", "landscape"); } else { jSONObject.put("orientation", "portrait"); } g.a().a((WebView) this.p, "orientation", Base64.encodeToString(jSONObject.toString().getBytes(), 2)); } catch (Exception e2) { e2.printStackTrace(); } } public boolean canBackPress() { ImageView imageView = this.o; return imageView != null && imageView.getVisibility() == 0; } public void setCloseVisible(int i) { if (this.e) { this.o.setVisibility(i); } } public void setCloseVisibleForMraid(int i) { if (this.e) { this.K = true; if (i == 4) { this.o.setImageDrawable(new ColorDrawable(16711680)); } else { this.o.setImageResource(findDrawable("mbridge_reward_close")); } this.o.setVisibility(0); } } public RelativeLayout.LayoutParams b() { return new RelativeLayout.LayoutParams(-1, -1); } public void e() { if (this.e) { setMatchParent(); } } public String a() { CampaignEx campaignEx = this.b; if (campaignEx == null) { this.E = false; return null; } this.E = true; if (campaignEx.isMraid()) { this.x = 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) { return mraid; } th.printStackTrace(); return mraid; } } return this.b.getEndScreenUrl(); } String str = this.b.getendcard_url(); if (!ap.a(str)) { this.x = true; String h5ResAddress = H5DownLoadManager.getInstance().getH5ResAddress(str); if (TextUtils.isEmpty(h5ResAddress)) { 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.x = false; excuteTask(); return endScreenUrl; } } catch (Throwable th2) { af.b(MBridgeBaseView.TAG, th2.getMessage()); } return str + "&native_adtype=" + this.b.getAdType(); } return h5ResAddress + "&native_adtype=" + this.b.getAdType(); } this.x = false; return this.b.getEndScreenUrl(); } public class f implements Runnable { private MBridgeH5EndCardView b; public f(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } @Override // java.lang.Runnable public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null) { if (!mBridgeH5EndCardView.K) { MBridgeH5EndCardView.this.setCloseVisible(0); } this.b.F = true; } } } public void excuteTask() { if (this.x || this.y <= -1) { return; } this.q.postDelayed(new f(this), this.y * 1000); } public class b implements Runnable { private MBridgeH5EndCardView b; public b(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } @Override // java.lang.Runnable public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView == null || mBridgeH5EndCardView.B) { return; } this.b.B = true; this.b.s = false; MBridgeH5EndCardView.this.reportRenderResult("timeout", 5); this.b.notifyListener.a(127, ""); af.a(MBridgeBaseView.TAG, "notify TYPE_NOTIFY_SHOW_NATIVE_ENDCARD"); } } public void executeEndCardShow(int i) { this.q.postDelayed(new b(this), i * 1000); } public void excuteEndCardShowTask(int i) { this.q.postDelayed(new c(this, i), i * 1000); } 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 // java.lang.Runnable public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.a; if (mBridgeH5EndCardView == null || mBridgeH5EndCardView.b == null) { return; } try { if (!mBridgeH5EndCardView.A) { this.a.A = true; n nVar = new n("m_download_end", 12, (this.b * 1000) + "", this.a.b.getendcard_url(), this.a.b.getId(), this.a.unitId, "ready timeout", (ap.b(this.a.b.getendcard_url()) && this.a.b.getendcard_url().contains(".zip")) ? "1" : "2"); try { if (this.a.b.getAdType() == 287) { nVar.d("3"); } else if (this.a.b.getAdType() == 94) { nVar.d("1"); } else if (this.a.b.getAdType() == 42) { nVar.d("2"); } } catch (Exception e) { e.printStackTrace(); } nVar.f(this.a.b.getRequestId()); nVar.s(this.a.b.getCurrentLocalRid()); nVar.g(this.a.b.getRequestIdNotice()); nVar.c(this.a.b.getAdSpaceT()); this.a.isLoadSuccess(); return; } af.c(MBridgeBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return"); } catch (Throwable th) { af.b(MBridgeBaseView.TAG, th.getMessage(), th); } } } public void onBackPress() { boolean z; if (this.F || (((z = this.G) && this.H) || (!(z || !this.I || this.v) || (!z && this.J && this.v)))) { onCloseViewClick(); } } public void release() { Handler handler = this.q; if (handler != null) { handler.removeCallbacksAndMessages(null); this.q = null; } Handler handler2 = this.u; if (handler2 != null) { handler2.removeCallbacksAndMessages(null); this.u = null; } this.n.removeAllViews(); this.p.release(); this.p = null; } public void volumeChange(double d2) { com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(this.p, d2); } @Override // android.view.View 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.p, "true"); } else { com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(this.p, "false"); } } @Override // android.view.View public void onVisibilityChanged(View view, int i) { super.onVisibilityChanged(view, i); if (i != 0 || this.L) { return; } this.L = true; setFocusableInTouchMode(true); requestFocus(); requestFocusFromTouch(); } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardViewDiff public void reportOpen(String str) { CampaignEx mraidCampaign = getMraidCampaign(); if (mraidCampaign != null) { new h(getContext()).a(mraidCampaign.getRequestId(), mraidCampaign.getRequestIdNotice(), mraidCampaign.getId(), this.unitId, str, this.b.isBidCampaign()); } } @Override // com.mbridge.msdk.video.module.MBridgeH5EndCardViewDiff, com.mbridge.msdk.mbsignalcommon.mraid.b public void open(String str) { super.open(str); } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public void close() { try { onCloseViewClick(); } catch (Exception e2) { af.b(MBridgeBaseView.TAG, e2.getMessage()); } } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public void unload() { close(); } @Override // com.mbridge.msdk.mbsignalcommon.mraid.b public void useCustomClose(boolean z) { try { setCloseVisibleForMraid(z ? 4 : 0); } catch (Exception e2) { af.b(MBridgeBaseView.TAG, e2.getMessage()); } } public void setNotchValue(String str, int i, int i2, int i3, int i4) { this.M = str; CampaignEx campaignEx = this.b; if (campaignEx == null || campaignEx.getAdSpaceT() == 2) { return; } af.b(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.o.getLayoutParams(); int a2 = ak.a(getContext(), 20.0f); layoutParams.setMargins(i + a2, i3 + a2, i2 + a2, i4 + a2); this.o.setLayoutParams(layoutParams); } @Override // com.mbridge.msdk.out.BaseTrackingListener public void onStartRedirection(Campaign campaign, String str) { aj.b(campaign, this); } @Override // com.mbridge.msdk.out.BaseTrackingListener public void onFinishRedirection(Campaign campaign, String str) { if (campaign == null) { return; } aj.a(campaign, this); } @Override // com.mbridge.msdk.out.BaseTrackingListener public void onRedirectionFailed(Campaign campaign, String str) { if (campaign == null) { return; } aj.a(campaign, this); } /* JADX WARN: Can't wrap try/catch for region: R(19:8|9|(1:63)(1:13)|14|(1:16)(2:59|(1:61)(14:62|18|19|20|(1:22)(2:50|(1:52)(2:53|(1:55)))|23|24|25|26|(1:28)|29|(1:31)|33|(1:44)(4:37|(1:39)(1:43)|40|42)))|17|18|19|20|(0)(0)|23|24|25|26|(0)|29|(0)|33|(2:35|44)(1:45)) */ /* JADX WARN: Code restructure failed: missing block: B:46:0x00f9, code lost: r0 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:48:0x010d, code lost: com.mbridge.msdk.foundation.tools.af.b(com.mbridge.msdk.video.module.MBridgeBaseView.TAG, r0.getMessage()); */ /* JADX WARN: Code restructure failed: missing block: B:56:0x0094, code lost: r0 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:58:0x00b2, code lost: r0.printStackTrace(); */ /* JADX WARN: Removed duplicated region for block: B:22:0x008e A[Catch: all -> 0x002d, NullPointerException -> 0x0094, TryCatch #1 {NullPointerException -> 0x0094, blocks: (B:20:0x0084, B:22:0x008e, B:50:0x0096, B:52:0x00a0, B:53:0x00a4, B:55:0x00ae), top: B:19:0x0084, outer: #2 }] */ /* JADX WARN: Removed duplicated region for block: B:28:0x00f1 A[Catch: all -> 0x002d, Exception -> 0x00f9, TryCatch #0 {Exception -> 0x00f9, blocks: (B:26:0x00db, B:28:0x00f1, B:29:0x00fb, B:31:0x0105), top: B:25:0x00db, outer: #2 }] */ /* JADX WARN: Removed duplicated region for block: B:31:0x0105 A[Catch: all -> 0x002d, Exception -> 0x00f9, TRY_LEAVE, TryCatch #0 {Exception -> 0x00f9, blocks: (B:26:0x00db, B:28:0x00f1, B:29:0x00fb, B:31:0x0105), top: B:25:0x00db, outer: #2 }] */ /* JADX WARN: Removed duplicated region for block: B:50:0x0096 A[Catch: all -> 0x002d, NullPointerException -> 0x0094, TryCatch #1 {NullPointerException -> 0x0094, blocks: (B:20:0x0084, B:22:0x008e, B:50:0x0096, B:52:0x00a0, B:53:0x00a4, B:55:0x00ae), top: B:19:0x0084, outer: #2 }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public static /* synthetic */ void a(com.mbridge.msdk.video.module.MBridgeH5EndCardView r20, long r21, boolean r23) { /* Method dump skipped, instructions count: 358 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.mbridge.msdk.video.module.MBridgeH5EndCardView.a(com.mbridge.msdk.video.module.MBridgeH5EndCardView, long, boolean):void"); } public static /* synthetic */ 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(MRAIDCommunicatorUtil.KEY_PLACEMENTTYPE, "Interstitial"); hashMap.put("state", MRAIDCommunicatorUtil.STATES_DEFAULT); hashMap.put(MRAIDCommunicatorUtil.KEY_VIEWABLE, "true"); hashMap.put(MRAIDCommunicatorUtil.KEY_CURRENTORIENTATION, jSONObject); if (mBridgeH5EndCardView.getContext() instanceof Activity) { float j = ab.j(mBridgeH5EndCardView.getContext()); float h = ab.h(mBridgeH5EndCardView.getContext()); DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity) mBridgeH5EndCardView.getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); float f2 = displayMetrics.widthPixels; float f3 = displayMetrics.heightPixels; com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBridgeH5EndCardView.p, j, h); com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(mBridgeH5EndCardView.p, f2, f3); } com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.p, r7.getLeft(), mBridgeH5EndCardView.p.getTop(), mBridgeH5EndCardView.p.getWidth(), mBridgeH5EndCardView.p.getHeight()); com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBridgeH5EndCardView.p, r13.getLeft(), mBridgeH5EndCardView.p.getTop(), mBridgeH5EndCardView.p.getWidth(), mBridgeH5EndCardView.p.getHeight()); com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.p, hashMap); com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.p, com.mbridge.msdk.mbsignalcommon.mraid.d.a); com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.p); } public static /* synthetic */ void f(MBridgeH5EndCardView mBridgeH5EndCardView) { try { CampaignEx campaignEx = mBridgeH5EndCardView.b; if (campaignEx != null) { campaignEx.setCampaignUnitId(mBridgeH5EndCardView.unitId); com.mbridge.msdk.foundation.d.b.a().c(mBridgeH5EndCardView.unitId + "_1"); com.mbridge.msdk.foundation.d.b.a().a(mBridgeH5EndCardView.unitId + "_2", mBridgeH5EndCardView.b); } CampaignEx campaignEx2 = mBridgeH5EndCardView.b; if (campaignEx2 == null || !campaignEx2.isMraid()) { return; } ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.m().c()); imageView.setBackgroundResource(x.a(com.mbridge.msdk.foundation.controller.c.m().c(), "mbridge_reward_notice", "drawable")); ImageView imageView2 = mBridgeH5EndCardView.o; RelativeLayout.LayoutParams layoutParams = imageView2 != null ? (RelativeLayout.LayoutParams) imageView2.getLayoutParams() : null; RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f), ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f)); layoutParams2.addRule(9); layoutParams2.addRule(10); if (layoutParams != null) { layoutParams2.leftMargin = layoutParams.rightMargin; layoutParams2.topMargin = layoutParams.topMargin; layoutParams2.width = layoutParams.width; layoutParams2.height = layoutParams.height; } else { layoutParams2.leftMargin = ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f); layoutParams2.topMargin = ak.a(com.mbridge.msdk.foundation.controller.c.m().c(), 12.0f); } mBridgeH5EndCardView.addView(imageView, layoutParams2); ak.a(4, imageView, mBridgeH5EndCardView.b, com.mbridge.msdk.foundation.controller.c.m().c(), false, new com.mbridge.msdk.foundation.d.a() { // from class: com.mbridge.msdk.video.module.MBridgeH5EndCardView.5 @Override // com.mbridge.msdk.foundation.d.a public final void showed() { String str; try { JSONObject jSONObject = new JSONObject(); if (com.mbridge.msdk.foundation.controller.c.m().c() != null) { jSONObject.put("status", 1); } str = jSONObject.toString(); } catch (Throwable th) { af.b(MBridgeBaseView.TAG, th.getMessage(), th); str = ""; } g.a().a((WebView) MBridgeH5EndCardView.this.p, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2)); } @Override // com.mbridge.msdk.foundation.d.a public final void close() { String str; try { JSONObject jSONObject = new JSONObject(); if (com.mbridge.msdk.foundation.controller.c.m().c() != null) { jSONObject.put("status", 2); } str = jSONObject.toString(); } catch (Throwable th) { af.b(MBridgeBaseView.TAG, th.getMessage(), th); str = ""; } g.a().a((WebView) MBridgeH5EndCardView.this.p, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2)); } @Override // com.mbridge.msdk.foundation.d.a public final void summit(String str) { String str2; try { JSONObject jSONObject = new JSONObject(); if (com.mbridge.msdk.foundation.controller.c.m().c() != null) { jSONObject.put("status", 2); } str2 = jSONObject.toString(); } catch (Throwable th) { af.b(MBridgeBaseView.TAG, th.getMessage(), th); str2 = ""; } g.a().a((WebView) MBridgeH5EndCardView.this.p, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2)); } }); } catch (Exception e2) { e2.printStackTrace(); } } }