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 androidx.constraintlayout.core.motion.utils.TypedValues; import com.baidu.mobads.sdk.internal.bf; 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.p; import com.mbridge.msdk.foundation.tools.aa; import com.mbridge.msdk.foundation.tools.ae; import com.mbridge.msdk.foundation.tools.s; import com.mbridge.msdk.foundation.tools.w; import com.mbridge.msdk.foundation.webview.BrowserView; import com.mbridge.msdk.mbjscommon.windvane.AbsFeedBackForH5; import com.mbridge.msdk.mbjscommon.windvane.WindVaneWebView; import com.mbridge.msdk.mbjscommon.windvane.h; import com.mbridge.msdk.video.js.g; import com.mbridge.msdk.widget.FeedBackButton; import java.io.File; import java.util.HashMap; import org.json.JSONObject; public class MBridgeH5EndCardView extends MBridgeBaseView implements com.mbridge.msdk.mbjscommon.mraid.b, g { private int A = 1; private int B = 1; private boolean C = false; private boolean D = false; private int E = 1; private long F = 0; private boolean G = false; private boolean H = false; private boolean I = false; private boolean J = false; /* renamed from: K reason: collision with root package name */ private boolean f128K = false; private boolean L = false; private boolean M = false; private boolean N = false; private String O = ""; private com.mbridge.msdk.video.js.factory.b P; private boolean Q = false; private boolean R = false; protected View m; protected RelativeLayout n; protected ImageView o; protected WindVaneWebView p; protected Handler q = new Handler(); protected String r; protected boolean s = false; protected boolean t = false; protected String u; Handler v = new Handler(Looper.getMainLooper()) { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass1 */ public final void handleMessage(Message message) { super.handleMessage(message); if (message.what == 100) { if (MBridgeH5EndCardView.this.G) { MBridgeH5EndCardView.this.e.a(122, ""); } MBridgeH5EndCardView.this.e.a(103, ""); } } }; boolean w = false; private FeedBackButton x; private boolean y = false; private boolean z = false; @Override // com.mbridge.msdk.mbjscommon.mraid.b public void expand(String str, boolean z2) { } public void install(CampaignEx campaignEx) { } public void readyStatus(int i) { } public MBridgeH5EndCardView(Context context) { super(context); } public MBridgeH5EndCardView(Context context, AttributeSet attributeSet) { super(context, attributeSet); } @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")); this.p = new WindVaneWebView(getContext()); this.p.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1)); this.n.addView(this.p); this.f = isNotNULL(this.o, this.p); } catch (Exception unused) { this.f = false; } addView(this.m, b()); c(); e(); } } /* access modifiers changed from: protected */ @Override // com.mbridge.msdk.video.module.MBridgeBaseView public final void c() { super.c(); if (this.f) { this.o.setOnClickListener(new View.OnClickListener() { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass2 */ public final void onClick(View view) { MBridgeH5EndCardView.this.onCloseViewClick(); } }); } } public void onCloseViewClick() { try { if (this.p != null) { h.a().a((WebView) this.p, "onSystemDestory", ""); new Thread(new a(this)).start(); return; } 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()); w.a(MBridgeBaseView.TAG, e2.getMessage()); } } /* access modifiers changed from: private */ public class a implements Runnable { private MBridgeH5EndCardView b; public a(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } public final void run() { try { Thread.sleep(300); } catch (InterruptedException e) { w.d("CloseRunnable", e.getMessage()); } MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null && mBridgeH5EndCardView.v != null) { this.b.v.sendEmptyMessage(100); } } } public void setError(boolean z2) { this.t = z2; } /* JADX WARNING: Removed duplicated region for block: B:49:0x0118 A[Catch:{ all -> 0x0139 }] */ /* JADX WARNING: Removed duplicated region for block: B:50:0x0130 A[Catch:{ all -> 0x0139 }] */ public void preLoadData(com.mbridge.msdk.video.js.factory.b bVar) { int i; this.P = bVar; String a2 = a(); if (!this.f || this.b == null || TextUtils.isEmpty(a2)) { reportRenderResult("PL URL IS NULL", 3); this.e.a(127, ""); this.e.a(129, ""); } else { this.F = System.currentTimeMillis(); try { reportRenderResult("start", 0); } catch (Exception unused) { } BrowserView.MBDownloadListener mBDownloadListener = new BrowserView.MBDownloadListener(this.b); mBDownloadListener.setTitle(this.b.getAppName()); this.p.setDownloadListener(mBDownloadListener); this.p.setCampaignId(this.b.getId()); setCloseVisible(8); this.p.setApiManagerJSFactory(bVar); if (this.b.isMraid()) { this.p.setMraidObject(this); } this.p.setWebViewListener(new com.mbridge.msdk.mbjscommon.c.b() { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass3 */ @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d public final void a(WebView webView, String str) { super.a(webView, str); w.d("========", "===========finish+" + str); if (!MBridgeH5EndCardView.this.t) { w.d("========", "===========finish loadSuccess:" + MBridgeH5EndCardView.this.s); MBridgeH5EndCardView.this.s = true; w.a(MBridgeBaseView.TAG, "onPageFinished,url:" + str); MBridgeH5EndCardView.this.e.a(100, ""); if (MBridgeH5EndCardView.this.b != null) { p pVar = new p(); pVar.k(MBridgeH5EndCardView.this.b.getRequestId()); pVar.l(MBridgeH5EndCardView.this.b.getRequestIdNotice()); pVar.n(MBridgeH5EndCardView.this.b.getId()); pVar.d(1); pVar.q(String.valueOf(System.currentTimeMillis() - MBridgeH5EndCardView.this.F)); pVar.p("onPageFinished"); String str2 = "2"; if (MBridgeH5EndCardView.this.b.getAdType() == 287) { pVar.h("3"); } else if (MBridgeH5EndCardView.this.b.getAdType() == 94) { pVar.h("1"); } else if (MBridgeH5EndCardView.this.b.getAdType() == 42) { pVar.h(str2); } if (MBridgeH5EndCardView.this.b.isMraid()) { pVar.a(p.a); } else { pVar.f(MBridgeH5EndCardView.this.b.getendcard_url()); if (ae.b(MBridgeH5EndCardView.this.b.getendcard_url()) && MBridgeH5EndCardView.this.b.getendcard_url().contains(".zip")) { str2 = "1"; } pVar.g(str2); pVar.a(p.b); } com.mbridge.msdk.foundation.same.report.c.b(pVar, MBridgeH5EndCardView.this.u); } MBridgeH5EndCardView.this.e.a(120, ""); } } @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d public final void a(WebView webView, int i, String str, String str2) { super.a(webView, i, str, str2); w.d("========", "===========onReceivedError"); if (!MBridgeH5EndCardView.this.t) { w.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.t = true; } } @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d public final void a(WebView webView, int i) { super.a(webView, i); w.b("WindVaneWebView", "h5EncardView readyStatus:" + i + "- isError" + MBridgeH5EndCardView.this.t); MBridgeH5EndCardView.this.E = i; if (!MBridgeH5EndCardView.this.t) { MBridgeH5EndCardView.a(MBridgeH5EndCardView.this, System.currentTimeMillis() - MBridgeH5EndCardView.this.F, false); } } @Override // com.mbridge.msdk.mbjscommon.c.b, com.mbridge.msdk.mbjscommon.windvane.d public final void c(WebView webView, int i) { super.c(webView, i); MBridgeH5EndCardView.this.E = i; if (!MBridgeH5EndCardView.this.D) { MBridgeH5EndCardView.this.D = true; if (i == 1) { MBridgeH5EndCardView.this.reportRenderResult(bf.o, 4); return; } MBridgeH5EndCardView.this.e.a(127, ""); MBridgeH5EndCardView.this.reportRenderResult("failed", 6); } } }); if (TextUtils.isEmpty(this.b.getMraid())) { try { this.F = 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.f().k(), this.u); if (this.z && ae.b(str) && (str.contains("wfr=1") || (a3 != null && a3.n() > 0))) { w.d(MBridgeBaseView.TAG, "需要上报endcard加载时间"); if (str.contains("wfr=1")) { String[] split = str.split("&"); if (split != null && split.length > 0) { int length = split.length; int i2 = 0; while (true) { if (i2 >= length) { break; } String str2 = split[i2]; if (ae.b(str2) && str2.contains(TypedValues.TransitionType.S_TO) && str2.split("=") != null && str2.split("=").length > 0) { i = aa.a((Object) str2.split("=")[1]); w.b(MBridgeBaseView.TAG, "从url获取的waitingtime:" + i); break; } i2++; } } } else if (a3 != null && a3.n() > 0) { i = a3.n(); if (i < 0) { excuteEndCardShowTask(i); w.b(MBridgeBaseView.TAG, "开启excuteEndCardShowTask:" + i); } else { excuteEndCardShowTask(20); w.b(MBridgeBaseView.TAG, "开启excuteEndCardShowTask: 20s def"); } } i = 20; if (i < 0) { } } } catch (Throwable th) { w.b(MBridgeBaseView.TAG, th.getMessage(), th); } } setHtmlSource(HTMLResourceManager.getInstance().getHtmlContentFromUrl(a2)); if (TextUtils.isEmpty(this.r)) { w.a(MBridgeBaseView.TAG, "load url:" + a2); this.p.loadUrl(a2); } else { w.a(MBridgeBaseView.TAG, "load html..."); this.p.loadDataWithBaseURL(a2, this.r, "text/html", "UTF-8", null); } } this.w = false; } public void reportRenderResult(String str, int i) { if (this.b != null && !this.t) { p pVar = new p(); pVar.k(this.b.getRequestId()); pVar.l(this.b.getRequestIdNotice()); pVar.n(this.b.getId()); pVar.d(i); pVar.q(String.valueOf(System.currentTimeMillis() - this.F)); pVar.p(str); String str2 = "2"; if (this.b.getAdType() == 287) { pVar.h("3"); } else if (this.b.getAdType() == 94) { pVar.h("1"); } else if (this.b.getAdType() == 42) { pVar.h(str2); } if (this.b.isMraid()) { pVar.a(p.a); } else { pVar.f(this.b.getendcard_url()); if (ae.b(this.b.getendcard_url()) && this.b.getendcard_url().contains(".zip")) { str2 = "1"; } pVar.g(str2); pVar.a(p.b); } com.mbridge.msdk.foundation.same.report.c.b(pVar, this.u); } } public void startCounterEndCardShowTimer() { try { String str = this.b.getendcard_url(); int i = 15; if (ae.b(str) && str.contains("wfl=1")) { String[] split = str.split("&"); if (split != null && split.length > 0) { for (String str2 : split) { if (ae.b(str2) && str2.contains("timeout") && str2.split("=") != null && str2.split("=").length > 0) { i = aa.a((Object) str2.split("=")[1]); w.b(MBridgeBaseView.TAG, "从url获取的wfl timeout :" + i); } } } executeEndCardShow(i); } } catch (Throwable th) { w.a(MBridgeBaseView.TAG, th.getMessage()); } } @Override // com.mbridge.msdk.video.module.MBridgeBaseView public void defaultShow() { super.defaultShow(); } @Override // com.mbridge.msdk.video.js.g public void notifyCloseBtn(int i) { if (i == 0) { this.I = true; } else if (i == 1) { this.J = true; } } @Override // com.mbridge.msdk.video.js.g public void toggleCloseBtn(int i) { int visibility = this.o.getVisibility(); if (i == 1) { this.H = true; visibility = 0; } else if (i == 2) { this.H = false; visibility = 8; if (this.w) { if (!this.R && !this.I) { this.R = true; int i2 = this.B; if (i2 == 0) { this.L = true; } else { this.L = false; if (i2 > -1) { this.q.postDelayed(new e(this), (long) (this.B * 1000)); } } } } else if (!this.Q && !this.I) { this.Q = true; int i3 = this.A; if (i3 == 0) { this.f128K = true; } else { this.f128K = false; if (i3 > -1) { this.q.postDelayed(new d(this), (long) (this.A * 1000)); } } } } setCloseVisible(visibility); } /* access modifiers changed from: private */ public class d implements Runnable { private MBridgeH5EndCardView b; public d(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null) { mBridgeH5EndCardView.f128K = true; } } } /* access modifiers changed from: private */ public class e implements Runnable { private MBridgeH5EndCardView b; public e(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null) { mBridgeH5EndCardView.L = true; } } } public void handlerPlayableException(String str) { w.d("========", "===========handlerPlayableException"); if (!this.t) { this.t = true; this.s = false; if (this.b != null) { p pVar = new p(); pVar.k(this.b.getRequestId()); pVar.l(this.b.getRequestIdNotice()); pVar.n(this.b.getId()); pVar.p(str); com.mbridge.msdk.foundation.same.report.c.d(pVar, this.a.getApplicationContext(), this.u); } } } public void webviewshow() { WindVaneWebView windVaneWebView = this.p; if (windVaneWebView != null) { windVaneWebView.post(new Runnable() { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass4 */ public final void run() { String str; try { w.a(MBridgeBaseView.TAG, "webviewshow"); try { int[] iArr = new int[2]; MBridgeH5EndCardView.this.p.getLocationOnScreen(iArr); w.d(MBridgeBaseView.TAG, "coordinate:" + iArr[0] + "--" + iArr[1]); JSONObject jSONObject = new JSONObject(); Context j = com.mbridge.msdk.foundation.controller.a.f().j(); if (j != null) { jSONObject.put("startX", aa.a(j, (float) iArr[0])); jSONObject.put("startY", aa.a(j, (float) iArr[1])); jSONObject.put(com.mbridge.msdk.foundation.same.a.r, (double) aa.d(j)); } str = jSONObject.toString(); } catch (Throwable th) { w.b(MBridgeBaseView.TAG, th.getMessage(), th); str = ""; } h.a().a((WebView) MBridgeH5EndCardView.this.p, "webviewshow", Base64.encodeToString(str.toString().getBytes(), 2)); MBridgeH5EndCardView.this.e.a(109, ""); MBridgeH5EndCardView.d(MBridgeH5EndCardView.this); MBridgeH5EndCardView.this.startCounterEndCardShowTimer(); h.a().a((WebView) MBridgeH5EndCardView.this.p, "oncutoutfetched", Base64.encodeToString(MBridgeH5EndCardView.this.O.getBytes(), 0)); MBridgeH5EndCardView.f(MBridgeH5EndCardView.this); } catch (Exception e) { e.printStackTrace(); } } }); } } public void orientation(Configuration configuration) { try { JSONObject jSONObject = new JSONObject(); if (configuration.orientation == 2) { jSONObject.put("orientation", "landscape"); } else { jSONObject.put("orientation", "portrait"); } h.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 boolean isLoadSuccess() { return this.s; } public void setUnitId(String str) { this.u = str; } public void setCloseDelayShowTime(int i) { this.A = i; } public void setPlayCloseBtnTm(int i) { this.B = i; } public void setHtmlSource(String str) { this.r = str; } public void setCloseVisible(int i) { if (this.f) { this.o.setVisibility(i); } } public void setCloseVisibleForMraid(int i) { if (this.f) { this.M = true; if (i == 4) { this.o.setImageDrawable(new ColorDrawable(16711680)); } else { this.o.setImageResource(findDrawable("mbridge_reward_close")); } this.o.setVisibility(0); } } /* access modifiers changed from: protected */ public RelativeLayout.LayoutParams b() { return new RelativeLayout.LayoutParams(-1, -1); } /* access modifiers changed from: protected */ public void e() { if (this.f) { setMatchParent(); } } /* access modifiers changed from: protected */ public String a() { if (this.b != null) { this.G = true; if (this.b.isMraid()) { this.z = false; String mraid = this.b.getMraid(); if (!TextUtils.isEmpty(mraid)) { File file = new File(mraid); try { if (!file.exists() || !file.isFile() || !file.canRead()) { w.b(MBridgeBaseView.TAG, "Mraid file not found. Will use endcard url."); return this.b.getEndScreenUrl(); } w.b(MBridgeBaseView.TAG, "Mraid file " + mraid); return "file:////" + mraid; } catch (Throwable th) { if (!MBridgeConstans.DEBUG) { return mraid; } th.printStackTrace(); return mraid; } } else { String endScreenUrl = this.b.getEndScreenUrl(); w.d(MBridgeBaseView.TAG, "getURL playable=false endscreenurl兜底:" + endScreenUrl); return endScreenUrl; } } else { String str = this.b.getendcard_url(); if (!ae.a(str)) { this.z = 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 endScreenUrl2 = this.b.getEndScreenUrl(); if (TextUtils.isEmpty(endScreenUrl2)) { return null; } this.z = false; excuteTask(); return endScreenUrl2; } } catch (Throwable th2) { w.d(MBridgeBaseView.TAG, th2.getMessage()); } w.b(MBridgeBaseView.TAG, "getURL playable=true endcard本地资源地址为空拿服务端地址:" + str); return str + "&native_adtype=" + this.b.getAdType(); } w.b(MBridgeBaseView.TAG, "getURL playable=true 资源不为空endcard地址:" + h5ResAddress); return h5ResAddress + "&native_adtype=" + this.b.getAdType(); } this.z = false; String endScreenUrl3 = this.b.getEndScreenUrl(); w.d(MBridgeBaseView.TAG, "getURL playable=false endscreenurl兜底:" + endScreenUrl3); return endScreenUrl3; } } else { this.G = false; w.d(MBridgeBaseView.TAG, "getURL playable=false url为空"); return null; } } /* access modifiers changed from: private */ public class f implements Runnable { private MBridgeH5EndCardView b; public f(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null) { if (!mBridgeH5EndCardView.M) { MBridgeH5EndCardView.this.setCloseVisible(0); } this.b.H = true; } } } public void excuteTask() { if (!this.z && this.A > -1) { this.q.postDelayed(new f(this), (long) (this.A * 1000)); } } /* access modifiers changed from: private */ public class b implements Runnable { private MBridgeH5EndCardView b; public b(MBridgeH5EndCardView mBridgeH5EndCardView) { this.b = mBridgeH5EndCardView; } public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.b; if (mBridgeH5EndCardView != null && !mBridgeH5EndCardView.D) { this.b.D = true; this.b.s = false; MBridgeH5EndCardView.this.reportRenderResult("timeout", 5); this.b.e.a(127, ""); w.a(MBridgeBaseView.TAG, "notify TYPE_NOTIFY_SHOW_NATIVE_ENDCARD"); } } } public void executeEndCardShow(int i) { this.q.postDelayed(new b(this), (long) (i * 1000)); } public void excuteEndCardShowTask(int i) { this.q.postDelayed(new c(this, i), (long) (i * 1000)); } /* access modifiers changed from: private */ public static class c implements Runnable { private MBridgeH5EndCardView a; private int b; public c(MBridgeH5EndCardView mBridgeH5EndCardView, int i) { this.a = mBridgeH5EndCardView; this.b = i; } public final void run() { MBridgeH5EndCardView mBridgeH5EndCardView = this.a; if (mBridgeH5EndCardView != null && mBridgeH5EndCardView.b != null) { try { if (this.a.C) { w.b(MBridgeBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return"); return; } this.a.C = true; String str = (!ae.b(this.a.b.getendcard_url()) || !this.a.b.getendcard_url().contains(".zip")) ? "2" : "1"; p pVar = new p("2000043", 12, (this.b * 1000) + "", this.a.b.getendcard_url(), this.a.b.getId(), this.a.u, "ready timeout", str); try { if (this.a.b.getAdType() == 287) { pVar.h("3"); } else if (this.a.b.getAdType() == 94) { pVar.h("1"); } else if (this.a.b.getAdType() == 42) { pVar.h("2"); } } catch (Exception e) { e.printStackTrace(); } pVar.k(this.a.b.getRequestId()); pVar.l(this.a.b.getRequestIdNotice()); pVar.b(this.a.b.getAdSpaceT()); com.mbridge.msdk.foundation.same.report.c.a(pVar, this.a.u); this.a.isLoadSuccess(); } catch (Throwable th) { w.b(MBridgeBaseView.TAG, th.getMessage(), th); } } } } public boolean isPlayable() { return this.z; } public void onBackPress() { boolean z2; if (this.H || (((z2 = this.I) && this.J) || ((!z2 && this.f128K && !this.w) || (!z2 && this.L && this.w)))) { onCloseViewClick(); } } public void setLoadPlayable(boolean z2) { this.w = z2; } public void release() { Handler handler = this.q; if (handler != null) { handler.removeCallbacksAndMessages(null); this.q = null; } Handler handler2 = this.v; if (handler2 != null) { handler2.removeCallbacksAndMessages(null); this.v = null; } this.n.removeAllViews(); this.p.release(); this.p = null; } public void volumeChange(double d2) { com.mbridge.msdk.mbjscommon.mraid.a.a().a(this.p, d2); } public void onWindowFocusChanged(boolean z2) { super.onWindowFocusChanged(z2); if (this.b != null && this.b.isMraid()) { if (z2) { com.mbridge.msdk.mbjscommon.mraid.a.a().b(this.p, "true"); } else { com.mbridge.msdk.mbjscommon.mraid.a.a().b(this.p, "false"); } } } /* access modifiers changed from: protected */ public void onVisibilityChanged(View view, int i) { super.onVisibilityChanged(view, i); if (i == 0 && !this.N) { this.N = true; setFocusableInTouchMode(true); requestFocus(); requestFocusFromTouch(); } } @Override // com.mbridge.msdk.mbjscommon.mraid.b public void open(final String str) { w.d("EndCard_MRAID", "open : " + str); try { if (this.b == null || !this.b.needShowIDialog() || !com.mbridge.msdk.click.c.a(this.b)) { a(str); return; } AnonymousClass7 r6 = new com.mbridge.msdk.widget.dialog.a() { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass7 */ @Override // com.mbridge.msdk.widget.dialog.a public final void b() { } @Override // com.mbridge.msdk.widget.dialog.a public final void a() { MBridgeH5EndCardView.this.a((MBridgeH5EndCardView) str); } @Override // com.mbridge.msdk.widget.dialog.a public final void c() { a(); } }; if (getContext() != null && this.b != null && !new com.mbridge.msdk.click.b(getContext(), this.u).b(this.b)) { com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.a.f().k(), this.u, false); com.mbridge.msdk.mbjscommon.confirmation.e.a().a(com.mbridge.msdk.videocommon.d.c.a, this.b, getContext(), this.u, r6); } } catch (Exception e2) { w.d(MBridgeBaseView.TAG, e2.getMessage()); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void a(String str) { try { String clickURL = this.b.getClickURL(); if (!TextUtils.isEmpty(str)) { this.b.setClickURL(str); b(str); } new com.mbridge.msdk.click.b(getContext(), this.u).c(this.b); this.b.setClickURL(clickURL); this.e.a(126, ""); } catch (Exception e2) { w.d(MBridgeBaseView.TAG, e2.getMessage()); } } private void b(String str) { CampaignEx mraidCampaign = getMraidCampaign(); if (mraidCampaign != null) { new com.mbridge.msdk.foundation.same.report.d(getContext()).b(mraidCampaign.getRequestId(), mraidCampaign.getRequestIdNotice(), mraidCampaign.getId(), this.u, str, this.b.isBidCampaign()); } } @Override // com.mbridge.msdk.mbjscommon.mraid.b public void close() { w.d("EndCard_MRAID", "close"); try { onCloseViewClick(); } catch (Exception e2) { w.d(MBridgeBaseView.TAG, e2.getMessage()); } } @Override // com.mbridge.msdk.mbjscommon.mraid.b public void unload() { w.d("EndCard_MRAID", "unload"); close(); } @Override // com.mbridge.msdk.mbjscommon.mraid.b public CampaignEx getMraidCampaign() { return this.b; } @Override // com.mbridge.msdk.mbjscommon.mraid.b public void useCustomClose(boolean z2) { w.d("EndCard_MRAID", "useCustomClose : " + z2); try { setCloseVisibleForMraid(z2 ? 4 : 0); } catch (Exception e2) { w.d(MBridgeBaseView.TAG, e2.getMessage()); } } public void setNotchValue(String str, int i, int i2, int i3, int i4) { if (this.b != null && this.b.getAdSpaceT() != 2) { this.O = str; w.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.o.getLayoutParams(); int b2 = aa.b(getContext(), 20.0f); int i5 = i3 + b2; layoutParams.setMargins(i + b2, i5, i2 + b2, i4 + b2); w.d(MBridgeBaseView.TAG, "NOTCH H5ENDCARD " + i5); this.o.setLayoutParams(layoutParams); } } static /* synthetic */ void a(MBridgeH5EndCardView mBridgeH5EndCardView, long j, boolean z2) { String str; Throwable th; int i; String str2; int i2; String str3; try { if (mBridgeH5EndCardView.C) { w.b(MBridgeBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return"); return; } mBridgeH5EndCardView.C = true; String str4 = (!ae.b(mBridgeH5EndCardView.b.getendcard_url()) || !mBridgeH5EndCardView.b.getendcard_url().contains(".zip")) ? "2" : "1"; if (z2) { str2 = "ready timeout"; i2 = 2; i = 12; } else if (mBridgeH5EndCardView.E == 2) { str2 = "ready no"; i2 = 3; i = 11; } else { str2 = "ready yes"; i2 = 1; i = 10; } try { p pVar = new p("2000043", i, j + "", mBridgeH5EndCardView.b.getendcard_url(), mBridgeH5EndCardView.b.getId(), mBridgeH5EndCardView.u, str2, str4); try { if (mBridgeH5EndCardView.b.getAdType() == 287) { pVar.h("3"); } else if (mBridgeH5EndCardView.b.getAdType() == 94) { pVar.h("1"); } else if (mBridgeH5EndCardView.b.getAdType() == 42) { pVar.h("2"); } } catch (NullPointerException e2) { e2.printStackTrace(); } pVar.k(mBridgeH5EndCardView.b.getRequestId()); pVar.l(mBridgeH5EndCardView.b.getRequestIdNotice()); pVar.b(mBridgeH5EndCardView.b.getAdSpaceT()); com.mbridge.msdk.foundation.same.report.c.a(pVar, mBridgeH5EndCardView.u); if (mBridgeH5EndCardView.isLoadSuccess() || i2 != 1) { str3 = str2; } else { pVar.d(i2); pVar.q(String.valueOf(j)); pVar.n(mBridgeH5EndCardView.b.getId()); str3 = str2; pVar.p(str3); if (mBridgeH5EndCardView.b.isMraid()) { pVar.a(p.a); } else { pVar.f(mBridgeH5EndCardView.b.getendcard_url()); pVar.g(str4); pVar.a(p.b); } com.mbridge.msdk.foundation.same.report.c.b(pVar, mBridgeH5EndCardView.u); } String str5 = "insertEndCardReadyState result:" + i + " endCardLoadTime:" + j + " endcardurl:" + mBridgeH5EndCardView.b.getendcard_url() + " id:" + mBridgeH5EndCardView.b.getId() + " unitid:" + mBridgeH5EndCardView.u + " reason:" + str3 + " type:" + str4; str = MBridgeBaseView.TAG; try { w.b(str, str5); } catch (Throwable th2) { th = th2; } } catch (Throwable th3) { th = th3; str = MBridgeBaseView.TAG; w.b(str, th.getMessage(), th); } } catch (Throwable th4) { th = th4; str = MBridgeBaseView.TAG; w.b(str, th.getMessage(), th); } } static /* synthetic */ void d(MBridgeH5EndCardView mBridgeH5EndCardView) { if (mBridgeH5EndCardView.b != null && mBridgeH5EndCardView.b.isMraid()) { int i = mBridgeH5EndCardView.getResources().getConfiguration().orientation; String str = "undefined"; 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("placementType", "Interstitial"); hashMap.put("state", "default"); hashMap.put("viewable", "true"); hashMap.put("currentAppOrientation", jSONObject); if (mBridgeH5EndCardView.getContext() instanceof Activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity) mBridgeH5EndCardView.getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); com.mbridge.msdk.mbjscommon.mraid.a.a().b(mBridgeH5EndCardView.p, (float) s.x(mBridgeH5EndCardView.getContext()), (float) s.y(mBridgeH5EndCardView.getContext())); com.mbridge.msdk.mbjscommon.mraid.a.a().c(mBridgeH5EndCardView.p, (float) displayMetrics.widthPixels, (float) displayMetrics.heightPixels); } com.mbridge.msdk.mbjscommon.mraid.a a2 = com.mbridge.msdk.mbjscommon.mraid.a.a(); WindVaneWebView windVaneWebView = mBridgeH5EndCardView.p; a2.a(windVaneWebView, (float) windVaneWebView.getLeft(), (float) mBridgeH5EndCardView.p.getTop(), (float) mBridgeH5EndCardView.p.getWidth(), (float) mBridgeH5EndCardView.p.getHeight()); com.mbridge.msdk.mbjscommon.mraid.a a3 = com.mbridge.msdk.mbjscommon.mraid.a.a(); WindVaneWebView windVaneWebView2 = mBridgeH5EndCardView.p; a3.b(windVaneWebView2, (float) windVaneWebView2.getLeft(), (float) mBridgeH5EndCardView.p.getTop(), (float) mBridgeH5EndCardView.p.getWidth(), (float) mBridgeH5EndCardView.p.getHeight()); com.mbridge.msdk.mbjscommon.mraid.a.a().a(mBridgeH5EndCardView.p, hashMap); com.mbridge.msdk.mbjscommon.mraid.a.a().a(mBridgeH5EndCardView.p, com.mbridge.msdk.mbjscommon.mraid.d.a); com.mbridge.msdk.mbjscommon.mraid.a.a().a(mBridgeH5EndCardView.p); } } static /* synthetic */ void f(MBridgeH5EndCardView mBridgeH5EndCardView) { try { 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.u + "_" + 1); com.mbridge.msdk.foundation.b.b a3 = com.mbridge.msdk.foundation.b.b.a(); FeedBackButton b2 = a3.b(mBridgeH5EndCardView.u + "_" + 2); mBridgeH5EndCardView.x = b2; if (b2 != null) { ViewGroup viewGroup = (ViewGroup) b2.getParent(); if (viewGroup != null) { viewGroup.removeView(mBridgeH5EndCardView.x); } mBridgeH5EndCardView.n.addView(mBridgeH5EndCardView.x); mBridgeH5EndCardView.n.postDelayed(new Runnable() { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass5 */ public final void run() { MBridgeH5EndCardView.this.x.setVisibility(0); } }, 200); } mBridgeH5EndCardView.b.setCampaignUnitId(mBridgeH5EndCardView.u); com.mbridge.msdk.foundation.b.b a4 = com.mbridge.msdk.foundation.b.b.a(); a4.a(mBridgeH5EndCardView.u + "_" + 2, mBridgeH5EndCardView.b); com.mbridge.msdk.foundation.b.b a5 = com.mbridge.msdk.foundation.b.b.a(); a5.a(mBridgeH5EndCardView.u + "_" + 2, new com.mbridge.msdk.foundation.b.a() { /* class com.mbridge.msdk.video.module.MBridgeH5EndCardView.AnonymousClass6 */ @Override // com.mbridge.msdk.foundation.b.a public final void a() { String str; try { JSONObject jSONObject = new JSONObject(); if (com.mbridge.msdk.foundation.controller.a.f().j() != null) { jSONObject.put("status", 1); } str = jSONObject.toString(); } catch (Throwable th) { w.b(MBridgeBaseView.TAG, th.getMessage(), th); str = ""; } h.a().a((WebView) MBridgeH5EndCardView.this.p, AbsFeedBackForH5.WEBVIEW_EVENT_DIALOG_METHOD_NAME, Base64.encodeToString(str.getBytes(), 2)); } @Override // com.mbridge.msdk.foundation.b.a public final void b() { String str; try { JSONObject jSONObject = new JSONObject(); if (com.mbridge.msdk.foundation.controller.a.f().j() != null) { jSONObject.put("status", 2); } str = jSONObject.toString(); } catch (Throwable th) { w.b(MBridgeBaseView.TAG, th.getMessage(), th); str = ""; } h.a().a((WebView) MBridgeH5EndCardView.this.p, AbsFeedBackForH5.WEBVIEW_EVENT_DIALOG_METHOD_NAME, Base64.encodeToString(str.getBytes(), 2)); } @Override // com.mbridge.msdk.foundation.b.a public final void a(String str) { String str2; try { JSONObject jSONObject = new JSONObject(); if (com.mbridge.msdk.foundation.controller.a.f().j() != null) { jSONObject.put("status", 2); } str2 = jSONObject.toString(); } catch (Throwable th) { w.b(MBridgeBaseView.TAG, th.getMessage(), th); str2 = ""; } h.a().a((WebView) MBridgeH5EndCardView.this.p, AbsFeedBackForH5.WEBVIEW_EVENT_DIALOG_METHOD_NAME, Base64.encodeToString(str2.getBytes(), 2)); } }); } } catch (Exception e2) { e2.printStackTrace(); } } }