导航菜单

页面标题

页面副标题

Cantique de Louanges v12 - MBRewardVideoActivity.java 源代码

正在查看: Cantique de Louanges v12 应用的 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.same.report.m;
import com.mbridge.msdk.foundation.tools.aa;
import com.mbridge.msdk.foundation.tools.af;
import com.mbridge.msdk.foundation.tools.t;
import com.mbridge.msdk.mbsignalcommon.windvane.WindVaneWebView;
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.activity.AbstractJSActivity;
import com.mbridge.msdk.videocommon.a;
import com.mbridge.msdk.videocommon.b.c;
import com.mbridge.msdk.videocommon.download.n;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.json.o2;

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_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 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 g = 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 com.mbridge.msdk.video.dynview.e.a J = new com.mbridge.msdk.video.dynview.e.a() {
        @Override
        public final void a(Map<String, Object> map) {
            if (map == null) {
                return;
            }
            if (map.containsKey(CampaignEx.JSON_NATIVE_VIDEO_MUTE)) {
                MBRewardVideoActivity.this.e = ((Integer) map.get(CampaignEx.JSON_NATIVE_VIDEO_MUTE)).intValue();
            }
            if (map.containsKey(o2.h.L)) {
                int intValue = ((Integer) map.get(o2.h.L)).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.this.C -= ((CampaignEx) MBRewardVideoActivity.this.t.get(i)).getVideoLength();
                }
                MBRewardVideoActivity mBRewardVideoActivity2 = MBRewardVideoActivity.this;
                MBRewardVideoActivity.this.r.setVideoCompleteTime(mBRewardVideoActivity2.a(mBRewardVideoActivity2.r.getVideoCompleteTime(), MBRewardVideoActivity.this.B));
                MBRewardVideoActivity mBRewardVideoActivity3 = MBRewardVideoActivity.this;
                mBRewardVideoActivity3.a(mBRewardVideoActivity3.r);
            }
        }
    };
    private d K = 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 mBRewardVideoActivity = MBRewardVideoActivity.this;
            mBRewardVideoActivity.a(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);
            }
        }
    };

    private 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.k() != null) {
                        CampaignEx k = aVar.k();
                        try {
                            AppletModelManager.getInstance().remove(k);
                        } catch (Exception e) {
                            if (MBridgeConstans.DEBUG) {
                                aa.b("MBRewardVideoActivity", "AppletModelManager remove error", e);
                            }
                        }
                        String str = k.getRequestId() + k.getId() + k.getVideoUrlEncode();
                        n c = com.mbridge.msdk.videocommon.download.c.getInstance().c(this.b);
                        if (c != null) {
                            try {
                                c.b(str);
                            } catch (Exception unused) {
                            }
                        }
                        if (k.getRewardTemplateMode() != null) {
                            if (!TextUtils.isEmpty(k.getRewardTemplateMode().e())) {
                                com.mbridge.msdk.videocommon.a.b(this.b + "_" + k.getId() + "_" + this.c + "_" + k.getRewardTemplateMode().e());
                                com.mbridge.msdk.videocommon.a.b(k.getAdType(), k);
                            }
                            if (!TextUtils.isEmpty(k.getCMPTEntryUrl())) {
                                com.mbridge.msdk.videocommon.a.b(this.b + "_" + this.c + "_" + k.getCMPTEntryUrl());
                            }
                            com.mbridge.msdk.videocommon.a.a.a().a(k);
                        }
                    }
                }
            } catch (Exception e2) {
                aa.a("MBRewardVideoActivity", e2.getMessage());
            }
        }
    }

    private 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.k() != null) {
                        com.mbridge.msdk.videocommon.a.a.a().a(aVar.k(), this.b);
                    }
                }
            } catch (Throwable th) {
                aa.d("MBRewardVideoActivity", th.getMessage());
            }
        }
    }

    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 b2 = af.b(this, 58.0f);
            int b3 = af.b(this, 104.0f);
            if (this.r.getRewardTemplateMode().c() == 0) {
                if (i == 2) {
                    layoutParams.setMargins(b3, b2, b3, b2);
                } else {
                    layoutParams.setMargins(b2, b3, b2, b3);
                }
            } else if (this.r.getRewardTemplateMode().c() == 2) {
                layoutParams.setMargins(b3, b2, b3, b2);
            } else {
                layoutParams.setMargins(b2, b3, b2, b3);
            }
            this.u.setLayoutParams(layoutParams);
        } catch (Throwable th) {
            aa.d("MBRewardVideoActivity", th.getMessage());
        }
    }

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

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

    @Override
    public void finish() {
        super.finish();
        com.mbridge.msdk.foundation.controller.b.d().a(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.c.b.a().c(this.a);
    }

    @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);
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        CampaignEx campaignEx;
        List<com.mbridge.msdk.videocommon.download.a> list;
        String str = "";
        super.onCreate(bundle);
        MBridgeConstans.isRewardActivityShowing = true;
        com.mbridge.msdk.foundation.controller.b.d().a((Context) this);
        try {
            int findLayout = findLayout("mbridge_more_offer_activity");
            if (findLayout < 0) {
                a("no mbridge_more_offer_activity layout");
                return;
            }
            setContentView(findLayout);
            Intent intent = getIntent();
            String stringExtra = intent.getStringExtra(INTENT_UNITID);
            this.a = stringExtra;
            if (TextUtils.isEmpty(stringExtra)) {
                a("data empty error");
                return;
            }
            this.m = com.mbridge.msdk.reward.b.a.h.get(this.a);
            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.b.d().a(this.f ? 287 : 94);
            this.g = intent.getBooleanExtra(INTENT_ISBID, false);
            this.z = intent.getStringExtra(INTENT_EXTRADATA);
            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);
            }
            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 a2 = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.b.d().h(), this.a);
                this.n = a2;
                if (a2 == null) {
                    this.n = com.mbridge.msdk.videocommon.d.b.a().a(com.mbridge.msdk.foundation.controller.b.d().h(), 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 a3 = t.a(this, "mbridge_reward_activity_open", "anim");
            int a4 = t.a(this, "mbridge_reward_activity_stay", "anim");
            if (a3 > 1 && a4 > 1) {
                overridePendingTransition(a3, a4);
            }
            if (bundle != null) {
                try {
                    this.p = bundle.getBoolean(SAVE_STATE_KEY_REPORT);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            this.s = com.mbridge.msdk.videocommon.download.c.getInstance().b(this.a);
            this.k = intent.getBooleanExtra(INTENT_ISBIG_OFFER, false);
            aa.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.k();
                    this.q.e(true);
                    this.q.f(false);
                    CampaignEx campaignEx2 = this.r;
                    if (campaignEx2 != null) {
                        this.I = campaignEx2.getCurrentLRid();
                        com.mbridge.msdk.reward.b.a.c = this.r.getLocalRequestId();
                        com.mbridge.msdk.reward.b.a.d = this.r.getEcppv();
                        com.mbridge.msdk.click.b.a(com.mbridge.msdk.foundation.controller.b.d().g(), this.r.getMaitve(), this.r.getMaitve_src());
                    }
                }
                if (this.q == null || this.r == null || this.d == null) {
                    a("data empty error");
                }
                m.a().a("2000129", this.I, new HashMap());
                b();
                a();
                return;
            }
            this.t = com.mbridge.msdk.videocommon.download.c.getInstance().a(this.a);
            m.a().b(this.t);
            this.y = "";
            List<CampaignEx> list3 = this.t;
            if (list3 != null && list3.size() > 0) {
                CampaignEx campaignEx3 = this.t.get(0);
                str = campaignEx3.getCMPTEntryUrl();
                this.y = campaignEx3.getRequestId();
                this.I = campaignEx3.getCurrentLRid();
                com.mbridge.msdk.reward.b.a.c = campaignEx3.getLocalRequestId();
                com.mbridge.msdk.reward.b.a.d = campaignEx3.getEcppv();
                com.mbridge.msdk.click.b.a(com.mbridge.msdk.foundation.controller.b.d().g(), campaignEx3.getMaitve(), campaignEx3.getMaitve_src());
            }
            a.C0063a a5 = com.mbridge.msdk.videocommon.a.a(this.a + "_" + this.y + "_" + str);
            WindVaneWebView a6 = a5 != null ? a5.a() : null;
            this.w = a6;
            if (a6 == 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.c cVar4 = com.mbridge.msdk.videocommon.download.c.getInstance();
                    if (!this.f) {
                        i = 94;
                    }
                    String str2 = this.a;
                    boolean z = this.g;
                    n c = cVar4.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.k();
                    this.q.e(true);
                    this.q.f(false);
                }
                if (this.q != null && (campaignEx = this.r) != null && this.d != null) {
                    this.k = false;
                    try {
                        com.mbridge.msdk.reward.c.a.a(campaignEx, com.mbridge.msdk.foundation.controller.b.d().g(), "showMoreOffer showBTOld", this.a, this.g, this.r.getRequestId(), this.r.getRequestIdNotice(), 0L);
                    } catch (Exception unused) {
                    }
                    List<CampaignEx> a7 = com.mbridge.msdk.videocommon.a.a.a().a(this.t);
                    if (a7 == null) {
                        a("no available campaign");
                        return;
                    }
                    int size = a7.size();
                    if (size == 0) {
                        a("no available campaign");
                        return;
                    }
                    if (a7.get(0) == null || !a7.get(0).isDynamicView()) {
                        m.a().a("2000129", this.r, new HashMap());
                        b();
                    } else if (size == 1) {
                        CampaignEx campaignEx4 = a7.get(0);
                        this.r = campaignEx4;
                        if (campaignEx4 != null) {
                            this.I = campaignEx4.getCurrentLRid();
                            this.r.setCampaignIsFiltered(true);
                            com.mbridge.msdk.reward.c.a.a(this.r, com.mbridge.msdk.foundation.controller.b.d().g(), "no available campaign but to one offer show", this.a, this.g, this.r.getRequestId(), this.r.getRequestIdNotice(), 0L);
                        }
                        m.a().a("2000129", this.r, new HashMap());
                        a(this.r);
                    } else {
                        m.a().a("2000129", this.I, new HashMap());
                        a(a7);
                    }
                }
                a("data empty error");
                return;
            }
            m.a().a("2000129", this.I, new HashMap());
            c();
            a();
        } catch (Throwable th) {
            a("onCreate error" + th);
            m.a().a("2000129", this.I, new HashMap());
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        HashMap hashMap = new HashMap();
        if (TextUtils.isEmpty(this.I)) {
            hashMap.put(MBridgeConstans.PROPERTIES_UNIT_ID, this.a);
        }
        m.a().a("2000151", this.I, new HashMap());
        com.mbridge.msdk.video.module.b.b.a(this.a);
        e();
        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.J = null;
        this.K = null;
        com.mbridge.msdk.foundation.c.b.a().c(this.a + "_1");
        com.mbridge.msdk.foundation.c.b.a().c(this.a + "_2");
        com.mbridge.msdk.foundation.same.f.b.a().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();
        }
    }

    @Override
    protected void onRestart() {
        super.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.c.b.c) {
            return;
        }
        com.mbridge.msdk.foundation.controller.b.d().a((Context) this);
        try {
            com.mbridge.msdk.foundation.same.f.b.a().execute(new b(this.a, this.s));
        } catch (Throwable th) {
            aa.d("MBRewardVideoActivity", th.getMessage());
        }
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onResume();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onResume();
        }
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        bundle.putBoolean(SAVE_STATE_KEY_REPORT, this.p);
        super.onSaveInstanceState(bundle);
    }

    @Override
    protected void onStart() {
        super.onStart();
        if (com.mbridge.msdk.foundation.c.b.c) {
            return;
        }
        new com.mbridge.msdk.foundation.c.a() {
            @Override
            public final void a() {
                MBRewardVideoActivity.this.onPause();
            }

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

            @Override
            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.c.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.c.b.a().a(this.a + "_1", campaignEx);
            }
        }
        if (this.A) {
            return;
        }
        com.mbridge.msdk.foundation.c.b.a().b(this.a + "_1", 1);
        com.mbridge.msdk.foundation.c.b.a().c(this.a + "_2");
        this.A = true;
    }

    @Override
    protected void onStop() {
        MBridgeConstans.isRewardActivityShowing = false;
        super.onStop();
        MBTempContainer mBTempContainer = this.u;
        if (mBTempContainer != null) {
            mBTempContainer.onStop();
        }
        MBridgeBTContainer mBridgeBTContainer = this.v;
        if (mBridgeBTContainer != null) {
            mBridgeBTContainer.onStop();
        }
    }

    @Override
    public void setTheme(int i) {
        super.setTheme(t.a(this, "mbridge_transparent_theme", TtmlNode.TAG_STYLE));
    }

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

    private void c() {
        RewardPlus rewardPlus;
        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.K);
        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.onCreate();
        List<com.mbridge.msdk.videocommon.download.a> list = this.s;
        if (list == null || list.size() <= 0) {
            return;
        }
        try {
            com.mbridge.msdk.reward.c.a.a(this.s.get(0).k(), com.mbridge.msdk.foundation.controller.b.d().g(), "showMoreOffer", this.a, this.g, "", "", 0L);
        } catch (Exception unused) {
        }
    }

    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();
                    }
                }

                @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(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(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;
    }

    private void e() {
        try {
            List<CampaignEx> list = this.t;
            if (list != null && list.size() > 0) {
                Iterator<CampaignEx> it = this.t.iterator();
                while (it.hasNext()) {
                    b(it.next());
                }
            }
            CampaignEx campaignEx = this.r;
            if (campaignEx != null) {
                b(campaignEx);
            }
        } catch (Throwable th) {
            aa.d("MBRewardVideoActivity", th.getMessage());
        }
    }

    public void b() {
        List<CampaignEx> list;
        RewardPlus rewardPlus;
        List<CampaignEx> list2;
        try {
            m.a().a(this.r);
        } catch (Exception unused) {
        }
        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);
        }
        com.mbridge.msdk.reward.b.a.b = this.r.getCurrentLRid();
        changeHalfScreenPadding(-1);
        this.u.setActivity(this);
        this.u.setBidCampaign(this.g);
        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(-16777216);
            }
            this.u.removeAllViews();
            this.u.setCampOrderViewData(this.t, this.C);
            this.u.setCamPlayOrderCallback(this.J, this.B);
        }
        this.u.setCampaignDownLoadTask(this.q);
        this.u.setIV(this.f);
        CampaignEx campaignEx = this.r;
        if (campaignEx != null && campaignEx.getAdSpaceT() == 2) {
            this.u.setIVRewardEnable(0, 0, 0);
        } else {
            this.u.setIVRewardEnable(this.h, this.i, this.j);
        }
        this.u.setMute(this.e);
        CampaignEx campaignEx2 = this.r;
        if (((campaignEx2 != null && (rewardPlus = campaignEx2.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.onCreate();
        try {
            com.mbridge.msdk.reward.c.a.a(this.r, com.mbridge.msdk.foundation.controller.b.d().g(), "showBTOld", this.a, this.g, "", "", 0L);
        } catch (Exception unused2) {
        }
    }

    private void a() {
        try {
            ViewGroup viewGroup = (ViewGroup) getWindow().getDecorView();
            BitmapDrawable a2 = com.mbridge.msdk.foundation.controller.b.d().a(this.a, this.f ? 287 : 94);
            if (a2 != null) {
                ImageView imageView = new ImageView(com.mbridge.msdk.foundation.controller.b.d().g());
                af.a(imageView, a2, 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).getCurrentLRid();
        } 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 a2 = a(campaignEx2.getVideoCompleteTime(), this.B);
            this.r = campaignEx2;
            campaignEx2.setCampaignIsFiltered(true);
            this.B = 1;
            this.r.setVideoCompleteTime(a2);
            a(this.r);
            return;
        }
        a("campaign is less");
    }

    public void a(CampaignEx campaignEx) {
        CampaignEx k;
        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 && (k = aVar.k()) != null && TextUtils.equals(k.getId(), campaignEx.getId()) && TextUtils.equals(k.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) {
            aa.d("MBRewardVideoActivity", e.getMessage());
            a("more offer to one offer exception");
        }
    }

    public void a(String str) {
        aa.d("MBRewardVideoActivity", str);
        h hVar = this.m;
        if (hVar != null) {
            hVar.a(str);
            m.a().a("2000129", this.I, new HashMap());
        }
        finish();
    }

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

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