QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

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


package com.tencent.mtt.ad.lottery;

import android.animation.Animator;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.view.animation.ScaleAnimation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.tencent.common.task.QBTask;
import com.tencent.common.utils.StringUtils;
import com.tencent.luggage.wxa.cy.e;
import com.tencent.mtt.R;
import com.tencent.mtt.ad.BrowserAdItem;
import com.tencent.mtt.ad.tools.BrowserAdPreferenceConsts;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.wup.PreferenceData;
import com.tencent.mtt.common.operation.BrowserRewardAdController;
import com.tencent.mtt.file.pagecommon.views.AdvSyncImageView;
import com.tencent.mtt.lottie.LottieAnimationView;
import com.tencent.mtt.res.LottieResHelper;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.common.QBView;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.Callable;
import qb.a.g;

public class BrowserLotteryAdView extends QBFrameLayout implements View.OnClickListener {
    private static final int[] x = {80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 120, 160, 200, e.CTRL_INDEX, 280, 320};
    private int A;
    private boolean B;
    private boolean C;
    private BrowserRewardAdController D;

    LottieAnimationView f31106a;

    LottieAnimationView f31107b;

    LottieAnimationView f31108c;

    AdvSyncImageView f31109d;
    AdvSyncImageView e;
    QBLinearLayout f;
    QBTextView g;
    QBTextView h;
    QBTextView i;
    QBImageView j;
    QBView k;
    QBTextView l;
    QBFrameLayout m;
    LotteryResultView n;
    List<LotteryBaseItemView> o;
    Set<String> p;
    BrowserAdItem q;
    ILotteryAdListener r;
    Handler s;
    int t;
    int u;
    int v;
    boolean w;
    private int y;
    private int z;

    public BrowserLotteryAdView(Context context, ILotteryAdListener iLotteryAdListener) {
        super(context);
        this.o = new ArrayList();
        this.p = new HashSet();
        this.y = 3;
        this.z = 1;
        this.A = 1;
        this.B = false;
        this.C = false;
        this.t = 0;
        this.r = iLotteryAdListener;
        this.w = LottieResHelper.a().b("lottery_Lottie_anim");
        String a2 = PreferenceData.a("KEY_CLEAN_DONE_LOTTERY_CHANGE_NUM");
        if (!TextUtils.isEmpty(a2)) {
            this.z = StringUtils.b(a2, 1);
            this.C = true;
        }
        String a3 = PreferenceData.a("KEY_CLEAN_DONE_LOTTERY_RETRY_NUM");
        if (!TextUtils.isEmpty(a3)) {
            this.y = StringUtils.b(a3, 3);
            this.B = true;
        }
        d();
        a(context);
        m();
    }

    private void a(int i) {
        QBTextView qBTextView;
        int i2;
        if (i > 0) {
            this.g.setText("换一换(" + i + "次)");
            qBTextView = this.i;
            if (qBTextView != null) {
                i2 = 255;
                qBTextView.setTextAlpha(i2);
            }
        } else if (this.C) {
            this.g.setText("换一换");
        } else {
            this.g.setText("换一换(0次)");
            qBTextView = this.g;
            i2 = 128;
            qBTextView.setTextAlpha(i2);
        }
        k();
    }

    public void a(long j) {
        if (this.q != null) {
            this.s.removeMessages(2);
            Message message = new Message();
            message.obj = this.q;
            message.what = 2;
            this.s.sendMessageDelayed(message, j);
        }
    }

    private void a(Context context) {
        View view;
        View view2;
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, MttResources.s(500));
        layoutParams.gravity = 48;
        if (this.w) {
            this.f31106a = new LottieAnimationView(context);
            this.f31106a.loop(false);
            this.f31106a.setVisibility(8);
            addView(this.f31106a, layoutParams);
            this.f31107b = new LottieAnimationView(context);
            this.f31107b.loop(true);
            this.f31107b.setVisibility(8);
            view = this.f31107b;
        } else {
            this.f31109d = new AdvSyncImageView(context);
            this.f31109d.setPlaceHolderColorId(qb.a.e.U);
            this.f31109d.setUseMaskForNightMode(false);
            this.f31109d.setUrl("https://static.res.qq.com/nav/file/lottery_process_bg.png");
            this.f31109d.setVisibility(8);
            view = this.f31109d;
        }
        addView(view, layoutParams);
        this.m = new QBFrameLayout(context);
        this.m.setBackgroundNormalIds(0, qb.a.e.U);
        this.m.setId(1);
        this.m.setOnClickListener(this);
        this.m.setVisibility(8);
        int s = MttResources.s(254);
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(s, s);
        layoutParams2.gravity = 49;
        layoutParams2.topMargin = MttResources.s(140);
        addView(this.m, layoutParams2);
        if (this.w) {
            this.f31108c = new LottieAnimationView(context);
            this.f31108c.loop(false);
            this.f31108c.setVisibility(8);
            view2 = this.f31108c;
        } else {
            this.e = new AdvSyncImageView(context);
            this.e.setPlaceHolderColorId(qb.a.e.U);
            this.e.setUseMaskForNightMode(false);
            this.e.setUrl("https://static.res.qq.com/nav/file/lottery_result_img.png");
            this.e.setVisibility(8);
            view2 = this.e;
        }
        addView(view2, layoutParams);
        this.j = new QBImageView(context);
        this.j.setUseMaskForNightMode(true);
        this.j.setImageNormalIds(g.aV);
        this.j.setVisibility(8);
        this.j.setId(4);
        this.j.setOnClickListener(this);
        this.j.setScaleType(ImageView.ScaleType.FIT_XY);
        this.j.setUseMaskForNightMode(false);
        int s2 = MttResources.s(25);
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(s2, s2);
        layoutParams3.gravity = 53;
        layoutParams3.topMargin = MttResources.s(31);
        layoutParams3.rightMargin = MttResources.s(36);
        addView(this.j, layoutParams3);
        this.l = new QBTextView(context);
        this.l.setTextSize(MttResources.s(12));
        this.l.setTextColorNormalIds(R.color.tv);
        this.l.setText("继续深度清理可获得更多抽奖机会");
        this.l.setVisibility(8);
        FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams4.gravity = 81;
        addView(this.l, layoutParams4);
        this.f = new QBLinearLayout(context);
        this.f.setVisibility(8);
        FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-1, -2);
        layoutParams5.gravity = 81;
        layoutParams5.bottomMargin = MttResources.s(26);
        addView(this.f, layoutParams5);
        QBView qBView = new QBView(context);
        LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-1, -1);
        layoutParams6.weight = 1.0f;
        this.f.addView(qBView, layoutParams6);
        boolean a2 = BrowserAdPreferenceConsts.a("KEY_CLEAN_DONE_LOTTERY_LUCKYBUTTON", 2, 0);
        this.h = new QBTextView(context);
        this.h.setTextSize(MttResources.s(16));
        this.h.setTextColorNormalIds(R.color.tv);
        this.h.setGravity(17);
        this.h.setText("试试手气");
        this.h.setId(1);
        QBTextView qBTextView = this.h;
        if (a2) {
            qBTextView.setVisibility(0);
        } else {
            qBTextView.setVisibility(8);
        }
        this.h.setOnClickListener(this);
        this.h.setBackgroundNormalIds(R.drawable.n2, 0);
        this.h.setIncludeFontPadding(false);
        this.h.setUseMaskForNightMode(false);
        LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(MttResources.s(120), MttResources.s(42));
        layoutParams7.rightMargin = MttResources.s(24);
        this.f.addView(this.h, layoutParams7);
        this.g = new QBTextView(context);
        this.g.setTextSize(MttResources.s(16));
        this.g.setTextColorNormalIds(R.color.tv);
        if (a2) {
            this.g.setGravity(17);
        } else {
            this.g.setPadding(MttResources.s(36), MttResources.s(10), MttResources.s(36), MttResources.s(10));
        }
        this.g.setText("换一换(" + this.z + "次)");
        this.g.setId(2);
        this.g.setOnClickListener(this);
        this.g.setIncludeFontPadding(false);
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setColor(MttResources.c(qb.a.e.U));
        gradientDrawable.setCornerRadius(MttResources.s(25));
        gradientDrawable.setStroke(MttResources.s(1), MttResources.c(R.color.tv));
        this.g.setBackgroundDrawable(gradientDrawable);
        this.f.addView(this.g, a2 ? new LinearLayout.LayoutParams(MttResources.s(120), MttResources.s(42)) : new LinearLayout.LayoutParams(-2, -2));
        QBView qBView2 = new QBView(context);
        LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(-1, -1);
        layoutParams8.weight = 1.0f;
        this.f.addView(qBView2, layoutParams8);
        this.i = new QBTextView(context);
        this.i.setTextSize(MttResources.s(16));
        this.i.setTextColorNormalIds(R.color.tv);
        this.i.setPadding(MttResources.s(27), MttResources.s(10), MttResources.s(27), MttResources.s(10));
        this.i.setText("再抽一次(" + this.y + "次)");
        this.i.setId(3);
        this.i.setOnClickListener(this);
        this.i.setBackgroundNormalIds(R.drawable.n2, 0);
        this.i.setIncludeFontPadding(false);
        this.i.setUseMaskForNightMode(false);
        this.i.setVisibility(8);
        FrameLayout.LayoutParams layoutParams9 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams9.gravity = 81;
        layoutParams9.bottomMargin = MttResources.s(26);
        addView(this.i, layoutParams9);
        this.k = new QBView(context);
        this.k.setId(5);
        this.k.setBackgroundNormalIds(0, qb.a.e.U);
        this.k.setOnClickListener(this);
        FrameLayout.LayoutParams layoutParams10 = new FrameLayout.LayoutParams(MttResources.s(70), MttResources.s(38));
        layoutParams10.gravity = 81;
        layoutParams10.bottomMargin = MttResources.s(100);
        addView(this.k, layoutParams10);
        this.n = new LotteryResultView(context);
        this.n.setId(6);
        this.n.setOnClickListener(this);
        this.n.setVisibility(8);
        int s3 = MttResources.s(247);
        FrameLayout.LayoutParams layoutParams11 = new FrameLayout.LayoutParams(s3, s3);
        layoutParams11.gravity = 49;
        layoutParams11.topMargin = MttResources.s(143);
        addView(this.n, layoutParams11);
    }

    private void a(BrowserAdItem browserAdItem) {
        this.p.add(browserAdItem != null ? browserAdItem.f31028a : "thanks");
        this.q = browserAdItem;
        if (this.w) {
            this.f31108c.setVisibility(0);
            this.f31108c.removeAllAnimatorListener();
            this.f31108c.addAnimatorListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationCancel(Animator animator) {
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    BrowserLotteryAdView.this.a(500L);
                }

                @Override
                public void onAnimationRepeat(Animator animator) {
                }

                @Override
                public void onAnimationStart(Animator animator) {
                    BrowserLotteryAdView.this.f31107b.pauseAnimation();
                    BrowserLotteryAdView.this.f31107b.setVisibility(8);
                }
            });
            a(this.f31108c, "lottery_result.json");
        } else {
            this.f31109d.setVisibility(8);
            this.e.setVisibility(0);
            this.e.setAlpha(0.0f);
            this.e.setScaleX(0.8f);
            this.e.setScaleY(0.8f);
            this.e.animate().alpha(1.0f).scaleX(1.0f).scaleY(1.0f).setDuration(200L).start();
            a(800L);
        }
        this.f.setVisibility(8);
        QBTextView qBTextView = this.i;
        if (qBTextView != null) {
            qBTextView.setVisibility(0);
            if (BrowserAdPreferenceConsts.a("KEY_CLEAN_DONE_LOTTERY_RETRY_ANIMA", 2, 0) && this.y > 0) {
                ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 1.1f, 1.0f, 1.1f, 1, 0.5f, 1, 0.5f);
                scaleAnimation.setDuration(300L);
                scaleAnimation.setRepeatCount(-1);
                scaleAnimation.setRepeatMode(2);
                this.i.startAnimation(scaleAnimation);
            }
        }
        this.A = 2;
        this.n.a(this.q);
        this.n.setVisibility(0);
        this.n.setAlpha(0.0f);
        this.n.animate().alpha(1.0f).setDuration(700L).start();
        ILotteryAdListener iLotteryAdListener = this.r;
        if (iLotteryAdListener != null) {
            iLotteryAdListener.e(this.q);
        }
        k();
    }

    private void a(LottieAnimationView lottieAnimationView, String str) {
        LottieResHelper.a().a(lottieAnimationView, "lottery_Lottie_anim", str, "images");
    }

    private void b(int i) {
        QBTextView qBTextView;
        int i2;
        QBTextView qBTextView2 = this.i;
        if (qBTextView2 == null) {
            return;
        }
        if (i > 0) {
            qBTextView2.setText("再抽一次(" + i + "次)");
            qBTextView = this.i;
            i2 = 255;
        } else if (this.B) {
            qBTextView2.setText("再抽一次");
            return;
        } else {
            qBTextView2.setText("再抽一次(0次)");
            qBTextView = this.i;
            i2 = 128;
        }
        qBTextView.setTextAlpha(i2);
    }

    static int c(BrowserLotteryAdView browserLotteryAdView) {
        int i = browserLotteryAdView.z;
        browserLotteryAdView.z = i + 1;
        return i;
    }

    private void d() {
        this.D = new BrowserRewardAdController(133, 100448, false);
        this.D.a("观看%d秒即可获得1次抽奖机会", "已观看视频%d秒,可获得抽奖机会");
        this.D.a("广告还未播完,此时跳过不能获得抽奖机会。", "不看了", "继续看完");
        this.D.a(new BrowserRewardAdController.IBrowserRewardAdCallBack() {
            @Override
            public void a() {
                if (BrowserLotteryAdView.this.r != null) {
                    BrowserLotteryAdView.this.r.d();
                }
                QBTask.b((Callable) new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                        BrowserLotteryAdView.this.e();
                        return null;
                    }
                });
                PlatformStatUtils.a("AD_LOTTERY_REWARD_SHOW");
            }

            @Override
            public void a(int i, String str) {
                PlatformStatUtils.a("AD_LOTTERY_REWARD_ERROR");
                QBTask.b((Callable) new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                        BrowserLotteryAdView.this.e();
                        MttToaster.show("广告拉取失败,请稍后重试", 0);
                        return null;
                    }
                });
            }

            @Override
            public void a(boolean z) {
                if (z) {
                    PlatformStatUtils.a("AD_LOTTERY_REWARD_GET");
                    BrowserLotteryAdView.this.f();
                }
            }

            @Override
            public void b() {
            }
        });
    }

    static int e(BrowserLotteryAdView browserLotteryAdView) {
        int i = browserLotteryAdView.y;
        browserLotteryAdView.y = i + 1;
        return i;
    }

    public void e() {
        QBTextView qBTextView = this.i;
        if (qBTextView != null) {
            qBTextView.setClickable(true);
        }
        QBTextView qBTextView2 = this.g;
        if (qBTextView2 != null) {
            qBTextView2.setClickable(true);
        }
    }

    public void f() {
        ILotteryAdListener iLotteryAdListener = this.r;
        if (iLotteryAdListener != null) {
            iLotteryAdListener.e();
        }
        QBTask.b((Callable) (this.A == 1 ? new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                if (BrowserLotteryAdView.this.r != null) {
                    BrowserLotteryAdView.this.r.f();
                }
                BrowserLotteryAdView.c(BrowserLotteryAdView.this);
                BrowserLotteryAdView.this.l();
                MttToaster.show("奖品已更换", 0);
                return null;
            }
        } : new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                if (BrowserLotteryAdView.this.r != null) {
                    BrowserLotteryAdView.this.r.g();
                }
                BrowserLotteryAdView.e(BrowserLotteryAdView.this);
                BrowserLotteryAdView.this.j();
                return null;
            }
        }));
    }

    public void g() {
        this.f31107b.setVisibility(0);
        this.f31107b.addAnimatorListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
                BrowserLotteryAdView.this.f31106a.setVisibility(8);
                BrowserLotteryAdView.this.f31106a.removeAllAnimatorListener();
                BrowserLotteryAdView.this.f31106a.cancelAnimation();
            }
        });
        a(this.f31107b, "lottery_process.json");
    }

    private void h() {
        LottieAnimationView lottieAnimationView = this.f31107b;
        if (lottieAnimationView != null) {
            lottieAnimationView.pauseAnimation();
        }
        this.m.setClickable(false);
        this.f.setClickable(false);
        this.h.setClickable(false);
        this.g.setClickable(false);
        this.t++;
        int a2 = LotteryAdUtils.a(this.o, this.p, this.t);
        this.o.get(a2).getData();
        int length = (a2 - x.length) % 8;
        if (length < 0) {
            length += 8;
        }
        this.u = length;
        this.v = 0;
        LotteryBaseItemView lotteryBaseItemView = this.o.get(this.u);
        if (lotteryBaseItemView != null) {
            lotteryBaseItemView.a();
        }
        Handler handler = this.s;
        int[] iArr = x;
        this.v = this.v + 1;
        handler.sendEmptyMessageDelayed(1, iArr[r3]);
    }

    private void i() {
        this.D.b();
        PlatformStatUtils.a("AD_LOTTERY_REWARD_REQUEST");
    }

    public void j() {
        ILotteryAdListener iLotteryAdListener = this.r;
        if (iLotteryAdListener != null) {
            iLotteryAdListener.d(this.y);
        }
        int i = this.y;
        if (i <= 0) {
            if (this.B) {
                QBTextView qBTextView = this.i;
                if (qBTextView != null) {
                    qBTextView.setClickable(false);
                }
                i();
                return;
            }
            return;
        }
        this.y = i - 1;
        b(this.y);
        this.s.removeMessages(2);
        this.f.setVisibility(0);
        this.A = 1;
        QBTextView qBTextView2 = this.i;
        if (qBTextView2 != null) {
            qBTextView2.setVisibility(8);
        }
        this.n.setVisibility(8);
        if (this.w) {
            this.f31107b.setVisibility(0);
            this.f31108c.removeAllAnimatorListener();
            this.f31108c.setVisibility(8);
        } else {
            this.f31109d.setVisibility(0);
            this.e.setVisibility(8);
        }
        h();
        k();
    }

    private void k() {
        this.l.setVisibility(0);
        if (this.A == 1) {
            if (!this.C) {
            }
        } else if (!this.B) {
        }
    }

    public void l() {
        ILotteryAdListener iLotteryAdListener = this.r;
        if (iLotteryAdListener != null) {
            iLotteryAdListener.c(this.z);
            int i = this.z;
            if (i > 0) {
                this.z = i - 1;
                a(this.z);
            } else if (this.C) {
                QBTextView qBTextView = this.g;
                if (qBTextView != null) {
                    qBTextView.setClickable(false);
                }
                i();
            }
        }
    }

    private void m() {
        if (this.s != null) {
            return;
        }
        this.s = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                BrowserAdItem browserAdItem;
                if (message.what == 1) {
                    BrowserLotteryAdView.this.n();
                } else {
                    if (message.what != 2 || (browserAdItem = (BrowserAdItem) message.obj) == null || BrowserLotteryAdView.this.r == null) {
                        return;
                    }
                    LotteryAdUtils.a(browserAdItem.e);
                    BrowserLotteryAdView.this.r.f(browserAdItem);
                }
            }
        };
    }

    public void n() {
        LotteryBaseItemView lotteryBaseItemView = this.o.get(this.u);
        if (lotteryBaseItemView != null) {
            lotteryBaseItemView.b();
        }
        int i = this.u + 1;
        this.u = i;
        this.u = i % 8;
        LotteryBaseItemView lotteryBaseItemView2 = this.o.get(this.u);
        if (lotteryBaseItemView2 != null) {
            lotteryBaseItemView2.a();
        }
        int length = x.length;
        int i2 = this.v;
        if (i2 >= length) {
            a(lotteryBaseItemView2.getData());
            return;
        }
        Handler handler = this.s;
        this.v = i2 + 1;
        handler.sendEmptyMessageDelayed(1, r2[i2]);
    }

    private void o() {
        this.s.removeMessages(2);
        LotteryAdUtils.a("mttbrowser://url=https://static.res.qq.com/nav/file/lottery_ad_rules_0706.html,windowType=1");
    }

    public void a() {
        if (this.w) {
            this.f31106a.setVisibility(0);
            this.f31106a.addAnimatorListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationCancel(Animator animator) {
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    BrowserLotteryAdView.this.s.post(new Runnable() {
                        @Override
                        public void run() {
                            BrowserLotteryAdView.this.g();
                        }
                    });
                }

                @Override
                public void onAnimationRepeat(Animator animator) {
                }

                @Override
                public void onAnimationStart(Animator animator) {
                }
            });
            a(this.f31106a, "lottery_appear.json");
        } else {
            this.f31109d.setVisibility(0);
            this.f31109d.setAlpha(0.0f);
            this.f31109d.setScaleX(0.6f);
            this.f31109d.setScaleY(0.6f);
            this.f31109d.animate().alpha(1.0f).scaleX(1.0f).scaleY(1.0f).setDuration(500L).start();
        }
        this.s.postDelayed(new Runnable() {
            @Override
            public void run() {
                BrowserLotteryAdView.this.b();
            }
        }, 300L);
    }

    public void a(List<BrowserAdItem> list) {
        if (list == null || list.size() != 7) {
            return;
        }
        int i = 0;
        if (this.o.size() == 8) {
            for (LotteryBaseItemView lotteryBaseItemView : this.o) {
                if (lotteryBaseItemView instanceof LotteryAdItemView) {
                    lotteryBaseItemView.a(list.get(i));
                    i++;
                } else {
                    lotteryBaseItemView.a(null);
                }
            }
            return;
        }
        int nextInt = new Random().nextInt(8);
        for (int i2 = 0; i2 < 7; i2++) {
            LotteryAdItemView lotteryAdItemView = new LotteryAdItemView(getContext());
            lotteryAdItemView.a(list.get(i2));
            this.o.add(lotteryAdItemView);
        }
        this.o.add(nextInt, new LotteryThanksItem(getContext()));
        if (this.m == null || this.o.size() != 8) {
            return;
        }
        while (i < 8) {
            this.m.addView(this.o.get(i), LotteryAdUtils.a(i));
            i++;
        }
    }

    public void b() {
        this.j.setVisibility(0);
        this.f.setVisibility(0);
        k();
        this.m.setVisibility(0);
        this.m.setAlpha(0.0f);
        this.m.animate().alpha(1.0f).setDuration(300L).start();
    }

    public void c() {
        if (!this.w) {
            LottieResHelper.a().a("lottery_Lottie_anim");
        }
        LottieAnimationView lottieAnimationView = this.f31106a;
        if (lottieAnimationView != null) {
            lottieAnimationView.cancelAnimation();
        }
        LottieAnimationView lottieAnimationView2 = this.f31107b;
        if (lottieAnimationView2 != null) {
            lottieAnimationView2.cancelAnimation();
        }
        LottieAnimationView lottieAnimationView3 = this.f31108c;
        if (lottieAnimationView3 != null) {
            lottieAnimationView3.cancelAnimation();
        }
        QBTextView qBTextView = this.i;
        if (qBTextView != null) {
            qBTextView.clearAnimation();
        }
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        switch (view.getId()) {
            case 1:
                h();
                ILotteryAdListener iLotteryAdListener = this.r;
                if (iLotteryAdListener != null) {
                    iLotteryAdListener.c();
                    break;
                }
                break;
            case 2:
                l();
                break;
            case 3:
                QBTextView qBTextView = this.i;
                if (qBTextView != null) {
                    qBTextView.clearAnimation();
                }
                j();
                break;
            case 4:
                ILotteryAdListener iLotteryAdListener2 = this.r;
                if (iLotteryAdListener2 != null) {
                    iLotteryAdListener2.b();
                    break;
                }
                break;
            case 5:
                o();
                break;
            case 6:
                a(0L);
                break;
        }
        EventCollector.getInstance().onViewClicked(view);
    }
}