正在查看: Uptodown App Store v6.80 应用的 MBridgeH5EndCardView.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Uptodown App Store v6.80 应用的 MBridgeH5EndCardView.java JAVA 源代码文件
本页面展示 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.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 com.mbridge.msdk.playercommon.exoplayer2.C;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.TsExtractor;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import java.io.File;
import java.util.HashMap;
import org.json.JSONObject;
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;
private 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) {
af.b("CloseRunnable", e.getMessage());
}
MBridgeH5EndCardView mBridgeH5EndCardView = this.b;
if (mBridgeH5EndCardView == null || (handler = mBridgeH5EndCardView.u) == null) {
return;
}
handler.sendEmptyMessage(100);
}
}
private 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.B) {
return;
}
this.b.B = true;
this.b.s = false;
MBridgeH5EndCardView.this.reportRenderResult("timeout", 5);
this.b.notifyListener.a(127, TtmlNode.ANONYMOUS_REGION_ID);
af.a(MBridgeBaseView.TAG, "notify TYPE_NOTIFY_SHOW_NATIVE_ENDCARD");
}
}
private 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.A) {
af.c(MBridgeBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return");
return;
}
this.a.A = true;
n nVar = new n("m_download_end", 12, (this.b * 1000) + TtmlNode.ANONYMOUS_REGION_ID, 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" : MBridgeConstans.API_REUQEST_CATEGORY_APP);
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(MBridgeConstans.API_REUQEST_CATEGORY_APP);
}
} 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();
} catch (Throwable th) {
af.b(MBridgeBaseView.TAG, th.getMessage(), th);
}
}
}
private 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.I = true;
}
}
}
private 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.J = true;
}
}
}
private 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.K) {
MBridgeH5EndCardView.this.setCloseVisible(0);
}
this.b.F = true;
}
}
}
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 = TtmlNode.ANONYMOUS_REGION_ID;
this.u = new Handler(Looper.getMainLooper()) {
@Override
public final void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100) {
return;
}
if (MBridgeH5EndCardView.this.E) {
MBridgeH5EndCardView.this.notifyListener.a(122, TtmlNode.ANONYMOUS_REGION_ID);
}
MBridgeH5EndCardView.this.notifyListener.a(103, TtmlNode.ANONYMOUS_REGION_ID);
}
};
this.N = false;
this.O = false;
this.v = false;
}
static 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() {
@Override
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 = TtmlNode.ANONYMOUS_REGION_ID;
}
g.a().a((WebView) MBridgeH5EndCardView.this.p, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
}
@Override
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 = TtmlNode.ANONYMOUS_REGION_ID;
}
g.a().a((WebView) MBridgeH5EndCardView.this.p, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
}
@Override
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 = TtmlNode.ANONYMOUS_REGION_ID;
}
g.a().a((WebView) MBridgeH5EndCardView.this.p, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2));
}
});
} catch (Exception e4) {
e4.printStackTrace();
}
}
public boolean canBackPress() {
ImageView imageView = this.o;
return imageView != null && imageView.getVisibility() == 0;
}
@Override
public void close() {
try {
onCloseViewClick();
} catch (Exception e4) {
af.b(MBridgeBaseView.TAG, e4.getMessage());
}
}
@Override
public void defaultShow() {
super.defaultShow();
}
public void excuteEndCardShowTask(int i) {
this.q.postDelayed(new c(this, i), i * 1000);
}
public void excuteTask() {
if (this.x || this.y <= -1) {
return;
}
this.q.postDelayed(new f(this), this.y * 1000);
}
public void executeEndCardShow(int i) {
this.q.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.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);
}
}
@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.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();
}
}
public void install(CampaignEx campaignEx) {
}
public boolean isLoadSuccess() {
return this.s;
}
public boolean isPlayable() {
return this.x;
}
@Override
public void notifyCloseBtn(int i) {
if (i == 0) {
this.G = true;
} else {
if (i != 1) {
return;
}
this.H = true;
}
}
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 onCloseViewClick() {
try {
if (this.p != null) {
g.a().a((WebView) this.p, "onSystemDestory", TtmlNode.ANONYMOUS_REGION_ID);
new Thread(new a(this)).start();
} else {
this.notifyListener.a(103, TtmlNode.ANONYMOUS_REGION_ID);
this.notifyListener.a(119, "webview is null when closing webview");
}
} catch (Exception e4) {
this.notifyListener.a(103, TtmlNode.ANONYMOUS_REGION_ID);
this.notifyListener.a(119, "close webview exception" + e4.getMessage());
af.a(MBridgeBaseView.TAG, e4.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();
}
}
}
@Override
public void onFinishRedirection(Campaign campaign, String str) {
if (campaign == null) {
return;
}
aj.a(campaign, this);
}
@Override
public void onRedirectionFailed(Campaign campaign, String str) {
if (campaign == null) {
return;
}
aj.a(campaign, this);
}
@Override
public void onSelfConfigurationChanged(Configuration configuration) {
super.onSelfConfigurationChanged(configuration);
orientation(configuration);
}
@Override
public void onStartRedirection(Campaign campaign, String str) {
aj.b(campaign, this);
}
@Override
protected void onVisibilityChanged(View view, int i) {
super.onVisibilityChanged(view, i);
if (i != 0 || this.L) {
return;
}
this.L = 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.p, "true");
} else {
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(this.p, "false");
}
}
@Override
public void open(String str) {
super.open(str);
}
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 e4) {
e4.printStackTrace();
}
}
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, TtmlNode.ANONYMOUS_REGION_ID);
this.notifyListener.a(TsExtractor.TS_STREAM_TYPE_AC3, TtmlNode.ANONYMOUS_REGION_ID);
return;
}
String a4 = a();
if (!this.e || this.b == null || TextUtils.isEmpty(a4) || this.p == null) {
reportRenderResult("PL URL IS NULL", 3);
this.notifyListener.a(127, TtmlNode.ANONYMOUS_REGION_ID);
this.notifyListener.a(TsExtractor.TS_STREAM_TYPE_AC3, TtmlNode.ANONYMOUS_REGION_ID);
} else {
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 = a4.contains("wfr=1") || a4.contains("wfl=1");
this.p.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.t) {
return;
}
mBridgeH5EndCardView.s = true;
mBridgeH5EndCardView.notifyListener.a(100, TtmlNode.ANONYMOUS_REGION_ID);
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");
int adType = MBridgeH5EndCardView.this.b.getAdType();
String str2 = MBridgeConstans.API_REUQEST_CATEGORY_APP;
if (adType == 287) {
nVar.d("3");
} else if (MBridgeH5EndCardView.this.b.getAdType() == 94) {
nVar.d("1");
} else if (MBridgeH5EndCardView.this.b.getAdType() == 42) {
nVar.d(MBridgeConstans.API_REUQEST_CATEGORY_APP);
}
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, TtmlNode.ANONYMOUS_REGION_ID);
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
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, TtmlNode.ANONYMOUS_REGION_ID);
MBridgeH5EndCardView.this.reportRenderResult("failed", 6);
}
}
@Override
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, TtmlNode.ANONYMOUS_REGION_ID);
MBridgeH5EndCardView.this.notifyListener.a(TsExtractor.TS_STREAM_TYPE_AC3, TtmlNode.ANONYMOUS_REGION_ID);
MBridgeH5EndCardView.this.t = true;
}
@Override
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
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 a5 = 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 (a5 != null && a5.o() > 0) {
}
}
if (str.contains("wfr=1")) {
String[] split = str.split("&");
if (split != null && split.length > 0) {
for (String str2 : split) {
if (ap.b(str2) && str2.contains("to") && str2.split("=") != null && str2.split("=").length > 0) {
o = ak.a((Object) str2.split("=")[1]);
break;
}
}
}
o = 20;
} else {
if (a5 != null && a5.o() > 0) {
o = a5.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(a4));
if (TextUtils.isEmpty(this.r)) {
this.p.loadUrl(a4);
} else {
this.p.loadDataWithBaseURL(a4, this.r, "text/html", C.UTF8_NAME, null);
}
}
this.v = false;
}
public void readyStatus(int i) {
}
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;
}
@Override
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());
}
}
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);
int adType = this.b.getAdType();
String str2 = MBridgeConstans.API_REUQEST_CATEGORY_APP;
if (adType == 287) {
nVar.d("3");
} else if (this.b.getAdType() == 94) {
nVar.d("1");
} else if (this.b.getAdType() == 42) {
nVar.d(MBridgeConstans.API_REUQEST_CATEGORY_APP);
}
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 setCloseDelayShowTime(int i) {
this.y = i;
}
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 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 setNotchValue(String str, int i, int i4, int i5, int i6) {
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(i4), Integer.valueOf(i5), Integer.valueOf(i6)));
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.o.getLayoutParams();
int a4 = ak.a(getContext(), 20.0f);
layoutParams.setMargins(i + a4, i5 + a4, i4 + a4, i6 + a4);
this.o.setLayoutParams(layoutParams);
}
public void setPlayCloseBtnTm(int i) {
this.z = i;
}
public void setUnitId(String str) {
this.unitId = str;
}
public void startCounterEndCardShowTimer() {
try {
String str = this.b.getendcard_url();
if (ap.b(str) && str.contains("wfl=1")) {
String[] split = str.split("&");
int i = 15;
if (split != null && split.length > 0) {
for (String str2 : split) {
if (ap.b(str2) && str2.contains("timeout") && str2.split("=") != null && str2.split("=").length > 0) {
i = ak.a((Object) str2.split("=")[1]);
}
}
}
executeEndCardShow(i);
}
} catch (Throwable th) {
af.a(MBridgeBaseView.TAG, th.getMessage());
}
}
@Override
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 i4 = this.z;
if (i4 == 0) {
this.J = true;
} else {
this.J = false;
if (i4 > -1) {
this.q.postDelayed(new e(this), this.z * 1000);
}
}
}
} else if (!this.N && !this.G) {
this.N = true;
int i5 = this.y;
if (i5 == 0) {
this.I = true;
} else {
this.I = false;
if (i5 > -1) {
this.q.postDelayed(new d(this), this.y * 1000);
}
}
}
visibility = 8;
}
setCloseVisible(visibility);
}
@Override
public void unload() {
close();
}
@Override
public void useCustomClose(boolean z) {
try {
setCloseVisibleForMraid(z ? 4 : 0);
} catch (Exception e4) {
af.b(MBridgeBaseView.TAG, e4.getMessage());
}
}
public void volumeChange(double d4) {
com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(this.p, d4);
}
public void webviewshow() {
WindVaneWebView windVaneWebView = this.p;
if (windVaneWebView != null) {
windVaneWebView.post(new Runnable() {
@Override
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 c4 = com.mbridge.msdk.foundation.controller.c.m().c();
if (c4 != null) {
jSONObject.put("startX", ak.b(c4, iArr[0]));
jSONObject.put("startY", ak.b(c4, iArr[1]));
jSONObject.put(com.mbridge.msdk.foundation.same.a.l, ak.d(c4));
}
str = jSONObject.toString();
} catch (Throwable th) {
af.b(MBridgeBaseView.TAG, th.getMessage(), th);
str = TtmlNode.ANONYMOUS_REGION_ID;
}
g.a().a((WebView) MBridgeH5EndCardView.this.p, "webviewshow", Base64.encodeToString(str.toString().getBytes(), 2));
MBridgeH5EndCardView.this.notifyListener.a(109, TtmlNode.ANONYMOUS_REGION_ID);
MBridgeH5EndCardView.d(MBridgeH5EndCardView.this);
MBridgeH5EndCardView.this.startCounterEndCardShowTimer();
g a4 = g.a();
MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this;
a4.a((WebView) mBridgeH5EndCardView.p, "oncutoutfetched", Base64.encodeToString(mBridgeH5EndCardView.M.getBytes(), 0));
MBridgeH5EndCardView.f(MBridgeH5EndCardView.this);
} catch (Exception e4) {
e4.printStackTrace();
}
}
});
}
}
static void a(MBridgeH5EndCardView mBridgeH5EndCardView, long j, boolean z) {
String str;
int i;
int i4;
try {
if (mBridgeH5EndCardView.A) {
return;
}
mBridgeH5EndCardView.A = true;
String str2 = (ap.b(mBridgeH5EndCardView.b.getendcard_url()) && mBridgeH5EndCardView.b.getendcard_url().contains(".zip")) ? "1" : MBridgeConstans.API_REUQEST_CATEGORY_APP;
if (z) {
str = "ready timeout";
i = 12;
i4 = 2;
} else if (mBridgeH5EndCardView.C == 2) {
str = "ready no";
i = 11;
i4 = 3;
} else {
str = "ready yes";
i = 10;
i4 = 1;
}
n nVar = new n("m_download_end", i, j + TtmlNode.ANONYMOUS_REGION_ID, mBridgeH5EndCardView.b.getendcard_url(), mBridgeH5EndCardView.b.getId(), mBridgeH5EndCardView.unitId, str, str2);
try {
if (mBridgeH5EndCardView.b.getAdType() == 287) {
nVar.d("3");
} else if (mBridgeH5EndCardView.b.getAdType() == 94) {
nVar.d("1");
} else if (mBridgeH5EndCardView.b.getAdType() == 42) {
nVar.d(MBridgeConstans.API_REUQEST_CATEGORY_APP);
}
} catch (NullPointerException e4) {
e4.printStackTrace();
}
nVar.f(mBridgeH5EndCardView.b.getRequestId());
nVar.s(mBridgeH5EndCardView.b.getCurrentLocalRid());
nVar.g(mBridgeH5EndCardView.b.getRequestIdNotice());
nVar.c(mBridgeH5EndCardView.b.getAdSpaceT());
try {
com.mbridge.msdk.videocommon.d.c a4 = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.c.m().k(), mBridgeH5EndCardView.b.getCampaignUnitId());
if (a4 != null) {
nVar.v(a4.l());
}
com.mbridge.msdk.videocommon.d.a b4 = com.mbridge.msdk.videocommon.d.b.a().b();
if (b4 != null) {
nVar.u(b4.c());
}
} catch (Exception e5) {
af.b(MBridgeBaseView.TAG, e5.getMessage());
}
if (mBridgeH5EndCardView.isLoadSuccess() || i4 != 1) {
return;
}
nVar.b(i4);
nVar.l(String.valueOf(j));
nVar.e(mBridgeH5EndCardView.b.getId());
nVar.h(str);
if (mBridgeH5EndCardView.b.isMraid()) {
nVar.d(n.a);
} else {
nVar.n(mBridgeH5EndCardView.b.getendcard_url());
nVar.o(str2);
nVar.d(n.b);
}
com.mbridge.msdk.foundation.same.report.g.b(nVar, mBridgeH5EndCardView.unitId, mBridgeH5EndCardView.b);
} catch (Throwable th) {
af.b(MBridgeBaseView.TAG, th.getMessage(), th);
}
}
static void d(MBridgeH5EndCardView mBridgeH5EndCardView) {
CampaignEx campaignEx = mBridgeH5EndCardView.b;
if (campaignEx == null || !campaignEx.isMraid()) {
return;
}
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 e4) {
e4.printStackTrace();
}
HashMap hashMap = new HashMap();
hashMap.put(MRAIDCommunicatorUtil.KEY_PLACEMENTTYPE, MRAIDCommunicatorUtil.PLACEMENT_INTERSTITIAL);
hashMap.put(MRAIDCommunicatorUtil.KEY_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 f4 = displayMetrics.widthPixels;
float f5 = displayMetrics.heightPixels;
com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBridgeH5EndCardView.p, j, h);
com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(mBridgeH5EndCardView.p, f4, f5);
}
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);
}
protected RelativeLayout.LayoutParams b() {
return new RelativeLayout.LayoutParams(-1, -1);
}
@Override
protected final void c() {
super.c();
if (this.e) {
this.o.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
MBridgeH5EndCardView.this.onCloseViewClick();
}
});
}
}
protected void e() {
if (this.e) {
setMatchParent();
}
}
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 = TtmlNode.ANONYMOUS_REGION_ID;
this.u = new Handler(Looper.getMainLooper()) {
@Override
public final void handleMessage(Message message) {
super.handleMessage(message);
if (message.what != 100) {
return;
}
if (MBridgeH5EndCardView.this.E) {
MBridgeH5EndCardView.this.notifyListener.a(122, TtmlNode.ANONYMOUS_REGION_ID);
}
MBridgeH5EndCardView.this.notifyListener.a(103, TtmlNode.ANONYMOUS_REGION_ID);
}
};
this.N = false;
this.O = false;
this.v = false;
}
protected String a() {
CampaignEx campaignEx = this.b;
if (campaignEx != 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();
}
} catch (Throwable th) {
if (MBridgeConstans.DEBUG) {
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();
}
this.E = false;
return null;
}
}