Weather Tracker v1.0.0版本的 MD5 值为:3edef27647e42a8ea0e7c0d2dbf56f97

以下内容为反编译后的 MBridgeH5EndCardView.java 源代码,内容仅作参考


package com.mbridge.msdk.video.module;

import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import com.fyber.inneractive.sdk.external.InneractiveMediationDefs;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.click.g;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.n;
import com.mbridge.msdk.foundation.same.report.i;
import com.mbridge.msdk.foundation.same.report.j;
import com.mbridge.msdk.foundation.same.report.l;
import com.mbridge.msdk.foundation.tools.ac;
import com.mbridge.msdk.foundation.tools.ad;
import com.mbridge.msdk.foundation.tools.ai;
import com.mbridge.msdk.foundation.tools.r;
import com.mbridge.msdk.foundation.tools.u;
import com.mbridge.msdk.foundation.tools.y;
import com.mbridge.msdk.foundation.webview.BrowserView;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import com.mbridge.msdk.out.Campaign;
import com.mbridge.msdk.videocommon.download.h;
import com.my.target.ads.Reward;
import com.unity3d.services.ads.adunit.AdUnitActivity;
import java.io.File;
import java.util.HashMap;
import org.json.JSONObject;
public class MBridgeH5EndCardView extends MBridgeBaseView implements g, com.mbridge.msdk.mbsignalcommon.mraid.b, com.mbridge.msdk.video.signal.g {
    private int A;
    private int B;
    private boolean C;
    private boolean D;
    private int E;
    private long F;
    private boolean G;
    private boolean H;
    private boolean I;
    private boolean f4195J;
    private boolean K;
    private boolean L;
    private boolean M;
    private boolean N;
    private String O;
    private boolean P;
    private boolean Q;
    protected View n;
    protected RelativeLayout o;
    protected ImageView p;
    protected WindVaneWebView q;
    protected Handler r;
    protected String s;
    protected boolean t;
    protected boolean u;
    protected String v;
    Handler w;
    boolean x;
    private boolean y;
    private boolean z;

    public class a implements Runnable {
        private MBridgeH5EndCardView f4197b;

        public a(MBridgeH5EndCardView mBridgeH5EndCardView) {
            this.f4197b = mBridgeH5EndCardView;
        }

        @Override
        public final void run() {
            Handler handler;
            try {
                Thread.sleep(300L);
            } catch (InterruptedException e) {
                y.d("CloseRunnable", e.getMessage());
            }
            MBridgeH5EndCardView mBridgeH5EndCardView = this.f4197b;
            if (mBridgeH5EndCardView == null || (handler = mBridgeH5EndCardView.w) == null) {
                return;
            }
            handler.sendEmptyMessage(100);
        }
    }

    public class b implements Runnable {
        private MBridgeH5EndCardView f4198b;

        public b(MBridgeH5EndCardView mBridgeH5EndCardView) {
            this.f4198b = mBridgeH5EndCardView;
        }

        @Override
        public final void run() {
            MBridgeH5EndCardView mBridgeH5EndCardView = this.f4198b;
            if (mBridgeH5EndCardView == null || mBridgeH5EndCardView.D) {
                return;
            }
            this.f4198b.D = true;
            this.f4198b.t = false;
            MBridgeH5EndCardView.this.reportRenderResult("timeout", 5);
            this.f4198b.e.a(127, "");
            y.a(MBridgeBaseView.TAG, "notify TYPE_NOTIFY_SHOW_NATIVE_ENDCARD");
        }
    }

    public static class c implements Runnable {
        private MBridgeH5EndCardView a;
        private int f4199b;

        public c(MBridgeH5EndCardView mBridgeH5EndCardView, int i) {
            this.a = mBridgeH5EndCardView;
            this.f4199b = i;
        }

        @Override
        public final void run() {
            MBridgeH5EndCardView mBridgeH5EndCardView = this.a;
            if (mBridgeH5EndCardView == null || mBridgeH5EndCardView.f4190b == null) {
                return;
            }
            try {
                if (!mBridgeH5EndCardView.C) {
                    this.a.C = true;
                    String str = (ai.b(this.a.f4190b.getendcard_url()) && this.a.f4190b.getendcard_url().contains(".zip")) ? "1" : "2";
                    n nVar = new n("2000043", 12, (this.f4199b * 1000) + "", this.a.f4190b.getendcard_url(), this.a.f4190b.getId(), this.a.v, "ready timeout", str);
                    try {
                        if (this.a.f4190b.getAdType() == 287) {
                            nVar.h("3");
                        } else if (this.a.f4190b.getAdType() == 94) {
                            nVar.h("1");
                        } else if (this.a.f4190b.getAdType() == 42) {
                            nVar.h("2");
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    nVar.m(this.a.f4190b.getRequestId());
                    nVar.n(this.a.f4190b.getLocalRequestId());
                    nVar.o(this.a.f4190b.getRequestIdNotice());
                    nVar.c(this.a.f4190b.getAdSpaceT());
                    MBridgeH5EndCardView.b(nVar, this.a.f4190b);
                    MBridgeH5EndCardView mBridgeH5EndCardView2 = this.a;
                    j.a(nVar, mBridgeH5EndCardView2.v, mBridgeH5EndCardView2.f4190b);
                    this.a.isLoadSuccess();
                    return;
                }
                y.b(MBridgeBaseView.TAG, "insertEndCardReadyState hasInsertLoadEndCardReport true return");
            } catch (Throwable th) {
                y.b(MBridgeBaseView.TAG, th.getMessage(), th);
            }
        }
    }

    private class d implements Runnable {
        private MBridgeH5EndCardView f4200b;

        public d(MBridgeH5EndCardView mBridgeH5EndCardView) {
            this.f4200b = mBridgeH5EndCardView;
        }

        @Override
        public final void run() {
            MBridgeH5EndCardView mBridgeH5EndCardView = this.f4200b;
            if (mBridgeH5EndCardView != null) {
                mBridgeH5EndCardView.K = true;
            }
        }
    }

    private class e implements Runnable {
        private MBridgeH5EndCardView f4201b;

        public e(MBridgeH5EndCardView mBridgeH5EndCardView) {
            this.f4201b = mBridgeH5EndCardView;
        }

        @Override
        public final void run() {
            MBridgeH5EndCardView mBridgeH5EndCardView = this.f4201b;
            if (mBridgeH5EndCardView != null) {
                mBridgeH5EndCardView.L = true;
            }
        }
    }

    public class f implements Runnable {
        private MBridgeH5EndCardView f4202b;

        public f(MBridgeH5EndCardView mBridgeH5EndCardView) {
            this.f4202b = mBridgeH5EndCardView;
        }

        @Override
        public final void run() {
            MBridgeH5EndCardView mBridgeH5EndCardView = this.f4202b;
            if (mBridgeH5EndCardView != null) {
                if (!mBridgeH5EndCardView.M) {
                    MBridgeH5EndCardView.this.setCloseVisible(0);
                }
                this.f4202b.H = true;
            }
        }
    }

    public MBridgeH5EndCardView(Context context) {
        super(context);
        this.y = false;
        this.r = new Handler();
        this.t = false;
        this.u = false;
        this.z = false;
        this.A = 1;
        this.B = 1;
        this.C = false;
        this.D = false;
        this.E = 1;
        this.F = 0L;
        this.G = false;
        this.H = false;
        this.I = false;
        this.f4195J = false;
        this.K = false;
        this.L = false;
        this.M = false;
        this.N = false;
        this.O = "";
        this.w = new Handler(Looper.getMainLooper()) {
            @Override
            public final void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 100) {
                    return;
                }
                if (MBridgeH5EndCardView.this.G) {
                    MBridgeH5EndCardView.this.e.a(122, "");
                }
                MBridgeH5EndCardView.this.e.a(103, "");
            }
        };
        this.P = false;
        this.Q = false;
        this.x = false;
    }

    static void f(MBridgeH5EndCardView mBridgeH5EndCardView) {
        CampaignEx campaignEx = mBridgeH5EndCardView.f4190b;
        if (campaignEx != null) {
            campaignEx.setCampaignUnitId(mBridgeH5EndCardView.v);
            com.mbridge.msdk.foundation.b.b a2 = com.mbridge.msdk.foundation.b.b.a();
            a2.c(mBridgeH5EndCardView.v + "_1");
            com.mbridge.msdk.foundation.b.b a3 = com.mbridge.msdk.foundation.b.b.a();
            a3.a(mBridgeH5EndCardView.v + "_2", mBridgeH5EndCardView.f4190b);
        }
        CampaignEx campaignEx2 = mBridgeH5EndCardView.f4190b;
        if (campaignEx2 == null || !campaignEx2.isMraid()) {
            return;
        }
        ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.a.d().f());
        imageView.setBackgroundResource(r.a(com.mbridge.msdk.foundation.controller.a.d().f(), "mbridge_reward_notice", "drawable"));
        ImageView imageView2 = mBridgeH5EndCardView.p;
        RelativeLayout.LayoutParams layoutParams = imageView2 != null ? (RelativeLayout.LayoutParams) imageView2.getLayoutParams() : null;
        RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 12.0f), ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 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 = ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 12.0f);
            layoutParams2.topMargin = ad.b(com.mbridge.msdk.foundation.controller.a.d().f(), 12.0f);
        }
        mBridgeH5EndCardView.addView(imageView, layoutParams2);
        ad.a(4, imageView, mBridgeH5EndCardView.f4190b, com.mbridge.msdk.foundation.controller.a.d().f(), false, new com.mbridge.msdk.foundation.b.a() {
            @Override
            public final void a() {
                String str;
                try {
                    JSONObject jSONObject = new JSONObject();
                    if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                        jSONObject.put("status", 1);
                    }
                    str = jSONObject.toString();
                } catch (Throwable th) {
                    y.b(MBridgeBaseView.TAG, th.getMessage(), th);
                    str = "";
                }
                com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
            }

            @Override
            public final void b() {
                String str;
                try {
                    JSONObject jSONObject = new JSONObject();
                    if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                        jSONObject.put("status", 2);
                    }
                    str = jSONObject.toString();
                } catch (Throwable th) {
                    y.b(MBridgeBaseView.TAG, th.getMessage(), th);
                    str = "";
                }
                com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, "onFeedbackAlertStatusNotify", Base64.encodeToString(str.getBytes(), 2));
            }

            @Override
            public final void a(String str) {
                String str2;
                try {
                    JSONObject jSONObject = new JSONObject();
                    if (com.mbridge.msdk.foundation.controller.a.d().f() != null) {
                        jSONObject.put("status", 2);
                    }
                    str2 = jSONObject.toString();
                } catch (Throwable th) {
                    y.b(MBridgeBaseView.TAG, th.getMessage(), th);
                    str2 = "";
                }
                com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, "onFeedbackAlertStatusNotify", Base64.encodeToString(str2.getBytes(), 2));
            }
        });
    }

    public boolean canBackPress() {
        ImageView imageView = this.p;
        return imageView != null && imageView.getVisibility() == 0;
    }

    @Override
    public void close() {
        try {
            onCloseViewClick();
        } catch (Exception e2) {
            y.d(MBridgeBaseView.TAG, e2.getMessage());
        }
    }

    @Override
    public void defaultShow() {
        super.defaultShow();
    }

    public void excuteEndCardShowTask(int i) {
        this.r.postDelayed(new c(this, i), i * 1000);
    }

    public void excuteTask() {
        if (this.z || this.A <= -1) {
            return;
        }
        this.r.postDelayed(new f(this), this.A * 1000);
    }

    public void executeEndCardShow(int i) {
        this.r.postDelayed(new b(this), i * 1000);
    }

    @Override
    public void expand(String str, boolean z) {
    }

    @Override
    public CampaignEx getMraidCampaign() {
        return this.f4190b;
    }

    public void handlerPlayableException(String str) {
        if (this.u) {
            return;
        }
        this.u = true;
        this.t = false;
        if (this.f4190b != null) {
            n nVar = new n();
            nVar.m(this.f4190b.getRequestId());
            nVar.o(this.f4190b.getRequestIdNotice());
            nVar.q(this.f4190b.getId());
            nVar.s(str);
            j.d(nVar, this.a.getApplicationContext(), this.v);
        }
    }

    @Override
    public void init(Context context) {
        int findLayout = findLayout("mbridge_reward_endcard_h5");
        if (findLayout >= 0) {
            View inflate = this.c.inflate(findLayout, (ViewGroup) null);
            this.n = inflate;
            try {
                this.p = (ImageView) inflate.findViewById(findID("mbridge_windwv_close"));
                this.o = (RelativeLayout) inflate.findViewById(findID("mbridge_windwv_content_rl"));
                this.q = new WindVaneWebView(getContext());
                this.q.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
                this.o.addView(this.q);
                this.f = isNotNULL(this.p, this.q);
            } catch (Exception unused) {
                this.f = false;
            }
            addView(this.n, b());
            c();
            e();
        }
    }

    public void install(CampaignEx campaignEx) {
    }

    public boolean isLoadSuccess() {
        return this.t;
    }

    public boolean isPlayable() {
        return this.z;
    }

    @Override
    public void notifyCloseBtn(int i) {
        if (i == 0) {
            this.I = true;
        } else if (i != 1) {
        } else {
            this.f4195J = true;
        }
    }

    public void onBackPress() {
        boolean z;
        if (this.H || (((z = this.I) && this.f4195J) || (!(z || !this.K || this.x) || (!z && this.L && this.x)))) {
            onCloseViewClick();
        }
    }

    public void onCloseViewClick() {
        Object obj = "";
        int i = 119;
        int i2 = 103;
        try {
            if (this.q != null) {
                com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) this.q, "onSystemDestory", "");
                new Thread(new a(this)).start();
            } else {
                this.e.a(103, "");
                this.e.a(119, "webview is null when closing webview");
            }
        } catch (Exception e2) {
            this.e.a(i2, obj);
            com.mbridge.msdk.video.module.a.a aVar = this.e;
            aVar.a(i, "close webview exception" + e2.getMessage());
            y.a(MBridgeBaseView.TAG, e2.getMessage());
        }
        try {
            obj = i.a();
            i = "2000134";
            i2 = this.f4190b;
            obj.a("2000134", i2, new HashMap());
        } catch (Throwable th) {
            y.a(MBridgeBaseView.TAG, th.getMessage());
        }
    }

    @Override
    public void onFinishRedirection(Campaign campaign, String str) {
        ac.b(campaign, this);
    }

    @Override
    public void onRedirectionFailed(Campaign campaign, String str) {
        ac.b(campaign, this);
    }

    @Override
    public void onSelfConfigurationChanged(Configuration configuration) {
        super.onSelfConfigurationChanged(configuration);
        orientation(configuration);
    }

    @Override
    public void onStartRedirection(Campaign campaign, String str) {
        ac.a(campaign, this);
    }

    @Override
    protected void onVisibilityChanged(View view, int i) {
        super.onVisibilityChanged(view, i);
        if (i != 0 || this.N) {
            return;
        }
        this.N = true;
        setFocusableInTouchMode(true);
        requestFocus();
        requestFocusFromTouch();
    }

    @Override
    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        CampaignEx campaignEx = this.f4190b;
        if (campaignEx == null || !campaignEx.isMraid()) {
            return;
        }
        if (z) {
            com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(this.q, InneractiveMediationDefs.SHOW_HOUSE_AD_YES);
        } else {
            com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(this.q, "false");
        }
    }

    @Override
    public void open(String str) {
        try {
            String clickURL = this.f4190b.getClickURL();
            if (!TextUtils.isEmpty(str)) {
                this.f4190b.setClickURL(str);
                CampaignEx mraidCampaign = getMraidCampaign();
                if (mraidCampaign != null) {
                    new l(getContext()).b(mraidCampaign.getRequestId(), mraidCampaign.getRequestIdNotice(), mraidCampaign.getId(), this.v, str, this.f4190b.isBidCampaign());
                }
            }
            com.mbridge.msdk.click.a aVar = new com.mbridge.msdk.click.a(getContext(), this.v);
            aVar.a(this);
            aVar.a(this.f4190b);
            this.f4190b.setClickURL(clickURL);
            this.e.a(126, "");
        } catch (Exception e2) {
            y.d(MBridgeBaseView.TAG, e2.getMessage());
        }
    }

    public void orientation(Configuration configuration) {
        try {
            JSONObject jSONObject = new JSONObject();
            if (configuration.orientation == 2) {
                jSONObject.put(AdUnitActivity.EXTRA_ORIENTATION, "landscape");
            } else {
                jSONObject.put(AdUnitActivity.EXTRA_ORIENTATION, "portrait");
            }
            com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) this.q, AdUnitActivity.EXTRA_ORIENTATION, Base64.encodeToString(jSONObject.toString().getBytes(), 2));
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void preLoadData(com.mbridge.msdk.video.signal.factory.b bVar) {
        int o;
        String a2 = a();
        if (this.f && this.f4190b != null && !TextUtils.isEmpty(a2)) {
            this.F = System.currentTimeMillis();
            try {
                reportRenderResult("start", 0);
            } catch (Exception unused) {
            }
            BrowserView.MBDownloadListener mBDownloadListener = new BrowserView.MBDownloadListener(this.f4190b);
            mBDownloadListener.setTitle(this.f4190b.getAppName());
            this.q.setDownloadListener(mBDownloadListener);
            this.q.setCampaignId(this.f4190b.getId());
            this.q.setTempTypeForMetrics(3);
            CampaignEx campaignEx = this.f4190b;
            if (campaignEx != null) {
                this.q.setLocalRequestId(campaignEx.getLocalRequestId());
            }
            setCloseVisible(8);
            this.q.setApiManagerJSFactory(bVar);
            if (this.f4190b.isMraid()) {
                this.q.setMraidObject(this);
            }
            final boolean z = a2.contains("wfr=1") || a2.contains("wfl=1");
            this.q.setWebViewListener(new com.mbridge.msdk.mbsignalcommon.b.b() {
                @Override
                public final void a(WebView webView, String str) {
                    super.a(webView, str);
                    MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this;
                    if (mBridgeH5EndCardView.u) {
                        return;
                    }
                    mBridgeH5EndCardView.t = true;
                    y.a(MBridgeBaseView.TAG, "onPageFinished,url:" + str);
                    MBridgeH5EndCardView.this.e.a(100, "");
                    if (MBridgeH5EndCardView.this.f4190b != null) {
                        n nVar = new n();
                        nVar.m(MBridgeH5EndCardView.this.f4190b.getRequestId());
                        nVar.o(MBridgeH5EndCardView.this.f4190b.getRequestIdNotice());
                        nVar.q(MBridgeH5EndCardView.this.f4190b.getId());
                        nVar.e(1);
                        nVar.t(String.valueOf(System.currentTimeMillis() - MBridgeH5EndCardView.this.F));
                        nVar.s("onPageFinished");
                        String str2 = "2";
                        if (MBridgeH5EndCardView.this.f4190b.getAdType() == 287) {
                            nVar.h("3");
                        } else if (MBridgeH5EndCardView.this.f4190b.getAdType() == 94) {
                            nVar.h("1");
                        } else if (MBridgeH5EndCardView.this.f4190b.getAdType() == 42) {
                            nVar.h("2");
                        }
                        if (MBridgeH5EndCardView.this.f4190b.isMraid()) {
                            nVar.b(n.a);
                        } else {
                            nVar.f(MBridgeH5EndCardView.this.f4190b.getendcard_url());
                            if (ai.b(MBridgeH5EndCardView.this.f4190b.getendcard_url()) && MBridgeH5EndCardView.this.f4190b.getendcard_url().contains(".zip")) {
                                str2 = "1";
                            }
                            nVar.g(str2);
                            nVar.b(n.f3766b);
                        }
                        MBridgeH5EndCardView mBridgeH5EndCardView2 = MBridgeH5EndCardView.this;
                        j.b(nVar, mBridgeH5EndCardView2.v, mBridgeH5EndCardView2.f4190b);
                    }
                    MBridgeH5EndCardView.this.e.a(120, "");
                    if (z) {
                        return;
                    }
                    try {
                        HashMap hashMap = new HashMap();
                        hashMap.put(IronSourceConstants.EVENTS_RESULT, "1");
                        hashMap.put("type", "3");
                        i.a().a("2000155", MBridgeH5EndCardView.this.f4190b, hashMap);
                    } catch (Throwable th) {
                        y.d("WindVaneWebView", th.getMessage());
                    }
                }

                @Override
                public final void c(WebView webView, int i) {
                    super.c(webView, i);
                    MBridgeH5EndCardView.this.E = i;
                    if (MBridgeH5EndCardView.this.D) {
                        return;
                    }
                    MBridgeH5EndCardView.this.D = true;
                    if (i == 1) {
                        MBridgeH5EndCardView.this.reportRenderResult("success", 4);
                        return;
                    }
                    MBridgeH5EndCardView.this.e.a(127, "");
                    MBridgeH5EndCardView.this.reportRenderResult("failed", 6);
                }

                @Override
                public final void a(WebView webView, int i, String str, String str2) {
                    super.a(webView, i, str, str2);
                    if (MBridgeH5EndCardView.this.u) {
                        return;
                    }
                    y.a(MBridgeBaseView.TAG, "onReceivedError,url:" + str2);
                    com.mbridge.msdk.video.module.a.a aVar = MBridgeH5EndCardView.this.e;
                    aVar.a(118, "onReceivedError " + i + str);
                    MBridgeH5EndCardView.this.reportRenderResult(str, 3);
                    MBridgeH5EndCardView.this.e.a(127, "");
                    MBridgeH5EndCardView.this.e.a(129, "");
                    MBridgeH5EndCardView.this.u = true;
                }

                @Override
                public final void a(WebView webView, int i) {
                    super.a(webView, i);
                    y.b("WindVaneWebView", "h5EncardView readyStatus:" + i + "- isError" + MBridgeH5EndCardView.this.u);
                    MBridgeH5EndCardView.this.E = i;
                    if (!MBridgeH5EndCardView.this.u) {
                        MBridgeH5EndCardView.a(MBridgeH5EndCardView.this, System.currentTimeMillis() - MBridgeH5EndCardView.this.F, false);
                    }
                    if (z) {
                        try {
                            HashMap hashMap = new HashMap();
                            hashMap.put(IronSourceConstants.EVENTS_RESULT, i + "");
                            hashMap.put("type", "3");
                            i.a().a("2000155", MBridgeH5EndCardView.this.f4190b, hashMap);
                        } catch (Throwable th) {
                            y.d("WindVaneWebView", th.getMessage());
                        }
                    }
                }

                @Override
                public final void a(WebView webView) {
                    super.a(webView);
                    MBridgeH5EndCardView.this.setCloseVisible(0);
                }
            });
            if (TextUtils.isEmpty(this.f4190b.getMraid())) {
                try {
                    this.F = System.currentTimeMillis();
                    String str = this.f4190b.getendcard_url();
                    com.mbridge.msdk.videocommon.d.c a3 = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.a.d().g(), this.v);
                    if (this.z && ai.b(str) && (str.contains("wfr=1") || (a3 != null && a3.o() > 0))) {
                        if (str.contains("wfr=1")) {
                            String[] split = str.split("&");
                            if (split != null && split.length > 0) {
                                for (String str2 : split) {
                                    if (ai.b(str2) && str2.contains(TypedValues.TransitionType.S_TO) && str2.split("=") != null && str2.split("=").length > 0) {
                                        o = ad.a((Object) str2.split("=")[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) {
                    y.b(MBridgeBaseView.TAG, th.getMessage(), th);
                }
            }
            setHtmlSource(h.a().b(a2));
            if (TextUtils.isEmpty(this.s)) {
                y.a(MBridgeBaseView.TAG, "load url:" + a2);
                this.q.loadUrl(a2);
            } else {
                y.a(MBridgeBaseView.TAG, "load html...");
                this.q.loadDataWithBaseURL(a2, this.s, "text/html", "UTF-8", null);
            }
        } else {
            reportRenderResult("PL URL IS NULL", 3);
            this.e.a(127, "");
            this.e.a(129, "");
        }
        this.x = false;
    }

    public void readyStatus(int i) {
    }

    public void release() {
        Handler handler = this.r;
        if (handler != null) {
            handler.removeCallbacksAndMessages(null);
            this.r = null;
        }
        Handler handler2 = this.w;
        if (handler2 != null) {
            handler2.removeCallbacksAndMessages(null);
            this.w = null;
        }
        this.o.removeAllViews();
        i.a().a(this.f4190b);
        this.q.release();
        this.q = null;
    }

    public void reportRenderResult(String str, int i) {
        if (this.f4190b == null || this.u) {
            return;
        }
        n nVar = new n();
        nVar.m(this.f4190b.getRequestId());
        nVar.o(this.f4190b.getRequestIdNotice());
        nVar.q(this.f4190b.getId());
        nVar.e(i);
        nVar.t(String.valueOf(System.currentTimeMillis() - this.F));
        nVar.s(str);
        String str2 = "2";
        if (this.f4190b.getAdType() == 287) {
            nVar.h("3");
        } else if (this.f4190b.getAdType() == 94) {
            nVar.h("1");
        } else if (this.f4190b.getAdType() == 42) {
            nVar.h("2");
        }
        if (this.f4190b.isMraid()) {
            nVar.b(n.a);
        } else {
            nVar.f(this.f4190b.getendcard_url());
            if (ai.b(this.f4190b.getendcard_url()) && this.f4190b.getendcard_url().contains(".zip")) {
                str2 = "1";
            }
            nVar.g(str2);
            nVar.b(n.f3766b);
        }
        j.b(nVar, this.v, this.f4190b);
    }

    public void setCloseDelayShowTime(int i) {
        this.A = i;
    }

    public void setCloseVisible(int i) {
        if (this.f) {
            this.p.setVisibility(i);
        }
    }

    public void setCloseVisibleForMraid(int i) {
        if (this.f) {
            this.M = true;
            if (i == 4) {
                this.p.setImageDrawable(new ColorDrawable(16711680));
            } else {
                this.p.setImageResource(findDrawable("mbridge_reward_close"));
            }
            this.p.setVisibility(0);
        }
    }

    public void setError(boolean z) {
        this.u = z;
    }

    public void setHtmlSource(String str) {
        this.s = str;
    }

    public void setLoadPlayable(boolean z) {
        this.x = z;
    }

    public void setNotchValue(String str, int i, int i2, int i3, int i4) {
        this.O = str;
        CampaignEx campaignEx = this.f4190b;
        if (campaignEx == null || campaignEx.getAdSpaceT() == 2) {
            return;
        }
        y.d(MBridgeBaseView.TAG, "NOTCH H5ENDCARD " + String.format("%1s-%2s-%3s-%4s", Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4)));
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.p.getLayoutParams();
        int b2 = ad.b(getContext(), 20.0f);
        layoutParams.setMargins(i + b2, i3 + b2, i2 + b2, i4 + b2);
        this.p.setLayoutParams(layoutParams);
    }

    public void setPlayCloseBtnTm(int i) {
        this.B = i;
    }

    public void setUnitId(String str) {
        this.v = str;
    }

    public void startCounterEndCardShowTimer() {
        try {
            String str = this.f4190b.getendcard_url();
            int i = 15;
            if (ai.b(str) && str.contains("wfl=1")) {
                String[] split = str.split("&");
                if (split != null && split.length > 0) {
                    for (String str2 : split) {
                        if (ai.b(str2) && str2.contains("timeout") && str2.split("=") != null && str2.split("=").length > 0) {
                            i = ad.a((Object) str2.split("=")[1]);
                        }
                    }
                }
                executeEndCardShow(i);
            }
        } catch (Throwable th) {
            y.a(MBridgeBaseView.TAG, th.getMessage());
        }
    }

    @Override
    public void toggleCloseBtn(int i) {
        int visibility = this.p.getVisibility();
        if (i == 1) {
            this.H = true;
            visibility = 0;
        } else if (i == 2) {
            this.H = false;
            visibility = 8;
            if (this.x) {
                if (!this.Q && !this.I) {
                    this.Q = true;
                    int i2 = this.B;
                    if (i2 == 0) {
                        this.L = true;
                    } else {
                        this.L = false;
                        if (i2 > -1) {
                            this.r.postDelayed(new e(this), this.B * 1000);
                        }
                    }
                }
            } else if (!this.P && !this.I) {
                this.P = true;
                int i3 = this.A;
                if (i3 == 0) {
                    this.K = true;
                } else {
                    this.K = false;
                    if (i3 > -1) {
                        this.r.postDelayed(new d(this), this.A * 1000);
                    }
                }
            }
        }
        setCloseVisible(visibility);
    }

    @Override
    public void unload() {
        close();
    }

    @Override
    public void useCustomClose(boolean z) {
        try {
            setCloseVisibleForMraid(z ? 4 : 0);
        } catch (Exception e2) {
            y.d(MBridgeBaseView.TAG, e2.getMessage());
        }
    }

    public void volumeChange(double d2) {
        com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(this.q, d2);
    }

    public void webviewshow() {
        WindVaneWebView windVaneWebView = this.q;
        if (windVaneWebView != null) {
            windVaneWebView.post(new Runnable() {
                @Override
                public final void run() {
                    try {
                        y.a(MBridgeBaseView.TAG, "webviewshow");
                        int[] iArr = new int[2];
                        MBridgeH5EndCardView.this.q.getLocationOnScreen(iArr);
                        y.d(MBridgeBaseView.TAG, "coordinate:" + iArr[0] + "--" + iArr[1]);
                        JSONObject jSONObject = new JSONObject();
                        Context f2 = com.mbridge.msdk.foundation.controller.a.d().f();
                        if (f2 != null) {
                            jSONObject.put("startX", ad.a(f2, iArr[0]));
                            jSONObject.put("startY", ad.a(f2, iArr[1]));
                            jSONObject.put(com.mbridge.msdk.foundation.same.a.k, ad.e(f2));
                        }
                        com.mbridge.msdk.mbsignalcommon.windvane.g.a().a((WebView) MBridgeH5EndCardView.this.q, "webviewshow", Base64.encodeToString(jSONObject.toString().toString().getBytes(), 2));
                        MBridgeH5EndCardView.this.e.a(109, "");
                        MBridgeH5EndCardView.d(MBridgeH5EndCardView.this);
                        MBridgeH5EndCardView.this.startCounterEndCardShowTimer();
                        com.mbridge.msdk.mbsignalcommon.windvane.g a2 = com.mbridge.msdk.mbsignalcommon.windvane.g.a();
                        MBridgeH5EndCardView mBridgeH5EndCardView = MBridgeH5EndCardView.this;
                        a2.a((WebView) mBridgeH5EndCardView.q, "oncutoutfetched", Base64.encodeToString(mBridgeH5EndCardView.O.getBytes(), 0));
                        MBridgeH5EndCardView.f(MBridgeH5EndCardView.this);
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                }
            });
        }
    }

    static void d(MBridgeH5EndCardView mBridgeH5EndCardView) {
        CampaignEx campaignEx = mBridgeH5EndCardView.f4190b;
        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(AdUnitActivity.EXTRA_ORIENTATION, str);
            jSONObject.put("locked", InneractiveMediationDefs.SHOW_HOUSE_AD_YES);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        HashMap hashMap = new HashMap();
        hashMap.put("placementType", IronSourceConstants.INTERSTITIAL_AD_UNIT);
        hashMap.put("state", Reward.DEFAULT);
        hashMap.put("viewable", InneractiveMediationDefs.SHOW_HOUSE_AD_YES);
        hashMap.put("currentAppOrientation", jSONObject);
        if (mBridgeH5EndCardView.getContext() instanceof Activity) {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            ((Activity) mBridgeH5EndCardView.getContext()).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
            com.mbridge.msdk.mbsignalcommon.mraid.a.a().b(mBridgeH5EndCardView.q, u.k(mBridgeH5EndCardView.getContext()), u.l(mBridgeH5EndCardView.getContext()));
            com.mbridge.msdk.mbsignalcommon.mraid.a.a().c(mBridgeH5EndCardView.q, displayMetrics.widthPixels, displayMetrics.heightPixels);
        }
        com.mbridge.msdk.mbsignalcommon.mraid.a a2 = com.mbridge.msdk.mbsignalcommon.mraid.a.a();
        WindVaneWebView windVaneWebView = mBridgeH5EndCardView.q;
        a2.a(windVaneWebView, windVaneWebView.getLeft(), mBridgeH5EndCardView.q.getTop(), mBridgeH5EndCardView.q.getWidth(), mBridgeH5EndCardView.q.getHeight());
        com.mbridge.msdk.mbsignalcommon.mraid.a a3 = com.mbridge.msdk.mbsignalcommon.mraid.a.a();
        WindVaneWebView windVaneWebView2 = mBridgeH5EndCardView.q;
        a3.b(windVaneWebView2, windVaneWebView2.getLeft(), mBridgeH5EndCardView.q.getTop(), mBridgeH5EndCardView.q.getWidth(), mBridgeH5EndCardView.q.getHeight());
        com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.q, hashMap);
        com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.q, com.mbridge.msdk.mbsignalcommon.mraid.d.a);
        com.mbridge.msdk.mbsignalcommon.mraid.a.a().a(mBridgeH5EndCardView.q);
    }

    protected RelativeLayout.LayoutParams b() {
        return new RelativeLayout.LayoutParams(-1, -1);
    }

    @Override
    public final void c() {
        super.c();
        if (this.f) {
            this.p.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    MBridgeH5EndCardView.this.onCloseViewClick();
                }
            });
        }
    }

    public void e() {
        if (this.f) {
            setMatchParent();
        }
    }

    public static void b(n nVar, CampaignEx campaignEx) {
        try {
            com.mbridge.msdk.videocommon.d.c a2 = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.a.d().g(), campaignEx.getCampaignUnitId());
            if (a2 != null) {
                nVar.l(a2.l());
            }
            com.mbridge.msdk.videocommon.d.a b2 = com.mbridge.msdk.videocommon.d.b.a().b();
            if (b2 != null) {
                nVar.k(b2.c());
            }
        } catch (Exception e2) {
            y.d(MBridgeBaseView.TAG, e2.getMessage());
        }
    }

    public String a() {
        CampaignEx campaignEx = this.f4190b;
        if (campaignEx != null) {
            this.G = true;
            if (campaignEx.isMraid()) {
                this.z = false;
                String mraid = this.f4190b.getMraid();
                if (!TextUtils.isEmpty(mraid)) {
                    File file = new File(mraid);
                    try {
                        if (file.exists() && file.isFile() && file.canRead()) {
                            mraid = "file:////" + mraid;
                        } else {
                            mraid = this.f4190b.getEndScreenUrl();
                        }
                        return mraid;
                    } catch (Throwable th) {
                        if (MBridgeConstans.DEBUG) {
                            th.printStackTrace();
                            return mraid;
                        }
                        return mraid;
                    }
                }
                return this.f4190b.getEndScreenUrl();
            }
            String str = this.f4190b.getendcard_url();
            if (!ai.a(str)) {
                this.z = true;
                String b2 = com.mbridge.msdk.videocommon.download.g.a().b(str);
                if (TextUtils.isEmpty(b2)) {
                    try {
                        String path = Uri.parse(str).getPath();
                        if (!TextUtils.isEmpty(path) && path.toLowerCase().endsWith(".zip")) {
                            String endScreenUrl = this.f4190b.getEndScreenUrl();
                            if (TextUtils.isEmpty(endScreenUrl)) {
                                return null;
                            }
                            this.z = false;
                            excuteTask();
                            return endScreenUrl;
                        }
                    } catch (Throwable th2) {
                        y.d(MBridgeBaseView.TAG, th2.getMessage());
                    }
                    return str + "&native_adtype=" + this.f4190b.getAdType();
                }
                return b2 + "&native_adtype=" + this.f4190b.getAdType();
            }
            this.z = false;
            return this.f4190b.getEndScreenUrl();
        }
        this.G = false;
        return null;
    }

    public MBridgeH5EndCardView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.y = false;
        this.r = new Handler();
        this.t = false;
        this.u = false;
        this.z = false;
        this.A = 1;
        this.B = 1;
        this.C = false;
        this.D = false;
        this.E = 1;
        this.F = 0L;
        this.G = false;
        this.H = false;
        this.I = false;
        this.f4195J = false;
        this.K = false;
        this.L = false;
        this.M = false;
        this.N = false;
        this.O = "";
        this.w = new Handler(Looper.getMainLooper()) {
            @Override
            public final void handleMessage(Message message) {
                super.handleMessage(message);
                if (message.what != 100) {
                    return;
                }
                if (MBridgeH5EndCardView.this.G) {
                    MBridgeH5EndCardView.this.e.a(122, "");
                }
                MBridgeH5EndCardView.this.e.a(103, "");
            }
        };
        this.P = false;
        this.Q = false;
        this.x = false;
    }

    static void a(MBridgeH5EndCardView mBridgeH5EndCardView, long j, boolean z) {
        int i;
        int i2;
        String str;
        int i3;
        String str2;
        try {
            if (mBridgeH5EndCardView.C) {
                return;
            }
            mBridgeH5EndCardView.C = true;
            String str3 = (ai.b(mBridgeH5EndCardView.f4190b.getendcard_url()) && mBridgeH5EndCardView.f4190b.getendcard_url().contains(".zip")) ? "1" : "2";
            int i4 = 2;
            if (z) {
                i3 = 12;
                str2 = "ready timeout";
            } else if (mBridgeH5EndCardView.E != 2) {
                i = 10;
                i2 = 1;
                str = "ready yes";
                String str4 = str;
                String str5 = str;
                int i5 = i2;
                n nVar = new n("2000043", i, j + "", mBridgeH5EndCardView.f4190b.getendcard_url(), mBridgeH5EndCardView.f4190b.getId(), mBridgeH5EndCardView.v, str4, str3);
                if (mBridgeH5EndCardView.f4190b.getAdType() != 287) {
                    nVar.h("3");
                } else if (mBridgeH5EndCardView.f4190b.getAdType() == 94) {
                    nVar.h("1");
                } else if (mBridgeH5EndCardView.f4190b.getAdType() == 42) {
                    nVar.h("2");
                }
                nVar.m(mBridgeH5EndCardView.f4190b.getRequestId());
                nVar.n(mBridgeH5EndCardView.f4190b.getLocalRequestId());
                nVar.o(mBridgeH5EndCardView.f4190b.getRequestIdNotice());
                nVar.c(mBridgeH5EndCardView.f4190b.getAdSpaceT());
                b(nVar, mBridgeH5EndCardView.f4190b);
                j.a(nVar, mBridgeH5EndCardView.v, mBridgeH5EndCardView.f4190b);
                if (mBridgeH5EndCardView.isLoadSuccess() && i5 == 1) {
                    nVar.e(i5);
                    nVar.t(String.valueOf(j));
                    nVar.q(mBridgeH5EndCardView.f4190b.getId());
                    nVar.s(str5);
                    if (mBridgeH5EndCardView.f4190b.isMraid()) {
                        nVar.b(n.a);
                    } else {
                        nVar.f(mBridgeH5EndCardView.f4190b.getendcard_url());
                        nVar.g(str3);
                        nVar.b(n.f3766b);
                    }
                    j.b(nVar, mBridgeH5EndCardView.v, mBridgeH5EndCardView.f4190b);
                    return;
                }
            } else {
                i4 = 3;
                i3 = 11;
                str2 = "ready no";
            }
            i = i3;
            str = str2;
            i2 = i4;
            String str42 = str;
            String str52 = str;
            int i52 = i2;
            n nVar2 = new n("2000043", i, j + "", mBridgeH5EndCardView.f4190b.getendcard_url(), mBridgeH5EndCardView.f4190b.getId(), mBridgeH5EndCardView.v, str42, str3);
            if (mBridgeH5EndCardView.f4190b.getAdType() != 287) {
            }
            nVar2.m(mBridgeH5EndCardView.f4190b.getRequestId());
            nVar2.n(mBridgeH5EndCardView.f4190b.getLocalRequestId());
            nVar2.o(mBridgeH5EndCardView.f4190b.getRequestIdNotice());
            nVar2.c(mBridgeH5EndCardView.f4190b.getAdSpaceT());
            b(nVar2, mBridgeH5EndCardView.f4190b);
            j.a(nVar2, mBridgeH5EndCardView.v, mBridgeH5EndCardView.f4190b);
            if (mBridgeH5EndCardView.isLoadSuccess()) {
            }
        } catch (Throwable th) {
            y.b(MBridgeBaseView.TAG, th.getMessage(), th);
        }
    }
}