导航菜单

页面标题

页面副标题

小柿子 v1.3.8 - MBRewardVideoActivity.java 源代码

正在查看: 小柿子 v1.3.8 应用的 MBRewardVideoActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.mbridge.msdk.reward.player;

import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.entity.RewardPlus;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.foundation.tools.ak;
import com.mbridge.msdk.foundation.tools.x;
import com.mbridge.msdk.mbsignalcommon.confirmation.e;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
import com.mbridge.msdk.newreward.function.common.MBridgeGlobalCommon;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.mbridge.msdk.reward.adapter.RewardUnitCacheManager;
import com.mbridge.msdk.scheme.applet.AppletModelManager;
import com.mbridge.msdk.video.bt.module.MBTempContainer;
import com.mbridge.msdk.video.bt.module.MBridgeBTContainer;
import com.mbridge.msdk.video.bt.module.b.h;
import com.mbridge.msdk.video.dynview.e.d;
import com.mbridge.msdk.video.signal.a.k;
import com.mbridge.msdk.video.signal.activity.AbstractJSActivity;
import com.mbridge.msdk.videocommon.a;
import com.mbridge.msdk.videocommon.b.c;
import com.mbridge.msdk.videocommon.download.j;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class MBRewardVideoActivity extends AbstractJSActivity {
    public static String INTENT_EXTRADATA = "extraData";
    public static String INTENT_ISBID = "isBid";
    public static String INTENT_ISBIG_OFFER = "isBigOffer";
    public static String INTENT_ISIV = "isIV";
    public static String INTENT_IVREWARD_MODETYPE = "ivRewardMode";
    public static String INTENT_IVREWARD_VALUE = "ivRewardValue";
    public static String INTENT_IVREWARD_VALUETYPE = "ivRewardValueType";
    public static String INTENT_LOCAL_REQUEST_ID = "lRid";
    public static String INTENT_MUTE = "mute";
    public static String INTENT_REWARD = "reward";
    public static String INTENT_UNITID = "unitId";
    public static String INTENT_USERID = "userId";
    public static String SAVE_STATE_KEY_REPORT = "hasRelease";
    private boolean A;
    private String I;
    private com.mbridge.msdk.foundation.same.report.d.b J;
    private boolean L;
    private String a;
    private String b;
    private String c;
    private c d;
    private int h;
    private int i;
    private int j;
    private h m;
    private com.mbridge.msdk.videocommon.d.c n;
    private com.mbridge.msdk.videocommon.download.a q;
    private CampaignEx r;
    private List<com.mbridge.msdk.videocommon.download.a> s;
    private List<CampaignEx> t;
    private MBTempContainer u;
    private MBridgeBTContainer v;
    private WindVaneWebView w;
    private com.mbridge.msdk.video.bt.module.a.a x;
    private String y;
    private String z;
    private int e = 2;
    private boolean f = false;

    private boolean f126g = false;
    private boolean k = false;
    private boolean l = false;
    private boolean o = false;
    private boolean p = false;
    private int B = 1;
    private int C = 0;
    private int D = 0;
    private int E = 0;
    private int F = 0;
    private int G = 0;
    private int H = 0;
    private boolean K = false;
    private x.b M = null;
    private y.a N = null;
    private x.a O = null;
    private com.mbridge.msdk.video.dynview.e.a P = new com.mbridge.msdk.video.dynview.e.a() {
        @Override
        public final void a(Map<String, Object> map) {
            if (map == null) {
                return;
            }
            if (map.containsKey("mute")) {
                MBRewardVideoActivity.this.e = ((Integer) map.get("mute")).intValue();
            }
            if (map.containsKey("position")) {
                int intValue = ((Integer) map.get("position")).intValue();
                if (MBRewardVideoActivity.this.t == null || MBRewardVideoActivity.this.t.size() <= 0 || intValue < 1) {
                    return;
                }
                MBRewardVideoActivity mBRewardVideoActivity = MBRewardVideoActivity.this;
                mBRewardVideoActivity.r = (CampaignEx) mBRewardVideoActivity.t.get(intValue);
                MBRewardVideoActivity.b(MBRewardVideoActivity.this);
                int i = intValue - 1;
                if (MBRewardVideoActivity.this.t.get(i) != null) {
                    MBRewardVideoActivity mBRewardVideoActivity2 = MBRewardVideoActivity.this;
                    MBRewardVideoActivity.b(mBRewardVideoActivity2, ((CampaignEx) mBRewardVideoActivity2.t.get(i)).getVideoLength());
                }
                MBRewardVideoActivity mBRewardVideoActivity3 = MBRewardVideoActivity.this;
                MBRewardVideoActivity.this.r.setVideoCompleteTime(mBRewardVideoActivity3.a(mBRewardVideoActivity3.r.getVideoCompleteTime(), MBRewardVideoActivity.this.B));
                MBRewardVideoActivity.this.r.setShowIndex(MBRewardVideoActivity.this.B);
                MBRewardVideoActivity.this.r.setShowType(1);
                MBRewardVideoActivity mBRewardVideoActivity4 = MBRewardVideoActivity.this;
                mBRewardVideoActivity4.b(mBRewardVideoActivity4.r);
            }
        }
    };
    private d Q = new d() {
        @Override
        public final void a(CampaignEx campaignEx) {
            if (campaignEx == null) {
                MBRewardVideoActivity.this.a("campaign is null");
                return;
            }
            if (MBRewardVideoActivity.this.v != null) {
                new com.mbridge.msdk.video.dynview.h.b().b(MBRewardVideoActivity.this.v, 500L);
            }
            MBRewardVideoActivity.this.r = campaignEx;
            MBRewardVideoActivity.this.r.setShowType(2);
            MBRewardVideoActivity mBRewardVideoActivity = MBRewardVideoActivity.this;
            mBRewardVideoActivity.b(mBRewardVideoActivity.r);
        }

        @Override
        public final void a() {
            if (MBRewardVideoActivity.this.v != null) {
                new com.mbridge.msdk.video.dynview.h.b().b(MBRewardVideoActivity.this.v, 500L);
            }
            MBRewardVideoActivity.this.k = true;
            MBRewardVideoActivity.this.b();
            if (MBRewardVideoActivity.this.u != null) {
                MBRewardVideoActivity.this.u.setNotchPadding(MBRewardVideoActivity.this.H, MBRewardVideoActivity.this.D, MBRewardVideoActivity.this.F, MBRewardVideoActivity.this.E, MBRewardVideoActivity.this.G);
            }
        }
    };

    public static final class a implements Runnable {
        private final List<com.mbridge.msdk.videocommon.download.a> a;
        private final String b;
        private final String c;

        public a(List<com.mbridge.msdk.videocommon.download.a> list, String str, String str2) {
            this.a = list;
            this.b = str;
            this.c = str2;
        }

        @Override
        public final void run() {
            try {
                List<com.mbridge.msdk.videocommon.download.a> list = this.a;
                if (list == null || list.size() <= 0) {
                    return;
                }
                for (com.mbridge.msdk.videocommon.download.a aVar : this.a) {
                    if (aVar != null && aVar.l() != null) {
                        CampaignEx l = aVar.l();
                        try {
                            AppletModelManager.getInstance().remove(l);
                        } catch (Exception e) {
                            if (MBridgeConstans.DEBUG) {
                                af.b("MBRewardVideoActivity", "AppletModelManager remove error", e);
                            }
                        }
                        String str = l.getRequestId() + l.getId() + l.getVideoUrlEncode();
                        j c = com.mbridge.msdk.videocommon.download.b.getInstance().c(this.b);
                        if (c != null) {
                            try {
                                c.b(str);
                            } catch (Exception e5) {
                                if (MBridgeConstans.DEBUG) {
                                    af.b("DownLoadManager", e5.getMessage());
                                }
                            }
                        }
                        if (l.getRewardTemplateMode() != null) {
                            if (!TextUtils.isEmpty(l.getRewardTemplateMode().e())) {
                                com.mbridge.msdk.videocommon.a.b(this.b + "_" + l.getId() + "_" + this.c + "_" + l.getRewardTemplateMode().e());
                                com.mbridge.msdk.videocommon.a.b(l.getAdType(), l);
                            }
                            if (!TextUtils.isEmpty(l.getCMPTEntryUrl())) {
                                com.mbridge.msdk.videocommon.a.b(this.b + "_" + this.c + "_" + l.getCMPTEntryUrl());
                            }
                            com.mbridge.msdk.videocommon.a.a.a().a(l);
                        }
                    }
                }
            } catch (Exception e6) {
                af.a("MBRewardVideoActivity", e6.getMessage());
            }
        }
    }

    public static final class b implements Runnable {
        private final List<com.mbridge.msdk.videocommon.download.a> a;
        private final String b;

        public b(String str, List<com.mbridge.msdk.videocommon.download.a> list) {
            this.a = list;
            this.b = str;
        }

        @Override
        public final void run() {
            try {
                List<com.mbridge.msdk.videocommon.download.a> list = this.a;
                if (list == null || list.size() <= 0) {
                    return;
                }
                for (com.mbridge.msdk.videocommon.download.a aVar : this.a) {
                    if (aVar != null && aVar.l() != null) {
                        com.mbridge.msdk.videocommon.a.a.a().a(aVar.l(), this.b);
                    }
                }
            } catch (Throwable th) {
                af.b("MBRewardVideoActivity", th.getMessage());
            }
        }
    }

    public static int b(MBRewardVideoActivity mBRewardVideoActivity) {
        int i = mBRewardVideoActivity.B;
        mBRewardVideoActivity.B = i + 1;
        return i;
    }

    public void changeHalfScreenPadding(int i) {
        try {
            CampaignEx campaignEx = this.r;
            if (campaignEx == null || campaignEx.getAdSpaceT() != 2) {
                return;
            }
            getWindow().getDecorView().setBackground(new ColorDrawable(0));
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.u.getLayoutParams();
            int a5 = ak.a((Context) this, 58.0f);
            int a6 = ak.a((Context) this, 104.0f);
            if (this.r.getRewardTemplateMode().b() == 0) {
                if (i == 2) {
                    layoutParams.setMargins(a6, a5, a6, a5);
                } else {
                    layoutParams.setMargins(a5, a6, a5, a6);
                }
            } else if (this.r.getRewardTemplateMode().b() == 2) {
                layoutParams.setMargins(a6, a5, a6, a5);
            } else {
                layoutParams.setMargins(a5, a6, a5, a6);
            }
            this.u.setLayoutParams(layoutParams);
        } catch (Throwable th) {
            af.b("MBRewardVideoActivity", th.getMessage());
        }
    }

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

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

    public void finish() {
        if (this.M != null) {
            af.b("omsdk", "mbrewardvideoac finish");
            this.M.e();
            this.M.c();
            this.M = null;
        }
        com.mbridge.msdk.foundation.controller.c.q().b(0);
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onDestroy();
            this.u = null;
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onDestroy();
            this.v = null;
        }
        com.mbridge.msdk.foundation.d.b.a().c(this.a);
        super/*android.app.Activity*/.finish();
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onBackPressed();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onBackPressed();
        }
    }

    @Override
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        if (this.u != null) {
            changeHalfScreenPadding(configuration.orientation);
            this.u.onConfigurationChanged(configuration);
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onConfigurationChanged(configuration);
        }
    }

    public void onCreate(Bundle bundle) {
        List<com.mbridge.msdk.videocommon.download.a> list;
        String str = "";
        super.onCreate(bundle);
        MBridgeConstans.isRewardActivityShowing = true;
        com.mbridge.msdk.foundation.controller.c.q().a(this);
        try {
            Intent intent = getIntent();
            this.a = intent.getStringExtra(INTENT_UNITID);
            this.b = intent.getStringExtra(MBridgeConstans.PLACEMENT_ID);
            this.d = c.b(intent.getStringExtra(INTENT_REWARD));
            this.c = intent.getStringExtra(INTENT_USERID);
            this.e = intent.getIntExtra(INTENT_MUTE, 2);
            this.f = intent.getBooleanExtra(INTENT_ISIV, false);
            int i = 287;
            com.mbridge.msdk.foundation.controller.c.q().b(this.f ? 287 : 94);
            this.f126g = intent.getBooleanExtra(INTENT_ISBID, false);
            this.z = intent.getStringExtra(INTENT_EXTRADATA);
            boolean booleanExtra = intent.getBooleanExtra("is_refactor", false);
            this.K = booleanExtra;
            if (booleanExtra) {
                this.m = MBridgeGlobalCommon.showRewardListener;
            } else {
                this.m = com.mbridge.msdk.reward.b.a.f.get(this.a);
            }
            if (this.f) {
                this.h = intent.getIntExtra(INTENT_IVREWARD_MODETYPE, 0);
                this.i = intent.getIntExtra(INTENT_IVREWARD_VALUETYPE, 0);
                this.j = intent.getIntExtra(INTENT_IVREWARD_VALUE, 0);
            }
            this.k = intent.getBooleanExtra(INTENT_ISBIG_OFFER, false);
            this.s = com.mbridge.msdk.videocommon.download.b.getInstance().b(this.a);
            this.t = com.mbridge.msdk.videocommon.download.b.getInstance().a(this.a);
            int findLayout = findLayout("mbridge_more_offer_activity");
            if (findLayout < 0) {
                a("no mbridge_more_offer_activity layout");
                return;
            }
            setContentView(findLayout);
            if (TextUtils.isEmpty(this.a)) {
                a("data empty error");
                return;
            }
            com.mbridge.msdk.video.signal.factory.b bVar = new com.mbridge.msdk.video.signal.factory.b(this);
            this.jsFactory = bVar;
            registerJsFactory(bVar);
            if (this.m == null) {
                a("showRewardListener is null");
                return;
            }
            com.mbridge.msdk.videocommon.d.c cVar = RewardUnitCacheManager.getInstance().get(this.b, this.a);
            this.n = cVar;
            if (cVar == null) {
                com.mbridge.msdk.videocommon.d.c a5 = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.c.q().k(), this.a);
                this.n = a5;
                if (a5 == null) {
                    this.n = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.c.q().k(), this.a, this.f);
                }
            }
            com.mbridge.msdk.videocommon.d.c cVar2 = this.n;
            if (cVar2 != null) {
                this.d.a(cVar2.m());
                this.d.a(this.n.n());
            }
            c cVar3 = this.d;
            if (cVar3 != null && cVar3.b() <= 0) {
                this.d.a(1);
            }
            int a6 = x.a(this, "mbridge_reward_activity_open", "anim");
            int a7 = x.a(this, "mbridge_reward_activity_stay", "anim");
            if (a6 > 1 && a7 > 1) {
                overridePendingTransition(a6, a7);
            }
            if (bundle != null) {
                try {
                    this.p = bundle.getBoolean(SAVE_STATE_KEY_REPORT);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            af.a("DynamicViewCampaignResourceDownloader", "进入 show,大模板 " + this.k);
            if (!this.k) {
                List<com.mbridge.msdk.videocommon.download.a> list2 = this.s;
                if (list2 != null && list2.size() > 0) {
                    this.q = this.s.get(0);
                }
                com.mbridge.msdk.videocommon.download.a aVar = this.q;
                if (aVar != null) {
                    this.r = aVar.l();
                    this.q.e(true);
                    this.q.f(false);
                    CampaignEx campaignEx = this.r;
                    if (campaignEx != null) {
                        this.I = campaignEx.getCurrentLocalRid();
                        this.r.setShowIndex(1);
                        this.r.setShowType(1);
                        com.mbridge.msdk.reward.b.a.b = this.r.getEcppv();
                        com.mbridge.msdk.click.d.a(com.mbridge.msdk.foundation.controller.c.q().c(), this.r.getMaitve(), this.r.getMaitve_src());
                    }
                }
                if (this.q == null || this.r == null || this.d == null) {
                    a("data empty error");
                }
                ArrayList arrayList = new ArrayList();
                arrayList.add(this.r);
                b(arrayList);
                a(this.r);
                b();
                if (com.mbridge.msdk.f.b.a()) {
                    return;
                }
                a();
                return;
            }
            b(this.t);
            this.y = "";
            List<CampaignEx> list3 = this.t;
            if (list3 != null && list3.size() > 0) {
                CampaignEx campaignEx2 = this.t.get(0);
                a(campaignEx2);
                str = campaignEx2.getCMPTEntryUrl();
                this.y = campaignEx2.getRequestId();
                this.I = campaignEx2.getCurrentLocalRid();
                com.mbridge.msdk.reward.b.a.b = campaignEx2.getEcppv();
                com.mbridge.msdk.click.d.a(com.mbridge.msdk.foundation.controller.c.q().c(), campaignEx2.getMaitve(), campaignEx2.getMaitve_src());
            }
            a.C0066a a8 = com.mbridge.msdk.videocommon.a.a(this.a + "_" + this.y + "_" + str);
            WindVaneWebView a9 = a8 != null ? a8.a() : null;
            this.w = a9;
            if (a9 == null) {
                if (this.q == null && (list = this.s) != null && list.size() > 0) {
                    this.q = this.s.get(0);
                }
                if (this.q == null) {
                    com.mbridge.msdk.videocommon.download.b bVar2 = com.mbridge.msdk.videocommon.download.b.getInstance();
                    if (!this.f) {
                        i = 94;
                    }
                    String str2 = this.a;
                    boolean z = this.f126g;
                    j c = bVar2.c(str2);
                    this.q = c != null ? c.b(i, z) : null;
                }
                com.mbridge.msdk.videocommon.download.a aVar2 = this.q;
                if (aVar2 != null) {
                    this.r = aVar2.l();
                    this.q.e(true);
                    this.q.f(false);
                }
                if (this.q != null && this.r != null && this.d != null) {
                    this.k = false;
                    List<CampaignEx> a10 = com.mbridge.msdk.videocommon.a.a.a().a(this.t);
                    if (a10 == null) {
                        a("no available campaign");
                        return;
                    }
                    int size = a10.size();
                    if (size == 0) {
                        a("no available campaign");
                        return;
                    }
                    if (a10.get(0) == null || !(this.K || a10.get(0).isDynamicView())) {
                        b();
                    } else if (size == 1) {
                        CampaignEx campaignEx3 = a10.get(0);
                        this.r = campaignEx3;
                        if (campaignEx3 != null) {
                            this.I = campaignEx3.getCurrentLocalRid();
                            this.r.setCampaignIsFiltered(true);
                        }
                        b(this.r);
                    } else {
                        a(a10);
                    }
                }
                a("data empty error");
                return;
            }
            a(this.t.get(0));
            WindVaneWebView windVaneWebView = this.w;
            if (windVaneWebView != null) {
                try {
                    k kVar = (k) windVaneWebView.getObject();
                    kVar.a(this.O);
                    kVar.a(this.M);
                    kVar.a(this.N);
                    this.w.setObject(kVar);
                } catch (Exception e5) {
                    af.b("MBRewardVideoActivity", e5.getMessage());
                }
            }
            c();
            if (com.mbridge.msdk.f.b.a()) {
                return;
            }
            a();
        } catch (Throwable th) {
            b(this.t);
            a("onCreate error" + th);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        com.mbridge.msdk.foundation.same.report.d.c.a().a("2000151", this.r);
        try {
            h hVar = this.m;
            if (hVar instanceof com.mbridge.msdk.video.bt.module.b.b) {
                com.mbridge.msdk.video.bt.module.b.b bVar = (com.mbridge.msdk.video.bt.module.b.b) hVar;
                if (!bVar.b && !bVar.c) {
                    hVar.a(this.J, "show fail : unexpected destroy");
                }
            }
        } catch (Throwable th) {
            af.b("MBRewardVideoActivity", th.getMessage());
        }
        com.mbridge.msdk.video.module.b.b.a(this.a);
        try {
            List<CampaignEx> list = this.t;
            if (list != null && list.size() > 0) {
                Iterator<CampaignEx> it = this.t.iterator();
                while (it.hasNext()) {
                    d(it.next());
                }
            }
            CampaignEx campaignEx = this.r;
            if (campaignEx != null) {
                d(campaignEx);
            }
        } catch (Throwable th2) {
            af.b("MBRewardVideoActivity", th2.getMessage());
        }
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onDestroy();
            this.u = null;
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onDestroy();
            this.v = null;
        }
        this.P = null;
        this.Q = null;
        com.mbridge.msdk.foundation.d.b.a().c(this.a + "_1");
        com.mbridge.msdk.foundation.d.b.a().c(this.a + "_2");
        com.mbridge.msdk.foundation.same.f.b.b().execute(new a(this.s, this.a, this.y));
    }

    @Override
    public void onPause() {
        super.onPause();
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onPause();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onPause();
        }
    }

    public void onRestart() {
        super/*android.app.Activity*/.onRestart();
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onRestart();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onRestart();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        if (com.mbridge.msdk.foundation.d.b.c) {
            return;
        }
        com.mbridge.msdk.foundation.controller.c.q().a(this);
        try {
            com.mbridge.msdk.foundation.same.f.b.b().execute(new b(this.a, this.s));
        } catch (Throwable th) {
            af.b("MBRewardVideoActivity", th.getMessage());
        }
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onResume();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onResume();
        }
    }

    public void onSaveInstanceState(Bundle bundle) {
        bundle.putBoolean(SAVE_STATE_KEY_REPORT, this.p);
        super/*android.app.Activity*/.onSaveInstanceState(bundle);
    }

    public void onStart() {
        super/*android.app.Activity*/.onStart();
        if (com.mbridge.msdk.foundation.d.b.c) {
            return;
        }
        new com.mbridge.msdk.foundation.d.a() {
            public final void a() {
                MBRewardVideoActivity.this.onPause();
            }

            public final void b() {
                MBRewardVideoActivity.this.onResume();
            }

            public final void a(String str) {
                MBRewardVideoActivity.this.onResume();
            }
        };
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onStart();
            this.r.setCampaignUnitId(this.a);
            com.mbridge.msdk.foundation.d.b.a().a(this.a + "_1", this.r);
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onStart();
            List<CampaignEx> list = this.t;
            if (list != null && list.size() > 0) {
                CampaignEx campaignEx = this.t.get(0);
                campaignEx.setCampaignUnitId(this.a);
                com.mbridge.msdk.foundation.d.b.a().a(this.a + "_1", campaignEx);
            }
        }
        if (this.A) {
            return;
        }
        com.mbridge.msdk.foundation.d.b.a().a(this.a + "_1", 1);
        com.mbridge.msdk.foundation.d.b.a().c(this.a + "_2");
        this.A = true;
    }

    public void onStop() {
        MBridgeConstans.isRewardActivityShowing = false;
        super/*android.app.Activity*/.onStop();
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onStop();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onStop();
        }
    }

    public void setTheme(int i) {
        super/*android.app.Activity*/.setTheme(x.a(this, "mbridge_transparent_theme", TtmlNode.TAG_STYLE));
    }

    public void setTopControllerPadding(int i, int i5, int i6, int i7, int i8) {
        this.D = i5;
        this.F = i6;
        this.E = i7;
        this.G = i8;
        this.H = i;
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.setNotchPadding(i, i5, i6, i7, i8);
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.setNotchPadding(i, i5, i6, i7, i8);
        }
        com.mbridge.msdk.video.dynview.a.a.e = i;
        com.mbridge.msdk.video.dynview.a.a.a = i5;
        com.mbridge.msdk.video.dynview.a.a.b = i6;
        com.mbridge.msdk.video.dynview.a.a.c = i7;
        com.mbridge.msdk.video.dynview.a.a.d = i8;
    }

    public static int b(MBRewardVideoActivity mBRewardVideoActivity, int i) {
        int i5 = mBRewardVideoActivity.C - i;
        mBRewardVideoActivity.C = i5;
        return i5;
    }

    private void c(CampaignEx campaignEx) {
        com.mbridge.msdk.videocommon.d.c cVar = this.n;
        String str = this.a;
        if (campaignEx == null || cVar == null || TextUtils.isEmpty(str) || TextUtils.isEmpty(com.mbridge.msdk.videocommon.d.c.a)) {
            return;
        }
        try {
            e.a().a(com.mbridge.msdk.videocommon.d.c.a, campaignEx, (Context) this, str, (com.mbridge.msdk.mbsignalcommon.confirmation.c) null);
        } catch (Exception e) {
            if (MBridgeConstans.DEBUG) {
                af.b("MBRewardVideoActivityDiff", e.getMessage());
            }
        }
    }

    private com.mbridge.msdk.video.bt.module.a.a d() {
        if (this.x == null) {
            this.x = new com.mbridge.msdk.video.bt.module.a.a() {
                @Override
                public final void a() {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(MBRewardVideoActivity.this.J);
                    }
                }

                @Override
                public final void b(String str, String str2) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.b(str, str2);
                    }
                }

                @Override
                public final void a(boolean z, c cVar) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(MBRewardVideoActivity.this.J, z, cVar);
                    }
                }

                @Override
                public final void a(boolean z, int i) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(z, i);
                    }
                }

                @Override
                public final void a(String str) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(MBRewardVideoActivity.this.J, str);
                    }
                }

                @Override
                public final void a(boolean z, String str, String str2) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(z, str, str2);
                    }
                }

                @Override
                public final void a(String str, String str2) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(str, str2);
                    }
                }

                @Override
                public final void a(int i, String str, String str2) {
                    if (MBRewardVideoActivity.this.m != null) {
                        MBRewardVideoActivity.this.m.a(i, str, str2);
                    }
                }
            };
        }
        return this.x;
    }

    public void b(CampaignEx campaignEx) {
        CampaignEx l;
        try {
            List<com.mbridge.msdk.videocommon.download.a> list = this.s;
            if (list != null && list.size() > 0) {
                for (com.mbridge.msdk.videocommon.download.a aVar : this.s) {
                    if (aVar != null && (l = aVar.l()) != null && TextUtils.equals(l.getId(), campaignEx.getId()) && TextUtils.equals(l.getRequestId(), campaignEx.getRequestId())) {
                        this.q = aVar;
                    }
                }
            }
            this.k = true;
            b();
            MBTempContainer mBTempContainer = this.u;
            if (mBTempContainer != null) {
                mBTempContainer.setNotchPadding(this.H, this.D, this.F, this.E, this.G);
            }
        } catch (Exception e) {
            af.b("MBRewardVideoActivity", e.getMessage());
            a("more offer to one offer exception");
        }
    }

    private void d(CampaignEx campaignEx) {
        if (campaignEx != null) {
            if (!TextUtils.isEmpty(campaignEx.getImageUrl())) {
                com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.q().c()).a(campaignEx.getImageUrl());
            }
            if (TextUtils.isEmpty(campaignEx.getIconUrl())) {
                return;
            }
            com.mbridge.msdk.foundation.same.c.b.a(com.mbridge.msdk.foundation.controller.c.q().c()).a(campaignEx.getIconUrl());
        }
    }

    private void a(CampaignEx campaignEx) {
        if (campaignEx != null) {
            try {
                if (campaignEx.isActiveOm() && this.M == null) {
                    x.b a5 = com.mbridge.msdk.a.b.a(getApplicationContext(), false, campaignEx.getOmid(), campaignEx.getRequestId(), campaignEx.getId(), this.a, campaignEx.getVideoUrlEncode(), campaignEx.getRequestIdNotice());
                    this.M = a5;
                    if (a5 != null) {
                        this.O = x.a.a(a5);
                        this.N = y.a.g(this.M);
                    }
                }
            } catch (Throwable th) {
                af.b("MBRewardVideoActivity", th.getMessage());
            }
        }
    }

    private void c() {
        RewardPlus rewardPlus;
        List<CampaignEx> list;
        int findID = findID("mbridge_bt_container");
        if (findID < 0) {
            a("no mbridge_webview_framelayout in mbridge_more_offer_activity layout");
        }
        MBridgeBTContainer mBridgeBTContainer = (MBridgeBTContainer) findViewById(findID);
        this.v = mBridgeBTContainer;
        if (mBridgeBTContainer == null) {
            a("env error");
        }
        this.v.setVisibility(0);
        com.mbridge.msdk.video.bt.module.a.a d = d();
        this.x = d;
        this.v.setBTContainerCallback(d);
        this.v.setShowRewardVideoListener(this.m);
        this.v.setChoiceOneCallback(this.Q);
        this.v.setCampaigns(this.t);
        this.v.setCampaignDownLoadTasks(this.s);
        this.v.setRewardUnitSetting(this.n);
        this.v.setUnitId(this.a);
        this.v.setPlacementId(this.b);
        this.v.setUserId(this.c);
        this.v.setActivity(this);
        CampaignEx campaignEx = this.r;
        if (((campaignEx != null && (rewardPlus = campaignEx.getRewardPlus()) != null) || (this.t.get(0) != null && (rewardPlus = this.t.get(0).getRewardPlus()) != null)) && !TextUtils.isEmpty(rewardPlus.getName()) && rewardPlus.getAmount() > 0) {
            c cVar = new c(rewardPlus.getName(), rewardPlus.getAmount());
            if (cVar.b() < 0) {
                cVar.a(1);
            }
            this.d = cVar;
        }
        this.v.setReward(this.d);
        this.v.setIVRewardEnable(this.h, this.i, this.j);
        this.v.setIV(this.f);
        this.v.setMute(this.e);
        this.v.setJSFactory((com.mbridge.msdk.video.signal.factory.b) this.jsFactory);
        this.v.setDeveloperExtraData(this.z);
        this.v.init(this);
        this.v.setAdSession(this.M);
        this.v.setVideoEvents(this.N);
        this.v.setAdEvents(this.O);
        this.v.onCreate(this.K);
        if (!com.mbridge.msdk.f.b.a() || (list = this.t) == null || list.size() <= 0 || this.t.get(0) == null) {
            return;
        }
        c(this.t.get(0));
    }

    public void b() {
        List<CampaignEx> list;
        RewardPlus rewardPlus;
        CampaignEx campaignEx;
        List<CampaignEx> list2;
        int findID = findID("mbridge_temp_container");
        if (findID < 0) {
            a("no id mbridge_bt_container in mbridge_more_offer_activity layout");
        }
        MBTempContainer mBTempContainer = (MBTempContainer) findViewById(findID);
        this.u = mBTempContainer;
        if (mBTempContainer == null) {
            a("env error");
        }
        List<CampaignEx> list3 = this.t;
        if (list3 != null && list3.size() > 0 && this.t.get(0).isDynamicView()) {
            new com.mbridge.msdk.video.dynview.h.b().c(this.u, 500L);
        } else {
            this.u.setVisibility(0);
        }
        changeHalfScreenPadding(-1);
        this.u.setActivity(this);
        this.u.setBidCampaign(this.f126g);
        this.u.setBigOffer(this.k);
        this.u.setUnitId(this.a);
        this.u.setCampaign(this.r);
        if (this.r.getDynamicTempCode() == 5 && (list2 = this.t) != null && list2.size() > 1) {
            View findViewById = findViewById(findID("mbridge_reward_root_container"));
            if (findViewById != null) {
                findViewById.setBackgroundColor(com.sigmob.sdk.base.blurkit.d.a);
            }
            this.u.removeAllViews();
            this.u.setCampOrderViewData(this.t, this.C);
            this.u.setCamPlayOrderCallback(this.P, this.B);
        }
        this.u.setCampaignDownLoadTask(this.q);
        this.u.setIV(this.f);
        CampaignEx campaignEx2 = this.r;
        if (campaignEx2 != null && campaignEx2.getAdSpaceT() == 2) {
            this.u.setIVRewardEnable(0, 0, 0);
        } else {
            this.u.setIVRewardEnable(this.h, this.i, this.j);
        }
        this.u.setMute(this.e);
        CampaignEx campaignEx3 = this.r;
        if (((campaignEx3 != null && (rewardPlus = campaignEx3.getRewardPlus()) != null) || ((list = this.t) != null && list.size() > 0 && this.t.get(0) != null && (rewardPlus = this.t.get(0).getRewardPlus()) != null)) && !TextUtils.isEmpty(rewardPlus.getName()) && rewardPlus.getAmount() > 0) {
            c cVar = new c(rewardPlus.getName(), rewardPlus.getAmount());
            if (cVar.b() < 0) {
                cVar.a(1);
            }
            this.d = cVar;
        }
        this.u.setReward(this.d);
        this.u.setRewardUnitSetting(this.n);
        this.u.setPlacementId(this.b);
        this.u.setUserId(this.c);
        this.u.setShowRewardListener(this.m);
        this.u.setDeveloperExtraData(this.z);
        this.u.init(this);
        this.u.setAdSession(this.M);
        this.u.setAdEvents(this.O);
        this.u.setVideoEvents(this.N);
        this.u.onCreate();
        if (!com.mbridge.msdk.f.b.a() || (campaignEx = this.r) == null) {
            return;
        }
        c(campaignEx);
    }

    private void a() {
        try {
            ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView();
            BitmapDrawable a5 = com.mbridge.msdk.foundation.controller.c.q().a(this.a, this.f ? 287 : 94);
            if (a5 != null) {
                ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.c.q().c());
                ak.a(imageView, a5, getResources().getDisplayMetrics());
                ((ViewGroup) ((ViewGroup) ((ViewGroup) viewGroup.getChildAt(0)).getChildAt(1)).getChildAt(0)).addView(imageView, new ViewGroup.LayoutParams(-1, -1));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void a(List<CampaignEx> list) {
        int i;
        if (list == null) {
            a("no available campaign");
            return;
        }
        if (list.size() == 0) {
            a("no available campaign");
            return;
        }
        if (list.get(0) != null) {
            i = list.get(0).getDynamicTempCode();
            this.I = list.get(0).getCurrentLocalRid();
        } else {
            i = 0;
        }
        if (i != 5) {
            c();
            return;
        }
        for (CampaignEx campaignEx : list) {
            if (campaignEx != null) {
                this.C += campaignEx.getVideoLength();
            }
        }
        CampaignEx campaignEx2 = list.get(0);
        if (campaignEx2 != null) {
            int a5 = a(campaignEx2.getVideoCompleteTime(), this.B);
            this.r = campaignEx2;
            campaignEx2.setCampaignIsFiltered(true);
            this.B = 1;
            this.r.setVideoCompleteTime(a5);
            this.r.setShowIndex(this.B);
            this.r.setShowType(1);
            b(this.r);
            return;
        }
        a("campaign is less");
    }

    public void a(String str) {
        af.b("MBRewardVideoActivity", str);
        b(this.t);
        h hVar = this.m;
        if (hVar != null) {
            hVar.a(this.J, str);
        }
        finish();
    }

    public int a(int i, int i5) {
        List<CampaignEx> list = this.t;
        if (list == null || list.size() == 0) {
            return i;
        }
        int i6 = 0;
        int i7 = 0;
        for (int i8 = 0; i8 < this.t.size(); i8++) {
            if (this.t.get(0) != null) {
                if (i8 == 0) {
                    i7 = this.t.get(0).getVideoCompleteTime();
                }
                i6 += this.t.get(i8).getVideoLength();
            }
        }
        if (i5 == 1) {
            if (i == 0) {
                if (i6 >= 45) {
                    return 45;
                }
            } else if (i6 > i) {
                if (i > 45) {
                    return 45;
                }
                return i;
            }
            return i6;
        }
        int i9 = 0;
        for (int i10 = 0; i10 < i5 - 1; i10++) {
            if (this.t.get(i10) != null) {
                i9 += this.t.get(i10).getVideoLength();
            }
        }
        if (i7 > i9) {
            return i7 - i9;
        }
        return 0;
    }

    private void b(List<CampaignEx> list) {
        CampaignEx campaignEx;
        if (this.L) {
            return;
        }
        if (list == null) {
            try {
                if (this.k) {
                    list = this.t;
                } else {
                    list = new ArrayList<>();
                    List<com.mbridge.msdk.videocommon.download.a> list2 = this.s;
                    if (list2 != null && list2.get(0) != null && this.s.get(0).l() != null) {
                        list.add(this.s.get(0).l());
                    }
                }
            } catch (Exception e) {
                if (MBridgeConstans.DEBUG) {
                    e.printStackTrace();
                    return;
                }
                return;
            }
        }
        String str = "";
        if (list != null && !list.isEmpty() && (campaignEx = list.get(0)) != null) {
            str = campaignEx.getCurrentLocalRid();
        }
        if (!TextUtils.isEmpty(str)) {
            this.J = com.mbridge.msdk.foundation.same.report.d.c.a().b(str);
        }
        if (this.J == null) {
            this.J = new com.mbridge.msdk.foundation.same.report.d.b();
            com.mbridge.msdk.foundation.same.report.d.d dVar = new com.mbridge.msdk.foundation.same.report.d.d();
            dVar.a("unit_id", this.a);
            dVar.a(CampaignEx.JSON_KEY_HB, Integer.valueOf(this.f126g ? 1 : 0));
            dVar.a("adtp", Integer.valueOf(this.f ? 287 : 94));
            dVar.a("lrid", this.I);
            dVar.a("his_reason", "show campaign is null");
            this.J.a("2000129", dVar);
        }
        if (list != null) {
            this.J.b(list);
        }
        this.L = true;
        com.mbridge.msdk.reward.c.a.a.a().a("2000129", this.J);
    }
}