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

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


package com.tencent.mtt.ad.lottery;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
import com.tencent.mtt.R;
import com.tencent.mtt.ad.BrowserAdItem;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;

public final class LotteryAdView {

    private final View f31132a;

    private final View f31133b;

    private final QBWebImageView f31134c;

    private final TextView f31135d;
    private final TextView e;
    private final TextView f;
    private final View g;
    private final TextView h;
    private final View i;
    private final QBWebImageView j;
    private final View k;
    private final View l;
    private final QBWebImageView m;
    private final ArrayList<ItemHolder> n;
    private final Context o;
    private final LotteryAdPresenter p;

    public LotteryAdView(Context context, ViewGroup parent, LotteryAdPresenter presenter) {
        Intrinsics.checkParameterIsNotNull(context, "context");
        Intrinsics.checkParameterIsNotNull(parent, "parent");
        Intrinsics.checkParameterIsNotNull(presenter, "presenter");
        this.o = context;
        this.p = presenter;
        View inflate = LayoutInflater.from(this.o).inflate(R.layout.u7, parent, false);
        Intrinsics.checkExpressionValueIsNotNull(inflate, "LayoutInflater.from(cont…e_lottery, parent, false)");
        this.f31132a = inflate;
        this.f31133b = this.f31132a.findViewById(R.id.viewLotteryResultLayer);
        this.f31134c = (QBWebImageView) this.f31133b.findViewById(R.id.imageBg);
        this.f31135d = (TextView) this.f31133b.findViewById(R.id.textResultTitle);
        this.e = (TextView) this.f31133b.findViewById(R.id.textResultNote);
        this.f = (TextView) this.f31133b.findViewById(R.id.btOk);
        this.g = this.f31133b.findViewById(R.id.ivClose);
        this.h = (TextView) this.f31133b.findViewById(R.id.textOnceMore);
        this.i = this.f31132a.findViewById(R.id.viewLotteryStartLayer);
        this.j = (QBWebImageView) this.i.findViewById(R.id.imageBg);
        this.k = this.i.findViewById(R.id.textRule);
        this.l = this.i.findViewById(R.id.ivClose);
        this.m = (QBWebImageView) this.i.findViewById(R.id.ivHand);
        this.n = new ArrayList<>();
        i();
        this.f31132a.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
            @Override
            public void onViewAttachedToWindow(View view) {
                LotteryAdView.this.h();
            }

            @Override
            public void onViewDetachedFromWindow(View view) {
                LotteryAdView.this.g();
                LotteryAdView.this.a().removeOnAttachStateChangeListener(this);
            }
        });
        this.k.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                LotteryAdUtils.a("mttbrowser://url=https://static.res.qq.com/nav/file/lottery_ad_rules_20211130.html,windowType=1");
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        this.g.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                LotteryAdView.this.f().c();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        this.l.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                LotteryAdView.this.f().c();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        this.h.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                LotteryAdView.this.f().d();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        this.m.setPlaceHolderDrawable(null);
        this.m.setUseMaskForNightMode(false);
        QBWebImageView ivHand = this.m;
        Intrinsics.checkExpressionValueIsNotNull(ivHand, "ivHand");
        ivHand.setUrl("https://m4.publicimg.browser.qq.com/publicimg/nav/file/junkclean/icon_lottery_card_hand.png");
        this.j.setPlaceHolderDrawable(null);
        this.j.setUseMaskForNightMode(false);
        QBWebImageView imageBg = this.j;
        Intrinsics.checkExpressionValueIsNotNull(imageBg, "imageBg");
        imageBg.setUrl("https://m4.publicimg.browser.qq.com/publicimg/nav/file/junkclean/file_junk_done_lottery_bg.png");
        this.f31134c.setPlaceHolderDrawable(null);
        this.f31134c.setUseMaskForNightMode(false);
        QBWebImageView resultBg = this.f31134c;
        Intrinsics.checkExpressionValueIsNotNull(resultBg, "resultBg");
        resultBg.setUrl("https://m4.publicimg.browser.qq.com/publicimg/nav/file/junkclean/file_junk_lottery_result_bg.png");
    }

    private final void a(final View view, final Function0<Unit> function0) {
        QBWebImageView ivHand = this.m;
        Intrinsics.checkExpressionValueIsNotNull(ivHand, "ivHand");
        ivHand.setVisibility(8);
        view.bringToFront();
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, "scaleX", 1.0f, 1.5f);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(view, "scaleY", 1.0f, 1.5f);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setDuration(500L);
        animatorSet.playTogether(ofFloat, ofFloat2);
        ObjectAnimator startAnim = ObjectAnimator.ofFloat(view, "rotationY", 0.0f, 90.0f);
        Intrinsics.checkExpressionValueIsNotNull(startAnim, "startAnim");
        startAnim.setDuration(500L);
        startAnim.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                View resultView = LotteryAdView.this.b();
                Intrinsics.checkExpressionValueIsNotNull(resultView, "resultView");
                resultView.setVisibility(0);
                View startView = LotteryAdView.this.c();
                Intrinsics.checkExpressionValueIsNotNull(startView, "startView");
                startView.setVisibility(8);
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
            }
        });
        ObjectAnimator endAnimX = ObjectAnimator.ofFloat(this.f31133b, "scaleX", 0.35f, 1.0f);
        ObjectAnimator endAnimY = ObjectAnimator.ofFloat(this.f31133b, "scaleY", 0.35f, 1.0f);
        Intrinsics.checkExpressionValueIsNotNull(endAnimX, "endAnimX");
        endAnimX.setDuration(500L);
        Intrinsics.checkExpressionValueIsNotNull(endAnimY, "endAnimY");
        endAnimY.setDuration(500L);
        AnimatorSet animatorSet2 = new AnimatorSet();
        animatorSet2.playTogether(endAnimX, endAnimY);
        AnimatorSet animatorSet3 = new AnimatorSet();
        animatorSet3.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                view.setRotationY(0.0f);
                view.setScaleX(1.0f);
                view.setScaleY(1.0f);
                function0.invoke();
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
            }
        });
        animatorSet3.play(animatorSet).before(startAnim).before(animatorSet2);
        animatorSet3.start();
    }

    private final void b(int i) {
        QBWebImageView v = (QBWebImageView) this.i.findViewById(i);
        v.setPlaceHolderDrawable(null);
        v.setUseMaskForNightMode(false);
        Intrinsics.checkExpressionValueIsNotNull(v, "v");
        v.setUrl("https://m4.publicimg.browser.qq.com/publicimg/nav/file/junkclean/icon_lottery_card.png");
        final ItemHolder itemHolder = new ItemHolder(v, this.n.size());
        this.n.add(itemHolder);
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                LotteryAdView.this.f().a(itemHolder.b());
                EventCollector.getInstance().onViewClicked(view);
            }
        });
    }

    public final void g() {
        this.m.clearAnimation();
    }

    public final void h() {
        this.m.startAnimation(AnimationUtils.loadAnimation(this.o, R.anim.cd));
    }

    private final void i() {
        b(R.id.card1);
        b(R.id.card2);
        b(R.id.card3);
        b(R.id.card4);
        b(R.id.card5);
        b(R.id.card6);
        b(R.id.card7);
        b(R.id.card8);
        b(R.id.card9);
    }

    public final View a() {
        return this.f31132a;
    }

    public final void a(int i) {
        TextView textOnceMore = this.h;
        Intrinsics.checkExpressionValueIsNotNull(textOnceMore, "textOnceMore");
        textOnceMore.setText("再抽一次(" + i + "次)");
    }

    public final void a(final BrowserAdItem browserAdItem, int i, Function0<Unit> cb) {
        Intrinsics.checkParameterIsNotNull(cb, "cb");
        if (browserAdItem == null) {
            TextView textResultTitle = this.f31135d;
            Intrinsics.checkExpressionValueIsNotNull(textResultTitle, "textResultTitle");
            textResultTitle.setText("很遗憾未中奖");
            TextView textResultNote = this.e;
            Intrinsics.checkExpressionValueIsNotNull(textResultNote, "textResultNote");
            textResultNote.setText("谢谢参与");
            TextView btOk = this.f;
            Intrinsics.checkExpressionValueIsNotNull(btOk, "btOk");
            btOk.setText("我知道了");
            this.f.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    EventCollector.getInstance().onViewClickedBefore(view);
                    LotteryAdView.this.f().c();
                    EventCollector.getInstance().onViewClicked(view);
                }
            });
        } else {
            TextView textResultTitle2 = this.f31135d;
            Intrinsics.checkExpressionValueIsNotNull(textResultTitle2, "textResultTitle");
            textResultTitle2.setText("恭喜抽中奖品!");
            TextView textResultNote2 = this.e;
            Intrinsics.checkExpressionValueIsNotNull(textResultNote2, "textResultNote");
            textResultNote2.setText(browserAdItem.k);
            TextView btOk2 = this.f;
            Intrinsics.checkExpressionValueIsNotNull(btOk2, "btOk");
            btOk2.setText("立即领取");
            this.f.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view) {
                    EventCollector.getInstance().onViewClickedBefore(view);
                    LotteryAdView.this.f().a(browserAdItem);
                    EventCollector.getInstance().onViewClicked(view);
                }
            });
        }
        a(this.n.get(i).a(), cb);
    }

    public final View b() {
        return this.f31133b;
    }

    public final View c() {
        return this.i;
    }

    public final void d() {
        this.f31132a.setVisibility(0);
    }

    public final void e() {
        View startView = this.i;
        Intrinsics.checkExpressionValueIsNotNull(startView, "startView");
        startView.setVisibility(0);
        View resultView = this.f31133b;
        Intrinsics.checkExpressionValueIsNotNull(resultView, "resultView");
        resultView.setVisibility(8);
        for (ItemHolder itemHolder : this.n) {
        }
        QBWebImageView ivHand = this.m;
        Intrinsics.checkExpressionValueIsNotNull(ivHand, "ivHand");
        ivHand.setVisibility(0);
        this.m.bringToFront();
    }

    public final LotteryAdPresenter f() {
        return this.p;
    }
}