翰林优商.apk(点击下载) / MBridgeContainerView.java


package com.mbridge.msdk.video.module;

import android.content.Context;
import android.content.res.Configuration;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.p;
import com.mbridge.msdk.foundation.same.report.c;
import com.mbridge.msdk.foundation.tools.aa;
import com.mbridge.msdk.foundation.tools.ag;
import com.mbridge.msdk.foundation.tools.l;
import com.mbridge.msdk.foundation.tools.w;
import com.mbridge.msdk.video.dynview.moffer.a;
import com.mbridge.msdk.video.js.e;
import com.mbridge.msdk.video.js.factory.b;
import com.mbridge.msdk.video.js.g;
import com.mbridge.msdk.video.module.a.a.f;
import com.mbridge.msdk.video.module.a.a.h;
import com.mbridge.msdk.video.module.a.a.k;

public class MBridgeContainerView extends MBridgeBaseView implements e, g {
    private boolean A = false;
    private boolean B = false;
    private boolean C = false;
    private boolean D = false;
    private boolean E = true;
    private boolean F = false;
    private int G;
    private boolean H = false;
    private int I;
    private int J;

    /* renamed from: K  reason: collision with root package name */
    private int f127K;
    private int L;
    private int M;
    private String N;
    private b O;
    private boolean P = false;
    private boolean Q = false;
    private MBridgePlayableView m;
    private MBridgeClickCTAView n;
    private MBridgeClickMiniCardView o;
    private MBridgeNativeEndCardView p;
    private MBridgeH5EndCardView q;
    private MBridgeVideoEndCoverView r;
    private MBridgeVastEndCardView s;
    private MBridgeLandingPageView t;
    private MBridgeAlertWebview u;
    private String v;
    private int w;
    private int x = 1;
    private int y = 1;
    private int z = 1;

    public void setJSFactory(b bVar) {
        this.O = bVar;
    }

    public int getVideoSkipTime() {
        return this.G;
    }

    public void setVideoSkipTime(int i) {
        this.G = i;
    }

    public MBridgeContainerView(Context context) {
        super(context);
    }

    public MBridgeContainerView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    @Override // com.mbridge.msdk.video.module.MBridgeBaseView
    public void init(Context context) {
        setVisibility(0);
    }

    @Override // com.mbridge.msdk.video.module.MBridgeBaseView
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        MBridgeBaseView[] mBridgeBaseViewArr = {this.m, this.n, this.o, this.p, this.q, this.s, this.t, this.r};
        for (int i = 0; i < 8; i++) {
            MBridgeBaseView mBridgeBaseView = mBridgeBaseViewArr[i];
            if (mBridgeBaseView != null && (mBridgeBaseView instanceof MBridgeClickMiniCardView)) {
                mBridgeBaseView.onSelfConfigurationChanged(configuration);
            } else if (mBridgeBaseView != null && mBridgeBaseView.getVisibility() == 0 && mBridgeBaseView.getParent() != null && !isLast()) {
                mBridgeBaseView.onSelfConfigurationChanged(configuration);
            }
        }
    }

    public void preLoadData(final b bVar) {
        this.O = bVar;
        if (this.b != null) {
            if (this.b.getPlayable_ads_without_video() == 2) {
                if (this.m == null) {
                    this.m = new MBridgePlayableView(this.a);
                }
                this.m.setCloseDelayShowTime(this.y);
                this.m.setPlayCloseBtnTm(this.z);
                this.m.setCampaign(this.b);
                this.m.setNotifyListener(new h(this.e) {
                    /* class com.mbridge.msdk.video.module.MBridgeContainerView.AnonymousClass3 */

                    @Override // com.mbridge.msdk.video.module.a.a.e, com.mbridge.msdk.video.module.a.a.h, com.mbridge.msdk.video.module.a.a
                    public final void a(int i, Object obj) {
                        super.a(i, obj);
                        if (i == 100) {
                            MBridgeContainerView.this.webviewshow();
                            MBridgeContainerView mBridgeContainerView = MBridgeContainerView.this;
                            mBridgeContainerView.onConfigurationChanged(mBridgeContainerView.getResources().getConfiguration());
                            p pVar = new p();
                            pVar.k(MBridgeContainerView.this.b.getRequestId());
                            pVar.l(MBridgeContainerView.this.b.getRequestIdNotice());
                            pVar.n(MBridgeContainerView.this.b.getId());
                            pVar.a(MBridgeContainerView.this.b.isMraid() ? p.a : p.b);
                            c.a(pVar, MBridgeContainerView.this.a, MBridgeContainerView.this.v);
                        }
                    }
                });
                this.m.preLoadData(bVar);
            } else {
                b(this.w);
                if (this.b.isDynamicView()) {
                    try {
                        a(bVar, Integer.valueOf(this.b.getVideo_end_type()));
                    } catch (Throwable th) {
                        w.d(MBridgeBaseView.TAG, th.getMessage());
                        new Handler(Looper.getMainLooper()).postAtFrontOfQueue(new Runnable() {
                            /* class com.mbridge.msdk.video.module.MBridgeContainerView.AnonymousClass1 */

                            public final void run() {
                                MBridgeContainerView mBridgeContainerView = MBridgeContainerView.this;
                                mBridgeContainerView.a(bVar, Integer.valueOf(mBridgeContainerView.b.getVideo_end_type()));
                            }
                        });
                    }
                    if (!aa.g(this.b.getendcard_url())) {
                        try {
                            String a = ag.a(this.b.getendcard_url(), "mof");
                            if (!TextUtils.isEmpty(a) && Integer.parseInt(a) == 1) {
                                a.a().a(this.b);
                            }
                        } catch (Exception e) {
                            w.d(MBridgeBaseView.TAG, e.getMessage());
                        }
                    }
                } else {
                    new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                        /* class com.mbridge.msdk.video.module.MBridgeContainerView.AnonymousClass2 */

                        public final void run() {
                            MBridgeContainerView mBridgeContainerView = MBridgeContainerView.this;
                            mBridgeContainerView.a(bVar, Integer.valueOf(mBridgeContainerView.b.getVideo_end_type()));
                        }
                    }, (long) getVideoSkipTime());
                }
            }
            g();
        }
    }

    public void showPlayableView() {
        if (this.b != null && !this.D) {
            removeAllViews();
            setMatchParent();
            if (this.m == null) {
                preLoadData(this.O);
            }
            addView(this.m);
            MBridgePlayableView mBridgePlayableView = this.m;
            if (mBridgePlayableView != null) {
                mBridgePlayableView.setUnitId(this.v);
                if (this.b != null && this.b.isMraid() && this.b.getPlayable_ads_without_video() == 2) {
                    this.m.setCloseVisible(0);
                }
                this.m.setNotchValue(this.N, this.I, this.J, this.f127K, this.L);
            }
            this.Q = true;
            bringToFront();
        }
    }

    @Override // com.mbridge.msdk.video.js.e
    public boolean showAlertWebView() {
        MBridgeAlertWebview mBridgeAlertWebview = this.u;
        if (mBridgeAlertWebview == null || !mBridgeAlertWebview.isLoadSuccess()) {
            return false;
        }
        setMatchParent();
        ViewGroup viewGroup = (ViewGroup) getParent();
        if (!(viewGroup.indexOfChild(this) == viewGroup.getChildCount() - 1) && !this.Q) {
            removeAllViews();
            bringToFront();
            this.P = true;
        }
        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
        if (mBridgeClickMiniCardView != null && mBridgeClickMiniCardView.getParent() != null) {
            return false;
        }
        if (this.u == null) {
            g();
        }
        MBridgeAlertWebview mBridgeAlertWebview2 = this.u;
        if (!(mBridgeAlertWebview2 == null || mBridgeAlertWebview2.getParent() == null)) {
            removeView(this.u);
        }
        addView(this.u);
        setBackgroundColor(0);
        this.u.webviewshow();
        return true;
    }

    @Override // com.mbridge.msdk.video.js.e
    public void showVideoClickView(int i) {
        if (this.b == null) {
            return;
        }
        if (i != -1) {
            if (i != 1) {
                if (i == 2) {
                    MBridgeClickCTAView mBridgeClickCTAView = this.n;
                    if (!(mBridgeClickCTAView == null || mBridgeClickCTAView.getParent() == null)) {
                        removeView(this.n);
                    }
                    MBridgeAlertWebview mBridgeAlertWebview = this.u;
                    if (mBridgeAlertWebview == null || mBridgeAlertWebview.getParent() == null) {
                        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
                        if (mBridgeClickMiniCardView == null || mBridgeClickMiniCardView.getParent() == null) {
                            try {
                                if (this.b != null && this.b.getPlayable_ads_without_video() == 1) {
                                    setMatchParent();
                                    f();
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                        if (miniCardLoaded()) {
                            MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
                            if (!(mBridgeH5EndCardView == null || mBridgeH5EndCardView.getParent() == null)) {
                                removeView(this.q);
                            }
                            this.e.a(112, "");
                            if (this.b != null && !this.b.isHasReportAdTrackPause()) {
                                this.b.setHasReportAdTrackPause(true);
                                com.mbridge.msdk.video.module.b.b.f(this.a, this.b);
                            }
                            if (this.C) {
                                this.e.a(115, "");
                            } else {
                                this.Q = true;
                                bringToFront();
                                webviewshow();
                                onConfigurationChanged(getResources().getConfiguration());
                            }
                            this.B = true;
                            return;
                        }
                        h();
                    }
                }
            } else if (!this.A) {
                MBridgeH5EndCardView mBridgeH5EndCardView2 = this.q;
                if (!(mBridgeH5EndCardView2 == null || mBridgeH5EndCardView2.getParent() == null)) {
                    removeView(this.q);
                }
                MBridgeClickMiniCardView mBridgeClickMiniCardView2 = this.o;
                if (!(mBridgeClickMiniCardView2 == null || mBridgeClickMiniCardView2.getParent() == null)) {
                    removeView(this.o);
                }
                MBridgeClickCTAView mBridgeClickCTAView2 = this.n;
                if (mBridgeClickCTAView2 == null || mBridgeClickCTAView2.getParent() == null) {
                    try {
                        if (this.b != null && this.b.getPlayable_ads_without_video() == 1) {
                            this.Q = true;
                            if (this.n == null) {
                                b(-1);
                            }
                            if (this.n != null) {
                                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
                                layoutParams.addRule(12, -1);
                                addView(this.n, 0, layoutParams);
                            }
                        }
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                }
                if (isLast()) {
                    bringToFront();
                }
            }
        } else if (!isLast() && !endCardShowing()) {
            h();
        }
    }

    @Override // com.mbridge.msdk.video.js.e
    public void showEndcard(int i) {
        if (this.b != null) {
            if (i == 1) {
                this.e.a(104, "");
            } else if (i == 100) {
                if (this.b.getPlayable_ads_without_video() == 2) {
                    this.D = true;
                }
                a(this.m);
                setMatchParent();
                e();
                w.a(MBridgeBaseView.TAG, "showEndcard addNativeEndcard");
            } else if (i == 3) {
                removeAllViews();
                setMatchParent();
                if (this.s == null) {
                    a(this.O, 3);
                }
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
                layoutParams.addRule(13, -1);
                addView(this.s, layoutParams);
                this.s.notifyShowListener();
                this.Q = true;
                bringToFront();
            } else if (i == 4) {
                this.e.a(113, "");
                removeAllViews();
                setMatchParent();
                if (this.t == null) {
                    a(this.O, 4);
                }
                this.t.preLoadData(this.O);
                addView(this.t);
                this.Q = true;
                bringToFront();
            } else if (i != 5) {
                removeAllViews();
                setMatchParent();
                this.Q = true;
                bringToFront();
                a();
                this.e.a(117, "");
            } else {
                this.e.a(106, "");
            }
        }
        this.A = true;
    }

    @Override // com.mbridge.msdk.video.js.e
    public void showVideoEndCover() {
        removeAllViews();
        setMatchParent();
        MBridgeVideoEndCoverView mBridgeVideoEndCoverView = this.r;
        if (mBridgeVideoEndCoverView == null) {
            b bVar = this.O;
            this.O = bVar;
            if (mBridgeVideoEndCoverView == null) {
                MBridgeVideoEndCoverView mBridgeVideoEndCoverView2 = new MBridgeVideoEndCoverView(this.a);
                this.r = mBridgeVideoEndCoverView2;
                mBridgeVideoEndCoverView2.setCampaign(this.b);
                this.r.setNotifyListener(new h(this.e));
                this.r.preLoadData(bVar);
            }
        }
        addView(this.r);
        onConfigurationChanged(getResources().getConfiguration());
        this.Q = true;
        bringToFront();
    }

    @Override // com.mbridge.msdk.video.js.e
    public boolean endCardShowing() {
        return this.A;
    }

    @Override // com.mbridge.msdk.video.js.e
    public boolean miniCardShowing() {
        return this.B;
    }

    public boolean miniCardLoaded() {
        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
        return mBridgeClickMiniCardView != null && mBridgeClickMiniCardView.isLoadSuccess();
    }

    @Override // com.mbridge.msdk.video.js.g
    public void toggleCloseBtn(int i) {
        MBridgePlayableView mBridgePlayableView = this.m;
        if (mBridgePlayableView != null) {
            mBridgePlayableView.toggleCloseBtn(i);
        }
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView != null) {
            mBridgeH5EndCardView.toggleCloseBtn(i);
        }
    }

    @Override // com.mbridge.msdk.video.js.g
    public void notifyCloseBtn(int i) {
        MBridgePlayableView mBridgePlayableView = this.m;
        if (mBridgePlayableView != null) {
            mBridgePlayableView.notifyCloseBtn(i);
        }
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView != null) {
            mBridgeH5EndCardView.notifyCloseBtn(i);
        }
    }

    public void triggerCloseBtn(String str) {
        if (this.b != null) {
            this.e.a(122, "");
            this.e.a(104, "");
        }
    }

    @Override // com.mbridge.msdk.video.js.e
    public void readyStatus(int i) {
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView != null) {
            mBridgeH5EndCardView.readyStatus(i);
        }
    }

    public void handlerPlayableException(String str) {
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView != null) {
            mBridgeH5EndCardView.handlerPlayableException(str);
            if (!this.H) {
                return;
            }
        }
        a();
    }

    @Override // com.mbridge.msdk.video.js.e
    public void showMiniCard(int i, int i2, int i3, int i4, int i5) {
        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
        if (mBridgeClickMiniCardView != null) {
            mBridgeClickMiniCardView.setMiniCardLocation(i, i2, i3, i4);
            this.o.setRadius(i5);
            this.o.setCloseVisible(8);
            this.o.setClickable(false);
            removeAllViews();
            setMatchParent();
            this.Q = true;
            bringToFront();
            f();
            if (!this.F) {
                this.F = true;
                this.e.a(109, "");
                this.e.a(117, "");
            }
        }
    }

    @Override // com.mbridge.msdk.video.js.e
    public void resizeMiniCard(int i, int i2, int i3) {
        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
        if (mBridgeClickMiniCardView != null) {
            mBridgeClickMiniCardView.resizeMiniCard(i, i2);
            this.o.setRadius(i3);
            removeAllViews();
            setMatchParent();
            this.Q = true;
            bringToFront();
            f();
        }
    }

    @Override // com.mbridge.msdk.video.js.e
    public void configurationChanged(int i, int i2, int i3) {
        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
        if (mBridgeClickMiniCardView != null && mBridgeClickMiniCardView.getVisibility() == 0) {
            this.o.resizeMiniCard(i, i2);
        }
    }

    public void webviewshow() {
        MBridgeH5EndCardView[] mBridgeH5EndCardViewArr = {this.m, this.o, this.q, this.u};
        for (int i = 0; i < 4; i++) {
            MBridgeH5EndCardView mBridgeH5EndCardView = mBridgeH5EndCardViewArr[i];
            if (mBridgeH5EndCardView != null && mBridgeH5EndCardView.getVisibility() == 0 && mBridgeH5EndCardView.getParent() != null && !isLast()) {
                mBridgeH5EndCardView.webviewshow();
            }
        }
    }

    public void install(CampaignEx campaignEx) {
        this.e.a(105, campaignEx);
    }

    public void orientation(Configuration configuration) {
        MBridgeH5EndCardView[] mBridgeH5EndCardViewArr = {this.m, this.o, this.q, this.u};
        for (int i = 0; i < 4; i++) {
            MBridgeH5EndCardView mBridgeH5EndCardView = mBridgeH5EndCardViewArr[i];
            if (mBridgeH5EndCardView != null && mBridgeH5EndCardView.getVisibility() == 0) {
                mBridgeH5EndCardView.orientation(getResources().getConfiguration());
            }
        }
    }

    @Override // com.mbridge.msdk.video.module.MBridgeBaseView
    public void setNotifyListener(com.mbridge.msdk.video.module.a.a aVar) {
        super.setNotifyListener(aVar);
        MBridgeBaseView[] mBridgeBaseViewArr = {this.m, this.n, this.o, this.p, this.q, this.s, this.t, this.r};
        for (int i = 0; i < 8; i++) {
            MBridgeBaseView mBridgeBaseView = mBridgeBaseViewArr[i];
            if (mBridgeBaseView != null) {
                if (mBridgeBaseView instanceof MBridgeClickMiniCardView) {
                    mBridgeBaseView.setNotifyListener(new f(this.o, aVar));
                } else {
                    mBridgeBaseView.setNotifyListener(new h(aVar));
                }
            }
        }
    }

    @Override // com.mbridge.msdk.video.module.MBridgeBaseView
    public void defaultShow() {
        super.defaultShow();
    }

    public void addView(View view) {
        if (view != null) {
            a(view);
            super.addView(view);
            return;
        }
        w.d(MBridgeBaseView.TAG, "view is null");
    }

    @Override // android.view.ViewGroup
    public void addView(View view, ViewGroup.LayoutParams layoutParams) {
        if (view != null) {
            a(view);
            super.addView(view, layoutParams);
            return;
        }
        w.d(MBridgeBaseView.TAG, "view is null");
    }

    public boolean canBackPress() {
        if (this.p != null) {
            return false;
        }
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView != null) {
            return mBridgeH5EndCardView.canBackPress();
        }
        MBridgeLandingPageView mBridgeLandingPageView = this.t;
        if (mBridgeLandingPageView != null) {
            return mBridgeLandingPageView.canBackPress();
        }
        MBridgePlayableView mBridgePlayableView = this.m;
        if (mBridgePlayableView != null) {
            return mBridgePlayableView.canBackPress();
        }
        return false;
    }

    public boolean endcardIsPlayable() {
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        return mBridgeH5EndCardView != null && mBridgeH5EndCardView.isPlayable();
    }

    public void setShowingTransparent(boolean z2) {
        this.C = z2;
    }

    public boolean getShowingTransparent() {
        return this.C;
    }

    public String getUnitID() {
        return this.v;
    }

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

    public void setVideoInteractiveType(int i) {
        if (this.b == null || !this.b.isDynamicView()) {
            this.w = i;
            return;
        }
        int a = com.mbridge.msdk.video.dynview.i.b.a(this.b);
        if (a == 100) {
            this.w = i;
        } else {
            this.w = a;
        }
    }

    public void setEndscreenType(int i) {
        this.x = i;
    }

    public int getVideoInteractiveType() {
        return this.w;
    }

    public void setCloseDelayTime(int i) {
        this.y = i;
    }

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

    private void a(View view) {
        if (view != null) {
            try {
                ViewGroup viewGroup = (ViewGroup) view.getParent();
                if (viewGroup != null) {
                    viewGroup.removeView(view);
                }
            } catch (Throwable th) {
                w.b(MBridgeBaseView.TAG, th.getMessage(), th);
            }
        }
    }

    private void a() {
        if (this.b != null) {
            boolean isDynamicView = this.b.isDynamicView();
            boolean g = aa.g(this.b.getendcard_url());
            if (isDynamicView && !g) {
                e();
                return;
            }
        }
        if (this.x != 2 || this.H) {
            e();
        } else {
            b();
        }
    }

    private void b() {
        if (this.q == null) {
            a(this.O, 2);
        }
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView == null || !mBridgeH5EndCardView.isLoadSuccess()) {
            e();
            MBridgeH5EndCardView mBridgeH5EndCardView2 = this.q;
            if (mBridgeH5EndCardView2 != null) {
                mBridgeH5EndCardView2.reportRenderResult("timeout", 3);
                this.q.setError(true);
            }
        } else {
            this.H = true;
            addView(this.q);
            webviewshow();
            onConfigurationChanged(getResources().getConfiguration());
            this.q.excuteTask();
            this.q.setNotchValue(this.N, this.I, this.J, this.f127K, this.L);
            p pVar = new p();
            pVar.k(this.b.getRequestId());
            pVar.l(this.b.getRequestIdNotice());
            pVar.n(this.b.getId());
            pVar.a(this.b.isMraid() ? p.a : p.b);
            c.a(pVar, this.a, this.v);
        }
        MBridgeH5EndCardView mBridgeH5EndCardView3 = this.q;
        if (mBridgeH5EndCardView3 != null) {
            mBridgeH5EndCardView3.setUnitId(this.v);
        }
    }

    private void e() {
        this.x = 1;
        if (this.p == null) {
            a(this.O, 2);
        }
        addView(this.p);
        onConfigurationChanged(getResources().getConfiguration());
        this.p.notifyShowListener();
        this.Q = true;
        bringToFront();
    }

    private void f() {
        if (this.o == null) {
            b(-2);
        }
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
        layoutParams.addRule(13, -1);
        if (this.C && this.E) {
            this.E = false;
            layoutParams.width = 1;
            layoutParams.height = 1;
        }
        addView(this.o, layoutParams);
    }

    private void g() {
        if (this.u == null) {
            MBridgeAlertWebview mBridgeAlertWebview = new MBridgeAlertWebview(this.a);
            this.u = mBridgeAlertWebview;
            mBridgeAlertWebview.setUnitId(this.v);
            this.u.setCampaign(this.b);
        }
        this.u.preLoadData(this.O);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    /* JADX WARNING: Removed duplicated region for block: B:51:0x0118  */
    /* JADX WARNING: Removed duplicated region for block: B:52:0x011a  */
    /* JADX WARNING: Removed duplicated region for block: B:55:0x0131  */
    /* JADX WARNING: Removed duplicated region for block: B:56:0x0148 A[SYNTHETIC, Splitter:B:56:0x0148] */
    private void a(b bVar, Integer num) {
        int i;
        this.O = bVar;
        if (this.b != null) {
            if (num == null) {
                num = Integer.valueOf(this.b.getVideo_end_type());
            }
            if (!isLast()) {
                h();
            }
            int intValue = num.intValue();
            if (intValue == 1) {
                return;
            }
            if (intValue == 3) {
                if (this.s == null) {
                    this.s = new MBridgeVastEndCardView(this.a);
                }
                this.s.setCampaign(this.b);
                this.s.setNotifyListener(new k(this.e));
                this.s.preLoadData(bVar);
            } else if (intValue == 4) {
                if (this.t == null) {
                    this.t = new MBridgeLandingPageView(this.a);
                }
                this.t.setCampaign(this.b);
                this.t.setNotifyListener(new h(this.e));
            } else if (intValue == 5) {
            } else {
                if (this.x == 2) {
                    boolean isDynamicView = this.b.isDynamicView();
                    boolean g = aa.g(this.b.getendcard_url());
                    if ((this.b == null || !isDynamicView || g) && this.b.getAdSpaceT() != 2) {
                        if (this.q == null) {
                            this.q = new MBridgeH5EndCardView(this.a);
                        }
                        this.q.setCampaign(this.b);
                        this.q.setCloseDelayShowTime(this.y);
                        this.q.setNotifyListener(new h(this.e));
                        this.q.setUnitId(this.v);
                        this.q.setNotchValue(this.N, this.I, this.J, this.f127K, this.L);
                        this.q.preLoadData(bVar);
                        w.a(MBridgeBaseView.TAG, "preload H5Endcard");
                        if (!this.C) {
                            w.a(MBridgeBaseView.TAG, "showTransparent = " + this.C + " addview");
                            addView(this.q);
                            return;
                        }
                        return;
                    }
                    return;
                }
                int c = (this.b == null || this.b.getRewardTemplateMode() == null) ? 0 : this.b.getRewardTemplateMode().c();
                if (this.p == null) {
                    if (this.b.isDynamicView()) {
                        String str = this.b.getendcard_url();
                        if (!TextUtils.isEmpty(str)) {
                            try {
                                i = Integer.parseInt(ag.a(str, "ecid"));
                            } catch (Throwable th) {
                                w.d(MBridgeBaseView.TAG, th.getMessage());
                            }
                            this.p = new MBridgeNativeEndCardView(this.a, null, true, i, this.b.getAdSpaceT() != 2, c);
                            if (!a.a().a(this.b.getRequestId())) {
                                a.a().a(this.p, this.b.getRequestId(), new h(this.e));
                            } else {
                                try {
                                    String a = ag.a(this.b.getendcard_url(), "mof");
                                    if (!TextUtils.isEmpty(a) && Integer.parseInt(a) == 1) {
                                        a.a().a(this.b, this.p, new h(this.e));
                                    }
                                } catch (Exception e) {
                                    w.d(MBridgeBaseView.TAG, e.getMessage());
                                }
                            }
                        }
                        i = 404;
                        this.p = new MBridgeNativeEndCardView(this.a, null, true, i, this.b.getAdSpaceT() != 2, c);
                        if (!a.a().a(this.b.getRequestId())) {
                        }
                    } else {
                        this.p = new MBridgeNativeEndCardView(this.a, null, false, -1, this.b.getAdSpaceT() == 2, c);
                    }
                }
                this.p.setCampaign(this.b);
                this.p.setUnitId(this.v);
                this.p.setCloseBtnDelay(this.y);
                this.p.setNotifyListener(new h(this.e));
                this.p.preLoadData(bVar);
                this.p.setNotchPadding(this.I, this.J, this.f127K, this.L);
            }
        }
    }

    public boolean isLast() {
        ViewGroup viewGroup = (ViewGroup) getParent();
        if (viewGroup == null || viewGroup.indexOfChild(this) != 0) {
            return false;
        }
        return true;
    }

    private void h() {
        this.B = false;
        this.Q = false;
        ViewGroup viewGroup = (ViewGroup) getParent();
        if (viewGroup != null) {
            int i = 0;
            for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
                View childAt = viewGroup.getChildAt(i);
                if (!(childAt instanceof MBridgeContainerView)) {
                    viewGroup.bringChildToFront(childAt);
                } else {
                    i++;
                }
            }
        }
    }

    private void b(int i) {
        if (i == -3) {
            return;
        }
        if (i != -2) {
            if (this.n == null) {
                this.n = new MBridgeClickCTAView(this.a);
            }
            this.n.setCampaign(this.b);
            this.n.setUnitId(this.v);
            this.n.setNotifyListener(new h(this.e));
            this.n.preLoadData(this.O);
        } else if (this.b != null && this.b.getVideo_end_type() == 2) {
            if (this.o == null) {
                this.o = new MBridgeClickMiniCardView(this.a);
            }
            this.o.setCampaign(this.b);
            MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
            mBridgeClickMiniCardView.setNotifyListener(new f(mBridgeClickMiniCardView, this.e));
            this.o.preLoadData(this.O);
            setMatchParent();
            f();
            h();
        }
    }

    public void setMBridgeClickMiniCardViewTransparent() {
        MBridgeClickMiniCardView mBridgeClickMiniCardView = this.o;
        if (mBridgeClickMiniCardView != null) {
            mBridgeClickMiniCardView.setMBridgeClickMiniCardViewTransparent();
            this.o.setMBridgeClickMiniCardViewClickable(false);
        }
    }

    public void onPlayableBackPress() {
        MBridgePlayableView mBridgePlayableView = this.m;
        if (mBridgePlayableView != null) {
            mBridgePlayableView.onBackPress();
        }
    }

    public void onMiniEndcardBackPress() {
        if (this.B) {
            this.e.a(107, "");
        }
    }

    public void onEndcardBackPress() {
        if (this.p != null || this.s != null) {
            this.e.a(104, "");
        } else if (this.t != null) {
            this.e.a(103, "");
        } else {
            MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
            if (mBridgeH5EndCardView != null) {
                mBridgeH5EndCardView.onBackPress();
            }
        }
    }

    public void release() {
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (mBridgeH5EndCardView != null) {
            mBridgeH5EndCardView.release();
            this.q = null;
        }
        MBridgePlayableView mBridgePlayableView = this.m;
        if (mBridgePlayableView != null) {
            mBridgePlayableView.release();
        }
        MBridgeLandingPageView mBridgeLandingPageView = this.t;
        if (mBridgeLandingPageView != null) {
            mBridgeLandingPageView.release();
        }
        MBridgeNativeEndCardView mBridgeNativeEndCardView = this.p;
        if (mBridgeNativeEndCardView != null) {
            mBridgeNativeEndCardView.clearMoreOfferBitmap();
        }
        if (this.e != null) {
            this.e = null;
        }
    }

    public MBridgeH5EndCardView getH5EndCardView() {
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        return mBridgeH5EndCardView == null ? this.m : mBridgeH5EndCardView;
    }

    @Override // com.mbridge.msdk.video.js.e
    public void hideAlertWebview() {
        if (!isLast()) {
            if (this.P && !this.Q) {
                h();
                this.P = false;
            }
            MBridgeAlertWebview mBridgeAlertWebview = this.u;
            if (mBridgeAlertWebview != null && mBridgeAlertWebview.getParent() != null) {
                removeView(this.u);
                MBridgeClickCTAView mBridgeClickCTAView = this.n;
                if (mBridgeClickCTAView != null && mBridgeClickCTAView.getParent() != null) {
                    setWrapContent();
                    ViewGroup.LayoutParams layoutParams = getLayoutParams();
                    if (layoutParams instanceof RelativeLayout.LayoutParams) {
                        ((RelativeLayout.LayoutParams) layoutParams).addRule(12, -1);
                    }
                }
            }
        }
    }

    @Override // com.mbridge.msdk.video.js.e
    public void ivRewardAdsWithoutVideo(String str) {
        this.e.a(103, str);
    }

    public void setNotchPadding(int i, int i2, int i3, int i4, int i5) {
        w.d(MBridgeBaseView.TAG, "NOTCH ContainerView " + String.format("%1s-%2s-%3s-%4s-%5s", Integer.valueOf(i2), Integer.valueOf(i3), Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i)));
        this.M = i;
        this.I = i2;
        this.J = i3;
        this.f127K = i4;
        this.L = i5;
        this.N = l.a(i, i2, i3, i4, i5);
        MBridgeNativeEndCardView mBridgeNativeEndCardView = this.p;
        if (mBridgeNativeEndCardView != null) {
            mBridgeNativeEndCardView.setNotchPadding(i2, i3, i4, i5);
        }
        MBridgeH5EndCardView mBridgeH5EndCardView = this.q;
        if (!(mBridgeH5EndCardView == null || mBridgeH5EndCardView.p == null)) {
            this.q.setNotchValue(this.N, i2, i3, i4, i5);
            com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) this.q.p, "oncutoutfetched", Base64.encodeToString(this.N.getBytes(), 0));
        }
        MBridgePlayableView mBridgePlayableView = this.m;
        if (mBridgePlayableView != null && mBridgePlayableView.p != null) {
            this.m.setNotchValue(this.N, i2, i3, i4, i5);
            com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) this.m.p, "oncutoutfetched", Base64.encodeToString(this.N.getBytes(), 0));
        }
    }

    public void setOnResume() {
        MBridgeNativeEndCardView mBridgeNativeEndCardView = this.p;
        if (mBridgeNativeEndCardView != null) {
            mBridgeNativeEndCardView.setOnResume();
        }
    }

    public void setOnPause() {
        MBridgeNativeEndCardView mBridgeNativeEndCardView = this.p;
        if (mBridgeNativeEndCardView != null) {
            mBridgeNativeEndCardView.setOnPause();
        }
    }
}