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


package com.mbridge.msdk.video.bt.module;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.RelativeLayout;
import com.iab.omid.library.mmadbridge.adsession.AdEvents;
import com.iab.omid.library.mmadbridge.adsession.AdSession;
import com.iab.omid.library.mmadbridge.adsession.FriendlyObstructionPurpose;
import com.iab.omid.library.mmadbridge.adsession.media.MediaEvents;
import com.iab.omid.library.mmadbridge.adsession.media.Position;
import com.iab.omid.library.mmadbridge.adsession.media.VastProperties;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.RewardPlus;
import com.mbridge.msdk.foundation.entity.p;
import com.mbridge.msdk.foundation.tools.aa;
import com.mbridge.msdk.foundation.tools.q;
import com.mbridge.msdk.foundation.tools.s;
import com.mbridge.msdk.foundation.tools.w;
import com.mbridge.msdk.mbjscommon.mraid.d;
import com.mbridge.msdk.mbjscommon.windvane.AbsFeedBackForH5;
import com.mbridge.msdk.mbjscommon.windvane.WindVaneWebView;
import com.mbridge.msdk.out.Campaign;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.mbridge.msdk.video.bt.module.b.f;
import com.mbridge.msdk.video.bt.module.b.h;
import com.mbridge.msdk.video.js.a.c;
import com.mbridge.msdk.video.js.a.j;
import com.mbridge.msdk.video.js.container.AbstractJSContainer;
import com.mbridge.msdk.video.module.MBridgeContainerView;
import com.mbridge.msdk.video.module.MBridgeVideoView;
import com.mbridge.msdk.video.module.a.a.g;
import com.mbridge.msdk.video.module.a.a.l;
import com.mbridge.msdk.video.module.a.a.m;
import com.mbridge.msdk.videocommon.a;
import com.ss.android.download.api.constant.BaseConstants;
import org.json.JSONException;
import org.json.JSONObject;

public class MBTempContainer extends AbstractJSContainer {
    private static final String y = "MBTempContainer";
    private CampaignEx A;
    private com.mbridge.msdk.videocommon.download.a B;
    private h C;
    private com.mbridge.msdk.video.bt.module.a.c D;
    private String E = "";
    private com.mbridge.msdk.video.js.factory.b F;
    private int G = com.mbridge.msdk.foundation.same.a.z;
    private int H;
    private com.mbridge.msdk.video.bt.module.a.b I;
    private boolean J = false;

    /* renamed from: K  reason: collision with root package name */
    private int f122K;
    private int L;
    private int M;
    private int N;
    private int O;
    private String P = "";
    private String Q;
    private LayoutInflater R;
    private int S = 0;
    private int T = 0;
    private int U = 0;
    private View V;
    private boolean W = false;
    protected boolean a = false;
    private boolean aa = false;
    private boolean ab = false;
    private boolean ac;
    private boolean ad = false;
    private boolean ae = false;
    private boolean af = false;
    private boolean ag = false;
    private boolean ah = false;
    private boolean ai = false;
    private com.mbridge.msdk.mbjscommon.mraid.d aj;
    private AdSession ak = null;
    private MediaEvents al = null;
    private Runnable am = new Runnable() {
        /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass4 */

        public final void run() {
            if (MBTempContainer.this.V != null) {
                MBTempContainer.this.V.setVisibility(8);
            }
        }
    };
    protected boolean b = false;
    protected a c = new a.C0237a();
    protected WindVaneWebView d;
    protected MBridgeVideoView e;
    protected MBridgeContainerView f;
    protected Handler g = new Handler();
    protected Runnable h = new Runnable() {
        /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass1 */

        public final void run() {
            if (MBTempContainer.this.getActivityProxy().h() == 0) {
                Log.d(MBTempContainer.y, "run: WebView load timeout");
                MBTempContainer.this.defaultLoad(-1, "WebView load timeout");
                return;
            }
            MBTempContainer.this.S = -3;
        }
    };
    protected Runnable i = new Runnable() {
        /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass2 */

        public final void run() {
            if (MBTempContainer.this.getActivityProxy().h() == 0) {
                MBTempContainer.this.defaultLoad(-3, "JS bridge connect timeout");
            } else {
                MBTempContainer.this.S = -4;
            }
        }
    };
    private View z;

    public void preload() {
    }

    public void setMediaPlayerUrl(String str) {
    }

    public MBTempContainer(Context context) {
        super(context);
        init(context);
    }

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

    public void init(Context context) {
        this.R = LayoutInflater.from(context);
    }

    public void setMatchParent() {
        ViewGroup.LayoutParams layoutParams = getLayoutParams();
        if (layoutParams == null) {
            setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
            return;
        }
        layoutParams.height = -1;
        layoutParams.width = -1;
    }

    public void registerErrorListener(a aVar) {
        this.c = aVar;
    }

    public int findID(String str) {
        return q.a(getContext(), str, "id");
    }

    public int findLayout(String str) {
        return q.a(getContext(), str, TtmlNode.TAG_LAYOUT);
    }

    public interface a {
        void a(String str);

        void a(boolean z);

        /* renamed from: com.mbridge.msdk.video.bt.module.MBTempContainer$a$a  reason: collision with other inner class name */
        public static class C0237a implements a {
            private boolean a = false;

            @Override // com.mbridge.msdk.video.bt.module.MBTempContainer.a
            public void a(String str) {
                w.d("ActivityErrorListener", str);
                this.a = true;
            }

            @Override // com.mbridge.msdk.video.bt.module.MBTempContainer.a
            public final void a(boolean z) {
                this.a = z;
            }
        }
    }

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

    private int c() {
        j b2 = b(this.A);
        if (b2 != null) {
            return b2.k();
        }
        return 0;
    }

    private boolean d() {
        j b2 = b(this.A);
        if (b2 != null) {
            return b2.n();
        }
        return false;
    }

    private boolean e() {
        MBridgeVideoView mBridgeVideoView = this.e;
        if (mBridgeVideoView == null) {
            return false;
        }
        if (mBridgeVideoView.isShowingAlertView() || this.e.isInstallDialogShowing()) {
            return true;
        }
        return false;
    }

    public void superDefaultLoad(int i2, String str) {
        String str2 = y;
        w.d(str2, "receiveError:" + i2 + ",descroption:" + str);
        this.g.removeCallbacks(this.h);
        this.g.removeCallbacks(this.i);
        this.c.a(true);
        WindVaneWebView windVaneWebView = this.d;
        if (windVaneWebView != null) {
            windVaneWebView.setVisibility(8);
        }
    }

    @Override // com.mbridge.msdk.video.js.container.AbstractJSContainer
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
    }

    public void onCreate() {
        ViewGroup viewGroup;
        int i2;
        int i3;
        String str = y;
        w.a(str, "onCreate isBigOffer: " + this.w);
        if (this.m == null) {
            this.m = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.a.f().k(), this.k, this.r);
        }
        this.ai = false;
        try {
            if (this.w) {
                CampaignEx campaignEx = this.A;
                if (campaignEx == null || !campaignEx.isDynamicView()) {
                    this.C = new com.mbridge.msdk.video.bt.module.b.d(this.D, this.E);
                } else {
                    this.C = new com.mbridge.msdk.video.bt.module.b.b(getContext(), this.r, this.m, this.A, this.C, b(), this.k);
                }
            } else {
                this.C = new com.mbridge.msdk.video.bt.module.b.b(getContext(), this.r, this.m, this.A, this.C, b(), this.k);
            }
            CampaignEx campaignEx2 = this.A;
            if (campaignEx2 != null && campaignEx2.isActiveOm()) {
                this.ak = com.mbridge.msdk.a.b.a(getContext(), false, this.A.getOmid(), this.A.getRequestId(), this.A.getId(), this.k, this.B.n(), this.A.getRequestIdNotice());
            }
            registerErrorListener(new com.mbridge.msdk.video.bt.module.b.e(this.C));
            a(this.m, this.A);
            setShowingTransparent();
            int layoutID = getLayoutID();
            if (layoutID <= 0) {
                a("layoutID not found");
                return;
            }
            View inflate = this.R.inflate(layoutID, (ViewGroup) null);
            this.z = inflate;
            addView(inflate, new RelativeLayout.LayoutParams(-1, -1));
            if (this.a) {
                setMatchParent();
            }
            this.d = findWindVaneWebView();
            MBridgeVideoView findMBridgeVideoView = findMBridgeVideoView();
            this.e = findMBridgeVideoView;
            findMBridgeVideoView.setVideoLayout(this.A);
            this.e.setIsIV(this.r);
            this.e.setUnitId(this.k);
            if (this.w) {
                this.e.setNotchPadding(this.L, this.M, this.N, this.O);
            }
            this.f = findMBridgeContainerView();
            if (this.w) {
                this.f.setNotchPadding(this.f122K, this.L, this.M, this.N, this.O);
            }
            if (!((this.e == null || this.f == null || !initViews()) ? false : true)) {
                this.c.a("not found View IDS");
                if (this.j != null) {
                    this.j.finish();
                    return;
                }
                return;
            }
            this.b = true;
            WindVaneWebView windVaneWebView = this.d;
            com.mbridge.msdk.video.js.factory.b bVar = new com.mbridge.msdk.video.js.factory.b(this.j, windVaneWebView, this.e, this.f, this.A, new d());
            this.F = bVar;
            registerJsFactory(bVar);
            com.mbridge.msdk.foundation.b.b a2 = com.mbridge.msdk.foundation.b.b.a();
            a2.a(this.k + "_" + 1, new com.mbridge.msdk.foundation.b.a() {
                /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass6 */

                @Override // com.mbridge.msdk.foundation.b.a
                public final void a() {
                    String str;
                    MBTempContainer.this.onPause();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        if (com.mbridge.msdk.foundation.controller.a.f().j() != null) {
                            jSONObject.put("status", 1);
                        }
                        str = jSONObject.toString();
                    } catch (Throwable th) {
                        w.b(MBTempContainer.y, th.getMessage(), th);
                        str = "";
                    }
                    com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, AbsFeedBackForH5.WEBVIEW_EVENT_DIALOG_METHOD_NAME, Base64.encodeToString(str.getBytes(), 2));
                }

                @Override // com.mbridge.msdk.foundation.b.a
                public final void b() {
                    String str;
                    MBTempContainer.this.onResume();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        if (com.mbridge.msdk.foundation.controller.a.f().j() != null) {
                            jSONObject.put("status", 2);
                        }
                        str = jSONObject.toString();
                    } catch (Throwable th) {
                        w.b(MBTempContainer.y, th.getMessage(), th);
                        str = "";
                    }
                    com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, AbsFeedBackForH5.WEBVIEW_EVENT_DIALOG_METHOD_NAME, Base64.encodeToString(str.getBytes(), 2));
                }

                @Override // com.mbridge.msdk.foundation.b.a
                public final void a(String str) {
                    String str2;
                    MBTempContainer.this.onResume();
                    try {
                        JSONObject jSONObject = new JSONObject();
                        if (com.mbridge.msdk.foundation.controller.a.f().j() != null) {
                            jSONObject.put("status", 2);
                        }
                        str2 = jSONObject.toString();
                    } catch (Throwable th) {
                        w.b(MBTempContainer.y, th.getMessage(), th);
                        str2 = "";
                    }
                    com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, AbsFeedBackForH5.WEBVIEW_EVENT_DIALOG_METHOD_NAME, Base64.encodeToString(str2.getBytes(), 2));
                }
            });
            if (windVaneWebView != null) {
                ViewGroup viewGroup2 = (ViewGroup) this.z.findViewById(q.a(getContext(), "mbridge_video_templete_webview_parent", "id"));
                windVaneWebView.setApiManagerJSFactory(this.F);
                if (windVaneWebView.getParent() != null) {
                    defaultLoad(0, "preload template webview is null or load error");
                    return;
                }
                if (windVaneWebView.getObject() instanceof j) {
                    this.F.a((j) windVaneWebView.getObject());
                    getJSCommon().a(this.q);
                    getJSCommon().a(this.k);
                    getJSCommon().a(this.m);
                    getJSCommon().a(new d());
                    CampaignEx campaignEx3 = this.A;
                    if (campaignEx3 != null && (campaignEx3.isMraid() || this.A.isActiveOm())) {
                        com.mbridge.msdk.mbjscommon.mraid.d dVar = new com.mbridge.msdk.mbjscommon.mraid.d(getContext());
                        this.aj = dVar;
                        dVar.c();
                        this.aj.a();
                        this.aj.a(new d.b() {
                            /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass7 */

                            @Override // com.mbridge.msdk.mbjscommon.mraid.d.b
                            public final void a(double d) {
                                String str = MBTempContainer.y;
                                w.d(str, "volume is : " + d);
                                try {
                                    if (MBTempContainer.this.A.isMraid() && MBTempContainer.this.f != null && MBTempContainer.this.f.getH5EndCardView() != null) {
                                        MBTempContainer.this.f.getH5EndCardView().volumeChange(d);
                                    }
                                } catch (Exception e) {
                                    w.d(MBTempContainer.y, e.getMessage());
                                }
                            }
                        });
                    }
                    getJSContainerModule().readyStatus(((j) windVaneWebView.getObject()).p());
                    try {
                        if (this.d != null) {
                            int i4 = getResources().getConfiguration().orientation;
                            if (d()) {
                                i3 = aa.i(getContext());
                                i2 = aa.j(getContext());
                                if (aa.a(getContext())) {
                                    int k = aa.k(getContext());
                                    if (i4 == 2) {
                                        i3 += k;
                                    } else {
                                        i2 += k;
                                    }
                                }
                            } else {
                                i3 = aa.h(getContext());
                                i2 = aa.g(getContext());
                            }
                            int c2 = this.A.getRewardTemplateMode().c();
                            if (c(this.A) == 1) {
                                c2 = i4;
                            }
                            getJSNotifyProxy().a(i4, c2, i3, i2);
                            JSONObject jSONObject = new JSONObject();
                            jSONObject.put(com.mbridge.msdk.foundation.same.a.r, (double) aa.d(getContext()));
                            try {
                                if (this.o != null) {
                                    JSONObject jSONObject2 = new JSONObject();
                                    jSONObject2.put("name", this.o.a());
                                    jSONObject2.put(RewardPlus.AMOUNT, this.o.b());
                                    jSONObject2.put("id", this.p);
                                    jSONObject.put("userId", this.n);
                                    jSONObject.put("reward", jSONObject2);
                                    jSONObject.put("playVideoMute", this.q);
                                    jSONObject.put(BaseConstants.EVENT_LABEL_EXTRA, this.Q);
                                }
                            } catch (JSONException e2) {
                                w.a(y, e2.getMessage());
                            } catch (Exception e3) {
                                w.a(y, e3.getMessage());
                            }
                            getJSNotifyProxy().a(jSONObject.toString());
                            com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) this.d, "oncutoutfetched", Base64.encodeToString(this.P.getBytes(), 0));
                            getJSCommon().b(true);
                            if (this.I == null) {
                                this.I = new com.mbridge.msdk.video.bt.module.a.b() {
                                    /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass3 */

                                    @Override // com.mbridge.msdk.video.bt.module.a.b
                                    public final void a() {
                                        MBTempContainer.this.getJSVideoModule().setInstallDialogState(true);
                                        MBTempContainer.this.getJSVideoModule().setCover(true);
                                        MBTempContainer.this.getJSVideoModule().videoOperate(2);
                                        com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, "onInstallAlertShow", "");
                                    }

                                    @Override // com.mbridge.msdk.video.bt.module.a.b
                                    public final void b() {
                                        MBTempContainer.this.getJSVideoModule().setInstallDialogState(false);
                                        MBTempContainer.this.getJSVideoModule().setCover(false);
                                        MBTempContainer.this.getJSVideoModule().videoOperate(1);
                                        com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, "onInstallAlertHide", "");
                                    }
                                };
                            }
                            getJSCommon().a(this.I);
                            loadModuleDatas();
                            this.g.postDelayed(this.h, 2000);
                        }
                    } catch (Exception e4) {
                        if (MBridgeConstans.DEBUG) {
                            e4.printStackTrace();
                        }
                    }
                    ((j) windVaneWebView.getObject()).m.a();
                    if (this.w) {
                        getJSCommon().f(this.T);
                        getJSCommon().e(this.U);
                    }
                }
                if (getJSCommon().b() == 1 && (viewGroup = (ViewGroup) this.z.findViewById(q.a(getContext(), "mbridge_video_templete_webview_parent", "id"))) != null) {
                    ((ViewGroup) this.z).removeView(viewGroup);
                    ((ViewGroup) this.z).addView(viewGroup, 1);
                }
                viewGroup2.addView(windVaneWebView, new ViewGroup.LayoutParams(-1, -1));
                g();
                return;
            }
            w.a(str, "template webview is null");
            defaultLoad(0, "preload template webview is null or load error");
        } catch (Throwable th) {
            a("onCreate error" + th);
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.mbridge.msdk.video.js.container.AbstractJSContainer
    public final void a(String str) {
        h hVar = this.C;
        if (hVar != null) {
            hVar.a(str);
        }
        super.a(str);
    }

    @Override // com.mbridge.msdk.video.js.container.AbstractJSContainer
    public void onPause() {
        super.onPause();
        this.ab = true;
        try {
            getJSVideoModule().videoOperate(2);
            MBridgeContainerView mBridgeContainerView = this.f;
            if (mBridgeContainerView != null) {
                mBridgeContainerView.setOnPause();
            }
        } catch (Throwable th) {
            w.b(y, th.getMessage(), th);
        }
    }

    @Override // com.mbridge.msdk.video.js.container.AbstractJSContainer
    public void onResume() {
        Runnable runnable;
        super.onResume();
        int i2 = this.S;
        if (i2 == -3) {
            runnable = this.h;
        } else {
            runnable = i2 == -4 ? this.i : null;
        }
        if (runnable != null) {
            runnable.run();
            this.S = 0;
        }
        try {
            if (this.e != null && !e() && !this.e.isMiniCardShowing() && !com.mbridge.msdk.foundation.b.b.c) {
                this.e.setCover(false);
            }
            MBridgeContainerView mBridgeContainerView = this.f;
            if (mBridgeContainerView != null) {
                mBridgeContainerView.setOnResume();
            }
            if (this.ab && !e() && !com.mbridge.msdk.foundation.b.b.c) {
                getJSVideoModule().videoOperate(1);
            }
            if (this.j != null) {
                aa.a(this.j.getWindow().getDecorView());
            }
            if (this.ad && this.ae && this.j != null) {
                this.j.finish();
            }
        } catch (Throwable th) {
            w.b(y, th.getMessage(), th);
        }
    }

    /* access modifiers changed from: protected */
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
    }

    @Override // com.mbridge.msdk.video.js.container.AbstractJSContainer
    public void onStop() {
        super.onStop();
        MBridgeVideoView mBridgeVideoView = this.e;
        if (mBridgeVideoView != null) {
            mBridgeVideoView.setCover(true);
        }
    }

    @Override // com.mbridge.msdk.video.js.container.AbstractJSContainer
    public void onDestroy() {
        CampaignEx campaignEx;
        if (!this.J) {
            boolean z2 = true;
            this.J = true;
            super.onDestroy();
            try {
                if (this.I != null) {
                    this.I = null;
                }
                MBridgeVideoView mBridgeVideoView = this.e;
                if (mBridgeVideoView != null) {
                    mBridgeVideoView.releasePlayer();
                }
                WindVaneWebView windVaneWebView = this.d;
                if (windVaneWebView != null) {
                    ViewGroup viewGroup = (ViewGroup) windVaneWebView.getParent();
                    if (viewGroup != null) {
                        viewGroup.removeAllViews();
                    }
                    this.d.clearWebView();
                    this.d.release();
                }
                if (this.D != null) {
                    this.D = null;
                }
                this.g.removeCallbacks(this.h);
                this.g.removeCallbacks(this.i);
                getJSCommon().f();
                if (this.r) {
                    com.mbridge.msdk.c.b.a().f(this.k);
                }
                if (!this.W) {
                    try {
                        this.W = true;
                        CampaignEx campaignEx2 = this.A;
                        if (campaignEx2 != null && campaignEx2.getPlayable_ads_without_video() == 2) {
                            this.aa = true;
                        }
                        if (this.C != null) {
                            if (this.r && (this.t == com.mbridge.msdk.foundation.same.a.v || this.t == com.mbridge.msdk.foundation.same.a.w)) {
                                h hVar = this.C;
                                if (this.H != 1) {
                                    z2 = false;
                                }
                                hVar.a(z2, this.G);
                            }
                            if (!this.aa) {
                                this.o.a(0);
                            }
                            this.C.a(this.aa, this.o);
                        }
                        this.g.removeCallbacks(this.am);
                        if (((!this.r && !this.w) || ((campaignEx = this.A) != null && campaignEx.isDynamicView())) && this.aa) {
                            h hVar2 = this.C;
                            if (hVar2 == null || !hVar2.b()) {
                                w.a(y, "sendToServerRewardInfo");
                                com.mbridge.msdk.video.module.b.b.a(this.A, this.o, this.k, this.n, this.Q);
                            }
                        }
                        if (!this.w) {
                            if (this.r) {
                                com.mbridge.msdk.videocommon.a.b(287, this.A);
                            } else {
                                com.mbridge.msdk.videocommon.a.b(94, this.A);
                            }
                        }
                        MBridgeContainerView mBridgeContainerView = this.f;
                        if (mBridgeContainerView != null) {
                            mBridgeContainerView.release();
                        }
                    } catch (Throwable th) {
                        w.b(y, th.getMessage(), th);
                    }
                }
                if (!this.ac) {
                    f();
                }
                com.mbridge.msdk.mbjscommon.mraid.d dVar = this.aj;
                if (dVar != null) {
                    dVar.d();
                }
                AdSession adSession = this.ak;
                if (adSession != null) {
                    adSession.removeAllFriendlyObstructions();
                    this.ak.finish();
                    this.ak = null;
                }
                if (!this.w) {
                    if (isLoadSuccess()) {
                        this.g.postDelayed(new Runnable() {
                            /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass5 */

                            public final void run() {
                                if (MBTempContainer.this.j != null) {
                                    MBTempContainer.this.j.finish();
                                }
                            }
                        }, 100);
                    } else if (this.j != null) {
                        this.j.finish();
                    }
                }
                if (!this.ac) {
                    f();
                }
                com.mbridge.msdk.video.bt.a.c.a().g(this.E);
            } catch (Throwable th2) {
                w.a(y, th2.getMessage());
            }
        }
    }

    private void f() {
        com.mbridge.msdk.foundation.same.report.d dVar = new com.mbridge.msdk.foundation.same.report.d(getContext());
        CampaignEx campaignEx = this.A;
        if (campaignEx != null) {
            dVar.a(campaignEx.getRequestId(), this.A.getRequestIdNotice(), this.A.getId(), this.k, com.mbridge.msdk.mbjscommon.mraid.c.a(this.A.getId()), this.A.isBidCampaign());
            com.mbridge.msdk.mbjscommon.mraid.c.b(this.A.getId());
            this.ac = true;
        }
    }

    public void setShowingTransparent() {
        int a2;
        boolean d2 = d();
        this.ad = d2;
        if (!d2 && (a2 = q.a(getContext(), "mbridge_reward_theme", TtmlNode.TAG_STYLE)) > 1 && this.j != null) {
            this.j.setTheme(a2);
        }
    }

    private void g() {
        AdSession adSession = this.ak;
        if (adSession != null) {
            try {
                adSession.addFriendlyObstruction(this.f, FriendlyObstructionPurpose.OTHER, null);
                View view = this.V;
                if (view != null) {
                    this.ak.addFriendlyObstruction(view, FriendlyObstructionPurpose.OTHER, null);
                }
                WindVaneWebView windVaneWebView = this.d;
                if (windVaneWebView != null) {
                    this.ak.addFriendlyObstruction(windVaneWebView, FriendlyObstructionPurpose.OTHER, null);
                }
                AdEvents createAdEvents = AdEvents.createAdEvents(this.ak);
                this.al = MediaEvents.createMediaEvents(this.ak);
                this.ak.start();
                createAdEvents.loaded(VastProperties.createVastPropertiesForNonSkippableMedia(true, Position.STANDALONE));
                this.e.setVideoEvents(this.al);
                if (createAdEvents != null) {
                    createAdEvents.impressionOccurred();
                }
            } catch (Exception e2) {
                w.a("omsdk", e2.getMessage());
            }
        }
    }

    public void receiveSuccess() {
        w.a(y, "receiveSuccess ,start hybrid");
        this.g.removeCallbacks(this.i);
        this.g.postDelayed(this.am, 250);
    }

    public void defaultLoad(int i2, String str) {
        int i3;
        int i4;
        superDefaultLoad(i2, str);
        String str2 = y;
        w.a(str2, "hybrid load error ,start defaultLoad,desc:" + str);
        if (isLoadSuccess()) {
            if (this.A.getPlayable_ads_without_video() == 2) {
                this.f.setCampaign(this.A);
                this.f.setUnitID(this.k);
                if (this.A.getCbd() > -2) {
                    i4 = this.A.getCbd();
                } else {
                    i4 = this.m.o();
                }
                this.f.setCloseDelayTime(i4);
                this.f.setPlayCloseBtnTm(this.m.j());
                this.f.setNotifyListener(new g(this.A, this.B, this.o, b(), this.k, new c(), this.m.B(), this.w));
                this.f.preLoadData(this.F);
                this.f.showPlayableView();
            } else {
                a(i2, str);
                this.V.setVisibility(8);
                loadModuleDatas();
                int h2 = this.m.h();
                int c2 = c();
                int i5 = c2 != 0 ? c2 : h2;
                CampaignEx campaignEx = this.A;
                if (campaignEx != null && campaignEx.isDynamicView()) {
                    this.e.setContainerViewOnNotifyListener(new b(this.j, this.A));
                }
                CampaignEx campaignEx2 = this.A;
                if (campaignEx2 == null || campaignEx2.getVst() <= -2) {
                    i3 = this.m.g();
                } else {
                    i3 = this.A.getVst();
                }
                this.e.setVideoSkipTime(i3);
                MBridgeVideoView mBridgeVideoView = this.e;
                mBridgeVideoView.setNotifyListener(new l(mBridgeVideoView, this.f, this.A, this.o, this.B, b(), this.k, i5, i3, new e(), this.m.B(), this.w, this.m.H()));
                this.e.defaultShow();
                MBridgeContainerView mBridgeContainerView = this.f;
                mBridgeContainerView.setNotifyListener(new com.mbridge.msdk.video.module.a.a.a(this.e, mBridgeContainerView, this.A, this.o, this.B, b(), this.k, new b(this.j, this.A), this.m.B(), this.w));
                this.f.defaultShow();
            }
            g();
            return;
        }
        a(i2, str);
        if (this.j != null) {
            this.j.finish();
        }
    }

    public int getLayoutID() {
        return findLayout(this.ad ? "mbridge_reward_activity_video_templete_transparent" : "mbridge_reward_activity_video_templete");
    }

    public WindVaneWebView findWindVaneWebView() {
        a.C0240a aVar;
        try {
            if (this.w) {
                String str = y;
                w.a(str, "当前大模板");
                CampaignEx campaignEx = this.A;
                if (campaignEx == null || campaignEx.getRewardTemplateMode() == null) {
                    return null;
                }
                w.a(str, "当前大模板,存在播放模板");
                a.C0240a a2 = com.mbridge.msdk.videocommon.a.a(this.k + "_" + this.A.getId() + "_" + this.A.getRequestId() + "_" + this.A.getRewardTemplateMode().e());
                if (a2 != null) {
                    return a2.a();
                }
                return null;
            }
            w.a(y, "当前非大模板");
            if (this.r) {
                aVar = com.mbridge.msdk.videocommon.a.a(287, this.A);
            } else {
                aVar = com.mbridge.msdk.videocommon.a.a(94, this.A);
            }
            if (aVar == null || !aVar.c()) {
                return null;
            }
            if (this.r) {
                com.mbridge.msdk.videocommon.a.b(287, this.A);
            } else {
                com.mbridge.msdk.videocommon.a.b(94, this.A);
            }
            WindVaneWebView a3 = aVar.a();
            if (this.ad) {
                a3.setWebViewTransparent();
            }
            return a3;
        } catch (Exception e2) {
            if (!MBridgeConstans.DEBUG) {
                return null;
            }
            e2.printStackTrace();
            return null;
        }
    }

    public MBridgeVideoView findMBridgeVideoView() {
        return (MBridgeVideoView) findViewById(findID("mbridge_video_templete_videoview"));
    }

    public MBridgeContainerView findMBridgeContainerView() {
        return (MBridgeContainerView) findViewById(findID("mbridge_video_templete_container"));
    }

    public boolean initViews() {
        View findViewById = findViewById(findID("mbridge_video_templete_progressbar"));
        this.V = findViewById;
        return findViewById != null;
    }

    public boolean canBackPress() {
        MBridgeContainerView mBridgeContainerView = this.f;
        return mBridgeContainerView == null || mBridgeContainerView.canBackPress();
    }

    public void onBackPressed() {
        MBridgeContainerView mBridgeContainerView;
        MBridgeContainerView mBridgeContainerView2;
        MBridgeVideoView mBridgeVideoView;
        MBridgeVideoView mBridgeVideoView2;
        if (this.ad && (mBridgeVideoView2 = this.e) != null) {
            mBridgeVideoView2.notifyVideoClose();
        } else if (!this.af || (mBridgeVideoView = this.e) == null) {
            if (!this.ah || (mBridgeContainerView2 = this.f) == null) {
                if (this.ag && (mBridgeContainerView = this.f) != null) {
                    mBridgeContainerView.onEndcardBackPress();
                }
                if (getJSCommon().c()) {
                    if (getJSContainerModule() == null || !getJSContainerModule().miniCardShowing()) {
                        getActivityProxy().g();
                    }
                } else if (!canBackPress()) {
                    w.a(y, "onBackPressed can't excute");
                } else if (this.j != null && !this.w && !this.ai) {
                    this.ai = true;
                    this.j.onBackPressed();
                }
            } else {
                mBridgeContainerView2.onPlayableBackPress();
            }
        } else if (mBridgeVideoView.isMiniCardShowing()) {
            MBridgeContainerView mBridgeContainerView3 = this.f;
            if (mBridgeContainerView3 != null) {
                mBridgeContainerView3.onMiniEndcardBackPress();
            }
        } else {
            this.e.onBackPress();
        }
    }

    private void a(int i2, String str) {
        try {
            p pVar = new p();
            pVar.o("2000037");
            pVar.j("code=" + i2 + ",desc=" + str);
            CampaignEx campaignEx = this.A;
            String str2 = "";
            pVar.i((campaignEx == null || campaignEx.getRewardTemplateMode() == null) ? str2 : this.A.getRewardTemplateMode().e());
            pVar.m(this.k);
            CampaignEx campaignEx2 = this.A;
            if (campaignEx2 != null) {
                str2 = campaignEx2.getId();
            }
            pVar.n(str2);
            CampaignEx campaignEx3 = this.A;
            if (campaignEx3 != null && !TextUtils.isEmpty(campaignEx3.getRequestId())) {
                pVar.k(this.A.getRequestId());
            }
            CampaignEx campaignEx4 = this.A;
            if (campaignEx4 != null && !TextUtils.isEmpty(campaignEx4.getRequestIdNotice())) {
                pVar.l(this.A.getRequestIdNotice());
            }
            int D2 = s.D(getContext());
            pVar.c(D2);
            pVar.r(s.a(getContext(), D2));
            com.mbridge.msdk.video.module.b.b.a(p.e(pVar), this.k);
        } catch (Throwable th) {
            w.b(y, th.getMessage(), th);
        }
    }

    private int h() {
        int i2 = 5;
        try {
            com.mbridge.msdk.videocommon.d.a b2 = com.mbridge.msdk.videocommon.d.b.a().b();
            if (b2 == null) {
                com.mbridge.msdk.videocommon.d.b.a().c();
            }
            if (b2 != null) {
                i2 = (int) b2.f();
            }
            String str = y;
            w.b(str, "MBridgeBaseView buffetTimeout:" + i2);
        } catch (Throwable th) {
            th.printStackTrace();
        }
        return i2;
    }

    /* access modifiers changed from: private */
    public final class e extends com.mbridge.msdk.video.module.a.a.e {
        private e() {
        }

        /* JADX WARNING: Code restructure failed: missing block: B:26:0x007f, code lost:
            if (r5.a.A.isCampaignIsFiltered() != false) goto L_0x008c;
         */
        /* JADX WARNING: Code restructure failed: missing block: B:56:0x0158, code lost:
            if (r5.a.A.isCampaignIsFiltered() != false) goto L_0x0165;
         */
        @Override // com.mbridge.msdk.video.module.a.a.e, com.mbridge.msdk.video.module.a.a
        public final void a(int i, Object obj) {
            super.a(i, obj);
            if (MBTempContainer.this.r) {
                try {
                    if (obj instanceof String) {
                        String str = (String) obj;
                        if (!TextUtils.isEmpty(str)) {
                            JSONObject jSONObject = new JSONObject(str);
                            MBTempContainer.this.G = jSONObject.getInt("Alert_window_status");
                            MBTempContainer.this.H = jSONObject.getInt("complete_info");
                        }
                    }
                } catch (Exception e) {
                    w.d("NotifyListener", e.getMessage());
                }
            }
            if (i != 2) {
                if (i == 121) {
                    MBTempContainer.this.aa = true;
                    MBTempContainer.this.C.a(MBTempContainer.this.l, MBTempContainer.this.k);
                    MBTempContainer.this.af = false;
                    return;
                } else if (i == 16) {
                    MBTempContainer.l(MBTempContainer.this);
                    return;
                } else if (i != 17) {
                    switch (i) {
                        case 10:
                            MBTempContainer.this.af = true;
                            if (MBTempContainer.this.A != null) {
                                if (MBTempContainer.this.A.isDynamicView()) {
                                    if (MBTempContainer.this.w) {
                                        break;
                                    } else {
                                        MBTempContainer.this.C.a();
                                    }
                                    f.a(MBTempContainer.this.getContext(), MBTempContainer.this.A, MBTempContainer.this.k);
                                    return;
                                }
                                MBTempContainer.this.C.a();
                                f.a(MBTempContainer.this.getContext(), MBTempContainer.this.A, MBTempContainer.this.k);
                                return;
                            }
                            return;
                        case 11:
                        case 12:
                            break;
                        default:
                            return;
                    }
                } else {
                    MBTempContainer.this.aa = true;
                    return;
                }
            }
            if (i == 12) {
                String str2 = "Play error but has no message.";
                try {
                    if (obj instanceof String) {
                        str2 = obj.toString();
                    }
                } catch (Throwable th) {
                    w.d("NotifyListener", th.getMessage());
                }
                f.a(MBTempContainer.this.getContext(), MBTempContainer.this.A, MBTempContainer.this.k, str2);
                if (!MBTempContainer.this.af) {
                    if (MBTempContainer.this.m.H() == 0) {
                        MBTempContainer.this.C.a("play error");
                        MBTempContainer.this.af = false;
                        MBTempContainer.l(MBTempContainer.this);
                        return;
                    }
                    if (MBTempContainer.this.A != null && MBTempContainer.this.A.isDynamicView()) {
                        if (!MBTempContainer.this.w) {
                            MBTempContainer.this.C.a();
                        }
                    }
                    MBTempContainer.this.C.a();
                }
            }
            MBTempContainer.this.getJSVideoModule().videoOperate(3);
            MBTempContainer.this.af = false;
            if (MBTempContainer.this.al != null && i == 2) {
                MBTempContainer.this.al.skipped();
            }
        }
    }

    /* access modifiers changed from: private */
    public final class b extends com.mbridge.msdk.video.module.a.a.e {
        private Activity b;
        private CampaignEx c;

        public b(Activity activity, CampaignEx campaignEx) {
            this.b = activity;
            this.c = campaignEx;
        }

        @Override // com.mbridge.msdk.video.module.a.a.e, com.mbridge.msdk.video.module.a.a
        public final void a(int i, Object obj) {
            Context context = MBTempContainer.this.getContext();
            if (!(context == null || context == context.getApplicationContext())) {
                MBTempContainer.this.getJSCommon().a(context);
            }
            if (this.b != null) {
                MBTempContainer.this.getJSCommon().a(this.b);
            }
            MBTempContainer.this.ag = true;
            String str = "";
            if (i == 108) {
                if (MBTempContainer.this.I == null) {
                    MBTempContainer.this.I = new com.mbridge.msdk.video.bt.module.a.b() {
                        /* class com.mbridge.msdk.video.bt.module.MBTempContainer.b.AnonymousClass2 */

                        @Override // com.mbridge.msdk.video.bt.module.a.b
                        public final void a() {
                            MBTempContainer.this.getJSVideoModule().setInstallDialogState(true);
                            MBTempContainer.this.getJSVideoModule().setCover(true);
                            MBTempContainer.this.getJSVideoModule().videoOperate(2);
                            com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, "onInstallAlertShow", "");
                        }

                        @Override // com.mbridge.msdk.video.bt.module.a.b
                        public final void b() {
                            MBTempContainer.this.getJSVideoModule().setInstallDialogState(false);
                            MBTempContainer.this.getJSVideoModule().setCover(false);
                            MBTempContainer.this.getJSVideoModule().videoOperate(1);
                            com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) MBTempContainer.this.d, "onInstallAlertHide", "");
                        }
                    };
                }
                MBTempContainer.this.getJSCommon().a(MBTempContainer.this.I);
                MBTempContainer.this.getJSCommon().a(new c.b(MBTempContainer.this.getJSCommon(), new d()));
                com.mbridge.msdk.video.js.c jSCommon = MBTempContainer.this.getJSCommon();
                if (obj != null) {
                    str = obj.toString();
                }
                jSCommon.click(1, str);
            } else if (i == 113) {
                MBTempContainer.this.C.a(true, MBTempContainer.this.l, MBTempContainer.this.k);
            } else if (i != 117) {
                if (i != 126 && i != 128) {
                    switch (i) {
                        case 103:
                        case 104:
                            MBTempContainer.l(MBTempContainer.this);
                            break;
                        case 105:
                            if (MBTempContainer.this.I == null) {
                                MBTempContainer.this.I = new com.mbridge.msdk.video.bt.module.a.b() {
                                    /* class com.mbridge.msdk.video.bt.module.MBTempContainer.b.AnonymousClass1 */

                                    @Override // com.mbridge.msdk.video.bt.module.a.b
                                    public final void a() {
                                        MBTempContainer.this.getJSVideoModule().setInstallDialogState(true);
                                        MBTempContainer.this.getJSVideoModule().setCover(true);
                                        MBTempContainer.this.getJSVideoModule().videoOperate(2);
                                    }

                                    @Override // com.mbridge.msdk.video.bt.module.a.b
                                    public final void b() {
                                        MBTempContainer.this.getJSVideoModule().setInstallDialogState(false);
                                        MBTempContainer.this.getJSVideoModule().setCover(false);
                                        MBTempContainer.this.getJSVideoModule().videoOperate(1);
                                    }
                                };
                            }
                            MBTempContainer.this.getJSCommon().a(MBTempContainer.this.I);
                            com.mbridge.msdk.video.js.c jSCommon2 = MBTempContainer.this.getJSCommon();
                            if (obj != null) {
                                str = obj.toString();
                            }
                            jSCommon2.click(1, str);
                            break;
                        case 106:
                            if (MBTempContainer.this.D != null) {
                                MBTempContainer.this.D.a(MBTempContainer.this.E, MBTempContainer.this.l, MBTempContainer.this.k);
                            } else {
                                MBTempContainer.this.C.a(true, MBTempContainer.this.l, MBTempContainer.this.k);
                            }
                            if (!(this.b == null || this.c == null)) {
                                try {
                                    Intent intent = new Intent();
                                    intent.setAction("android.intent.action.VIEW");
                                    String a2 = com.mbridge.msdk.click.c.a(this.c.getClickURL(), "-999", "-999");
                                    if (!TextUtils.isEmpty(a2)) {
                                        intent.setData(Uri.parse(a2));
                                        this.b.startActivity(intent);
                                    }
                                } catch (Throwable th) {
                                    w.b("NotifyListener", th.getMessage(), th);
                                }
                                MBTempContainer.l(MBTempContainer.this);
                                break;
                            }
                    }
                } else {
                    MBTempContainer.this.C.a(false, MBTempContainer.this.l, MBTempContainer.this.k);
                }
            } else {
                if (MBTempContainer.this.e != null) {
                    MBTempContainer.this.e.setVisible(4);
                }
                MBTempContainer.this.ag = true;
                MBTempContainer.this.C.b(MBTempContainer.this.l, MBTempContainer.this.k);
            }
            super.a(i, obj);
        }
    }

    /* access modifiers changed from: private */
    public final class c extends com.mbridge.msdk.video.module.a.a.e {
        private c() {
        }

        @Override // com.mbridge.msdk.video.module.a.a.e, com.mbridge.msdk.video.module.a.a
        public final void a(int i, Object obj) {
            String str;
            super.a(i, obj);
            try {
                if (obj instanceof JSONObject) {
                    str = obj.toString();
                } else {
                    str = (String) obj;
                }
                if (MBTempContainer.this.r && !TextUtils.isEmpty(str)) {
                    JSONObject jSONObject = new JSONObject(str);
                    int optInt = jSONObject.optInt("type");
                    int optInt2 = jSONObject.optInt("complete");
                    if (optInt == 2) {
                        MBTempContainer.this.G = com.mbridge.msdk.foundation.same.a.B;
                    } else if (optInt != 3) {
                        MBTempContainer.this.G = com.mbridge.msdk.foundation.same.a.z;
                    } else {
                        MBTempContainer.this.G = com.mbridge.msdk.foundation.same.a.A;
                    }
                    MBTempContainer.this.H = optInt2;
                }
            } catch (Exception unused) {
                w.d("NotifyListener", "PlayableResultListener ERROR");
            }
            if (i == 120) {
                MBTempContainer.this.C.b(MBTempContainer.this.l, MBTempContainer.this.k);
            } else if (i == 126) {
                MBTempContainer.this.C.a(false, MBTempContainer.this.l, MBTempContainer.this.k);
            } else if (i != 127) {
                switch (i) {
                    case 100:
                        MBTempContainer.this.ah = true;
                        MBTempContainer.this.g.postDelayed(MBTempContainer.this.am, 250);
                        MBTempContainer.this.C.a();
                        return;
                    case 101:
                    case 102:
                        MBTempContainer.this.getJSCommon().e();
                        return;
                    case 103:
                        MBTempContainer.this.aa = true;
                        if (MBTempContainer.this.A.isMraid()) {
                            MBTempContainer.l(MBTempContainer.this);
                            return;
                        } else {
                            MBTempContainer.this.getJSCommon().e();
                            return;
                        }
                    case 104:
                        MBTempContainer.l(MBTempContainer.this);
                        return;
                    case 105:
                        if (MBTempContainer.this.I == null) {
                            MBTempContainer.this.I = new com.mbridge.msdk.video.bt.module.a.b() {
                                /* class com.mbridge.msdk.video.bt.module.MBTempContainer.c.AnonymousClass1 */

                                @Override // com.mbridge.msdk.video.bt.module.a.b
                                public final void a() {
                                    MBTempContainer.this.getJSVideoModule().setInstallDialogState(true);
                                    MBTempContainer.this.getJSVideoModule().setCover(true);
                                    MBTempContainer.this.getJSVideoModule().videoOperate(2);
                                }

                                @Override // com.mbridge.msdk.video.bt.module.a.b
                                public final void b() {
                                    MBTempContainer.this.getJSVideoModule().setInstallDialogState(false);
                                    MBTempContainer.this.getJSVideoModule().setCover(false);
                                    MBTempContainer.this.getJSVideoModule().videoOperate(1);
                                }
                            };
                        }
                        MBTempContainer.this.getJSCommon().a(MBTempContainer.this.I);
                        MBTempContainer.this.getJSCommon().click(1, obj != null ? obj.toString() : "");
                        return;
                    default:
                        return;
                }
            } else {
                MBTempContainer.this.aa = true;
                MBTempContainer.this.C.a();
                MBTempContainer.this.C.b(MBTempContainer.this.l, MBTempContainer.this.k);
                MBTempContainer.this.getJSContainerModule().showEndcard(100);
            }
        }
    }

    private class d extends c.a {
        private d() {
        }

        @Override // com.mbridge.msdk.video.js.c.a, com.mbridge.msdk.video.js.a.c.a
        public final void a() {
            super.a();
            MBTempContainer.this.receiveSuccess();
        }

        @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener, com.mbridge.msdk.video.js.a.c.a
        public final void onStartRedirection(Campaign campaign, String str) {
            super.onStartRedirection(campaign, str);
            MBTempContainer.L(MBTempContainer.this);
        }

        @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener, com.mbridge.msdk.video.js.a.c.a
        public final void onFinishRedirection(Campaign campaign, String str) {
            super.onFinishRedirection(campaign, str);
            MBTempContainer.this.ae = true;
            MBTempContainer.M(MBTempContainer.this);
            if (campaign != null && (campaign instanceof CampaignEx)) {
                try {
                    CampaignEx campaignEx = (CampaignEx) campaign;
                    String optString = new JSONObject(MBTempContainer.this.getJSVideoModule().getCurrentProgress()).optString("progress", "");
                    if (campaignEx.getLinkType() == 3 && campaignEx.getEndcard_click_result() == 2 && optString.equals("1.0") && MBTempContainer.this.j != null) {
                        if (MBTempContainer.this.w) {
                            MBTempContainer.l(MBTempContainer.this);
                        } else {
                            MBTempContainer.this.j.finish();
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }

        @Override // com.mbridge.msdk.out.NativeListener.NativeTrackingListener, com.mbridge.msdk.video.js.a.c.a
        public final void onRedirectionFailed(Campaign campaign, String str) {
            super.onRedirectionFailed(campaign, str);
            MBTempContainer.M(MBTempContainer.this);
            MBTempContainer.this.ae = true;
        }

        @Override // com.mbridge.msdk.video.js.c.a, com.mbridge.msdk.video.js.a.c.a
        public final void a(boolean z) {
            super.a(z);
            MBTempContainer.this.C.a(z, MBTempContainer.this.l, MBTempContainer.this.k);
        }

        @Override // com.mbridge.msdk.video.js.c.a, com.mbridge.msdk.video.js.a.c.a
        public final void a(int i, String str) {
            super.a(i, str);
            MBTempContainer.this.defaultLoad(i, str);
        }

        @Override // com.mbridge.msdk.video.js.c.a, com.mbridge.msdk.video.js.a.c.a
        public final void b() {
            super.b();
            if (MBTempContainer.this.g != null) {
                MBTempContainer.this.g.removeCallbacks(MBTempContainer.this.h);
            }
        }
    }

    public void setCampaign(CampaignEx campaignEx) {
        this.A = campaignEx;
        if (campaignEx != null) {
            if (TextUtils.isEmpty(campaignEx.getCampaignUnitId()) && !TextUtils.isEmpty(this.k)) {
                campaignEx.setCampaignUnitId(this.k);
            }
            com.mbridge.msdk.foundation.b.b a2 = com.mbridge.msdk.foundation.b.b.a();
            a2.a(campaignEx.getCampaignUnitId() + "_" + 1, campaignEx);
        }
    }

    public CampaignEx getCampaign() {
        return this.A;
    }

    public void setCampaignExpired(boolean z2) {
        try {
            CampaignEx campaignEx = this.A;
            if (campaignEx == null) {
                return;
            }
            if (z2) {
                campaignEx.setSpareOfferFlag(1);
                if (this.s) {
                    this.A.setCbt(0);
                } else if (this.m == null) {
                } else {
                    if (this.m.B() == 1) {
                        this.A.setCbt(1);
                    } else {
                        this.A.setCbt(0);
                    }
                }
            } else {
                campaignEx.setSpareOfferFlag(0);
                if (this.A.isBidCampaign()) {
                    this.A.setCbt(0);
                } else if (this.m != null) {
                    this.A.setCbt(this.m.d());
                }
            }
        } catch (Exception e2) {
            w.d(y, e2.getMessage());
        }
    }

    public void setCampaignDownLoadTask(com.mbridge.msdk.videocommon.download.a aVar) {
        this.B = aVar;
    }

    public void setShowRewardListener(h hVar) {
        this.C = hVar;
    }

    public void setMBridgeTempCallback(com.mbridge.msdk.video.bt.module.a.c cVar) {
        this.D = cVar;
    }

    public void setJSFactory(com.mbridge.msdk.video.js.factory.b bVar) {
        this.F = bVar;
    }

    public void setInstanceId(String str) {
        this.E = str;
    }

    public String getInstanceId() {
        return this.E;
    }

    public void setH5Cbp(int i2) {
        this.U = i2;
    }

    public void setWebViewFront(int i2) {
        this.T = i2;
    }

    public void notifyEvent(String str) {
        WindVaneWebView windVaneWebView = this.d;
        if (windVaneWebView != null) {
            com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) windVaneWebView, str, Base64.encodeToString(this.E.getBytes(), 2));
        }
    }

    public void setNotchPadding(int i2, int i3, int i4, int i5, int i6) {
        this.f122K = i2;
        this.L = i3;
        this.M = i4;
        this.N = i5;
        this.O = i6;
        String a2 = com.mbridge.msdk.foundation.tools.l.a(i2, i3, i4, i5, i6);
        this.P = a2;
        w.d(y, a2);
        if (getJSCommon() != null && !TextUtils.isEmpty(this.P)) {
            getJSCommon().b(this.P);
            if (this.d != null && !TextUtils.isEmpty(this.P)) {
                com.mbridge.msdk.mbjscommon.windvane.h.a().a((WebView) this.d, "oncutoutfetched", Base64.encodeToString(this.P.getBytes(), 0));
            }
        }
        MBridgeVideoView mBridgeVideoView = this.e;
        if (mBridgeVideoView != null) {
            mBridgeVideoView.setNotchPadding(i3, i4, i5, i6);
        }
        MBridgeContainerView mBridgeContainerView = this.f;
        if (mBridgeContainerView != null) {
            mBridgeContainerView.setNotchPadding(i2, i3, i4, i5, i6);
        }
    }

    public void setDeveloperExtraData(String str) {
        this.Q = str;
    }

    public void loadModuleDatas() {
        int i2;
        int i3;
        int i4;
        j b2 = b(this.A);
        if (b2 != null) {
            i2 = b2.l();
        } else {
            i2 = 0;
        }
        if (i2 != 0) {
            this.q = i2;
        }
        int h2 = this.m.h();
        int c2 = c();
        int i5 = c2 != 0 ? c2 : h2;
        this.e.setSoundState(this.q);
        this.e.setCampaign(this.A);
        this.e.setPlayURL(this.B.n());
        CampaignEx campaignEx = this.A;
        if (campaignEx == null || campaignEx.getVst() <= -2) {
            i3 = this.m.g();
        } else {
            i3 = this.A.getVst();
        }
        this.e.setVideoSkipTime(i3);
        this.e.setCloseAlert(this.m.k());
        this.e.setBufferTimeout(h());
        this.e.setNotifyListener(new m(this.F, this.A, this.o, this.B, b(), this.k, i5, i3, new e(), this.m.B(), this.w, this.m.H()));
        this.e.setShowingTransparent(this.ad);
        this.e.setAdSession(this.ak);
        if (this.r && (this.t == com.mbridge.msdk.foundation.same.a.v || this.t == com.mbridge.msdk.foundation.same.a.w)) {
            this.e.setIVRewardEnable(this.t, this.u, this.v);
            this.e.setDialogRole(getJSCommon() != null ? getJSCommon().i() : 1);
        }
        this.f.setCampaign(this.A);
        this.f.setUnitID(this.k);
        if (this.A.getCbd() > -2) {
            i4 = this.A.getCbd();
        } else {
            i4 = this.m.o();
        }
        this.f.setCloseDelayTime(i4);
        this.f.setPlayCloseBtnTm(this.m.j());
        this.f.setVideoInteractiveType(this.m.i());
        this.f.setEndscreenType(this.m.p());
        this.f.setVideoSkipTime(i3);
        this.f.setShowingTransparent(this.ad);
        this.f.setJSFactory(this.F);
        if (this.A.getPlayable_ads_without_video() == 2) {
            this.f.setNotifyListener(new g(this.A, this.B, this.o, b(), this.k, new c(), this.m.B(), this.w));
            this.f.preLoadData(this.F);
            this.f.showPlayableView();
        } else {
            this.f.setNotifyListener(new com.mbridge.msdk.video.module.a.a.b(this.F, this.A, this.o, this.B, b(), this.k, new b(this.j, this.A), this.m.B(), this.w));
            this.f.preLoadData(this.F);
            this.e.preLoadData(this.F);
        }
        if (this.ad) {
            this.f.setMBridgeClickMiniCardViewTransparent();
        }
    }

    static /* synthetic */ void l(MBTempContainer mBTempContainer) {
        try {
            if (mBTempContainer.D != null) {
                if (mBTempContainer.r && (mBTempContainer.t == com.mbridge.msdk.foundation.same.a.v || mBTempContainer.t == com.mbridge.msdk.foundation.same.a.w)) {
                    com.mbridge.msdk.video.bt.module.a.c cVar = mBTempContainer.D;
                    boolean z2 = true;
                    if (mBTempContainer.H != 1) {
                        z2 = false;
                    }
                    cVar.a(z2, mBTempContainer.G);
                }
                mBTempContainer.D.a(mBTempContainer.E, mBTempContainer.aa, mBTempContainer.o);
            } else if (mBTempContainer.j != null) {
                mBTempContainer.j.finish();
            }
        } catch (Exception unused) {
            if (mBTempContainer.j != null) {
                mBTempContainer.j.finish();
            }
        }
    }

    static /* synthetic */ void L(MBTempContainer mBTempContainer) {
        if (mBTempContainer.isLoadSuccess()) {
            mBTempContainer.j.runOnUiThread(new Runnable() {
                /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass8 */

                public final void run() {
                    MBTempContainer.this.V.setBackgroundColor(0);
                    MBTempContainer.this.V.setVisibility(0);
                    MBTempContainer.this.V.bringToFront();
                }
            });
        }
    }

    static /* synthetic */ void M(MBTempContainer mBTempContainer) {
        if (mBTempContainer.isLoadSuccess()) {
            mBTempContainer.j.runOnUiThread(new Runnable() {
                /* class com.mbridge.msdk.video.bt.module.MBTempContainer.AnonymousClass9 */

                public final void run() {
                    MBTempContainer.this.V.setVisibility(8);
                }
            });
        }
    }
}