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

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


package com.tencent.mtt.external.novel.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.external.novel.NovelContentBasePageConst;
import com.tencent.mtt.external.novel.base.MTT.RecommendTicketGetUserInfoRsp;
import com.tencent.mtt.external.novel.base.engine.NovelCallBackData;
import com.tencent.mtt.external.novel.base.engine.NovelDataListener;
import com.tencent.mtt.external.novel.base.model.NovelInfo;
import com.tencent.mtt.external.novel.base.tools.NovelContext;
import com.tencent.mtt.external.novel.base.ui.NovelBaseContainer;
import com.tencent.mtt.external.novel.base.ui.NovelLoadingView;
import com.tencent.mtt.external.novel.engine.NovelDataManager;
import com.tencent.mtt.external.novel.engine.NovelRecommendDataManager;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.newskin.skinInterface.ISkinInterface;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.dialog.bottomsheet.QBBottomSheet;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import qb.a.e;
import qb.a.f;

public class NovelRecomendTicketDialog extends QBBottomSheet implements View.OnClickListener, NovelDataListener {

    public static final int f55981a = MttResources.g(f.aE);

    private NovelLoadingView f55982b;

    private QBTextView f55983c;

    private QBTextView f55984d;
    private QBTextView e;
    private LinearLayout f;
    private TicketBox m;
    private TicketBox n;
    private TicketBox o;
    private NovelContext p;
    private NovelBaseContainer q;
    private NovelInfo r;
    private String[] s;

    public class TicketBox extends LinearLayout implements ISkinInterface {

        Paint f55985a;

        RectF f55986b;

        int f55987c;

        int f55988d;
        int e;
        private QBTextView g;

        public TicketBox(Context context, NovelContext novelContext, int i, String str, View.OnClickListener onClickListener) {
            super(context);
            this.f55985a = new Paint();
            this.f55986b = new RectF();
            this.f55987c = MttResources.c(R.color.novel_common_nd1);
            this.f55988d = MttResources.g(f.f85879c);
            this.e = MttResources.c(R.color.novel_common_d4);
            this.g = null;
            SimpleSkinBuilder.a(this).f();
            setBackgroundColor(0);
            setId(i);
            setOnClickListener(onClickListener);
            a(novelContext, str);
        }

        private void a(NovelContext novelContext, String str) {
            this.g = new QBTextView(getContext());
            this.g.setGravity(17);
            this.g.setTextSize(MttResources.g(f.q));
            this.g.setTextColorNormalIds(novelContext.t().f54422a);
            this.g.setUseMaskForNightMode(true);
            this.g.setText(str);
            addView(this.g, new LinearLayout.LayoutParams(-1, -1));
        }

        public String a() {
            return this.g.getText().toString();
        }

        public void a(String str) {
            this.g.setText(str);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            this.f55986b.set(1.0f, 1.0f, getWidth() - 1, getHeight() - 1);
            this.f55985a.setAntiAlias(true);
            this.f55985a.setColor(this.e);
            this.f55985a.setStyle(Paint.Style.FILL);
            this.f55985a.setAlpha(255);
            RectF rectF = this.f55986b;
            int i = this.f55988d;
            canvas.drawRoundRect(rectF, i, i, this.f55985a);
            this.f55986b.set(1.0f, 1.0f, getWidth() - 1, getHeight() - 1);
            this.f55985a.setAntiAlias(true);
            this.f55985a.setColor(this.f55987c);
            this.f55985a.setStyle(Paint.Style.STROKE);
            this.f55985a.setStrokeWidth(2.0f);
            this.f55985a.setAlpha(128);
            RectF rectF2 = this.f55986b;
            int i2 = this.f55988d;
            canvas.drawRoundRect(rectF2, i2, i2, this.f55985a);
        }

        @Override
        public void onSkinChange() {
            this.f55987c = MttResources.c(R.color.novel_common_nd1);
            this.e = MttResources.c(R.color.novel_common_d4);
            invalidate();
        }
    }

    public NovelRecomendTicketDialog(Context context, NovelContext novelContext, NovelBaseContainer novelBaseContainer, NovelInfo novelInfo) {
        super(context);
        this.f55982b = null;
        this.f55983c = null;
        this.f55984d = null;
        this.e = null;
        this.f = null;
        this.m = null;
        this.n = null;
        this.o = null;
        this.p = null;
        this.q = null;
        this.r = null;
        this.s = new String[]{"1票", "2票", "全部"};
        this.p = novelContext;
        this.q = novelBaseContainer;
        this.r = novelInfo;
        NovelDataManager.q().a(this);
        a(context, novelContext);
        a(true, true);
    }

    private void a(int i) {
        int c2 = MttResources.c(R.color.novel_common_a3);
        int c3 = MttResources.c(this.p.t().f54422a);
        String valueOf = String.valueOf(i);
        SpannableString spannableString = new SpannableString("你有" + valueOf + "张推荐票");
        spannableString.setSpan(new ForegroundColorSpan(c2), 0, 2, 33);
        spannableString.setSpan(new ForegroundColorSpan(c3), 2, valueOf.length() + 2, 33);
        spannableString.setSpan(new ForegroundColorSpan(c2), 2 + valueOf.length(), spannableString.length(), 33);
        this.e.setText(spannableString);
    }

    private void a(Context context, NovelContext novelContext) {
        FrameLayout frameLayout = new FrameLayout(getContext());
        SimpleSkinBuilder.a(frameLayout).a(e.s).c().f();
        frameLayout.setLayoutParams(new ViewGroup.LayoutParams(-1, MttResources.u(34)));
        a(frameLayout);
        this.f = new LinearLayout(context);
        this.f.setOrientation(1);
        this.f.setLayoutParams(new ViewGroup.LayoutParams(-1, MttResources.u(34)));
        frameLayout.addView(this.f);
        this.f55984d = new QBTextView(this.mContext);
        this.f55984d.setClickable(true);
        this.f55984d.setTextSize(MttResources.g(f.cB));
        SpannableString spannableString = new SpannableString("你暂无推荐票,了解如何获得推荐票");
        spannableString.setSpan(new ForegroundColorSpan(MttResources.c(R.color.novel_common_a3)), 0, 9, 33);
        spannableString.setSpan(new ForegroundColorSpan(MttResources.c(novelContext.t().f54422a)), 9, spannableString.length(), 33);
        this.f55984d.setText(spannableString);
        this.f55984d.setGravity(17);
        this.f55984d.setEllipsize(TextUtils.TruncateAt.END);
        this.f55984d.setVisibility(8);
        this.f55984d.setLayoutParams(new ViewGroup.LayoutParams(-1, MttResources.u(34)));
        this.f55984d.setOnClickListener(this);
        frameLayout.addView(this.f55984d);
        this.f55982b = new NovelLoadingView(this.mContext, novelContext);
        this.f55982b.a(0, "正在拉取推荐票", -1, -1, -1, false);
        this.f55982b.setVisibility(8);
        this.f55982b.setLayoutParams(new ViewGroup.LayoutParams(-1, MttResources.u(34)));
        frameLayout.addView(this.f55982b);
        this.f55983c = new QBTextView(this.mContext);
        this.f55983c.setVisibility(8);
        this.f55983c.setClickable(true);
        this.f55983c.setTextSize(MttResources.g(f.cB));
        this.f55983c.setTextColorNormalIds(R.color.novel_common_a3);
        this.f55983c.setTextColorNormalIds(novelContext.t().f54422a);
        this.f55983c.setGravity(17);
        this.f55983c.setText("拉取推荐票失败,请退出重试");
        this.f55983c.setEllipsize(TextUtils.TruncateAt.END);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, MttResources.u(34));
        int u = MttResources.u(4);
        layoutParams.bottomMargin = u;
        layoutParams.topMargin = u;
        frameLayout.addView(this.f55983c, layoutParams);
        this.e = new QBTextView(this.mContext);
        this.e.setClickable(true);
        this.e.setTextSize(MttResources.g(f.cB));
        this.e.setTextColorNormalIds(R.color.novel_common_a3);
        this.e.setTextColorNormalIds(novelContext.t().f54422a);
        this.e.setGravity(17);
        this.e.setEllipsize(TextUtils.TruncateAt.END);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, MttResources.u(4));
        int u2 = MttResources.u(4);
        layoutParams2.bottomMargin = u2;
        layoutParams2.topMargin = u2;
        this.f.addView(this.e, layoutParams2);
        LinearLayout linearLayout = new LinearLayout(context);
        linearLayout.setOrientation(0);
        SimpleSkinBuilder.a(linearLayout).a(R.color.novel_common_d4).c().f();
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, MttResources.u(17));
        layoutParams3.weight = 1.0f;
        layoutParams3.bottomMargin = MttResources.u(5);
        this.f.addView(linearLayout, layoutParams3);
        int[] iArr = {NovelContentBasePageConst.e, NovelContentBasePageConst.e, NovelContentBasePageConst.e};
        this.m = new TicketBox(getContext(), novelContext, iArr[0], this.s[0], this);
        this.n = new TicketBox(getContext(), novelContext, iArr[1], this.s[1], this);
        this.o = new TicketBox(getContext(), novelContext, iArr[2], this.s[2], this);
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(f55981a, -1);
        layoutParams4.leftMargin = MttResources.u(6);
        linearLayout.addView(this.m, layoutParams4);
        QBTextView qBTextView = new QBTextView(this.mContext);
        qBTextView.setClickable(true);
        LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(-1, -1);
        layoutParams5.weight = 1.0f;
        linearLayout.addView(qBTextView, layoutParams5);
        linearLayout.addView(this.n, new LinearLayout.LayoutParams(f55981a, -1));
        QBTextView qBTextView2 = new QBTextView(this.mContext);
        qBTextView2.setClickable(true);
        LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-1, -1);
        layoutParams6.weight = 1.0f;
        linearLayout.addView(qBTextView2, layoutParams6);
        LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(f55981a, -1);
        layoutParams7.rightMargin = MttResources.u(6);
        linearLayout.addView(this.o, layoutParams7);
    }

    private void a(boolean z, boolean z2) {
        NovelRecommendDataManager t = NovelDataManager.q().t();
        RecommendTicketGetUserInfoRsp a2 = t.a(z, z2);
        if (a2 != null) {
            this.f55982b.setVisibility(8);
            this.f55983c.setVisibility(8);
            if (a2.iTicketNum > 0) {
                if (a2.iTicketNum == 1) {
                    this.f55984d.setVisibility(8);
                    this.m.setVisibility(8);
                    this.n.setVisibility(0);
                    this.n.a(this.s[0]);
                    this.n.setTag(1);
                    this.o.setVisibility(8);
                    this.f.setVisibility(0);
                    a(1);
                    return;
                }
                this.f55984d.setVisibility(8);
                this.m.setVisibility(0);
                this.n.setVisibility(0);
                this.o.setVisibility(0);
                this.f.setVisibility(0);
                this.m.a(this.s[0]);
                this.m.setTag(1);
                this.n.a(this.s[1]);
                this.n.setTag(2);
                this.o.a(this.s[2]);
                this.o.setTag(Integer.valueOf(a2.iTicketNum));
                a(a2.iTicketNum);
                return;
            }
            this.f55984d.setVisibility(0);
        } else {
            if (a2 != null || !t.a()) {
                NovelLoadingView novelLoadingView = this.f55982b;
                if (!z2) {
                    novelLoadingView.setVisibility(8);
                    this.f.setVisibility(8);
                    this.f55983c.setVisibility(0);
                    return;
                } else {
                    novelLoadingView.setVisibility(0);
                    this.f.setVisibility(8);
                    t.b();
                    t.a(false, true);
                    return;
                }
            }
            this.f55982b.setVisibility(0);
            this.f55984d.setVisibility(8);
        }
        this.f.setVisibility(8);
    }

    @Override
    public void a(NovelCallBackData novelCallBackData) {
        if (novelCallBackData.f54280b == 62) {
            a(false, false);
        }
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        NovelDataManager.q().a(this);
    }

    @Override
    public void onClick(View view) {
        StatManager b2;
        String str;
        EventCollector.getInstance().onViewClickedBefore(view);
        if (view != this.f55984d) {
            if (view == this.m || view == this.n || view == this.o) {
                NovelDataManager.q().t().a(this.r.f36399b, ((Integer) view.getTag()).intValue());
                TicketBox ticketBox = (TicketBox) view;
                if (TextUtils.equals(ticketBox.a(), this.s[0])) {
                    b2 = StatManager.b();
                    str = "AKH109";
                } else if (TextUtils.equals(ticketBox.a(), this.s[1])) {
                    b2 = StatManager.b();
                    str = "AKH110";
                } else if (TextUtils.equals(ticketBox.a(), this.s[2])) {
                    b2 = StatManager.b();
                    str = "AKH111";
                }
                b2.c(str);
            }
            EventCollector.getInstance().onViewClicked(view);
        }
        StatManager.b().c("AKH112");
        Bundle bundle = new Bundle();
        String a2 = this.p.f.a(13);
        if (TextUtils.isEmpty(a2)) {
            a2 = "https://bookshelf.html5.qq.com/question.html?type=3";
        }
        bundle.putString("book_content_ad_link", a2);
        this.q.a(32, bundle, true);
        dismiss();
        EventCollector.getInstance().onViewClicked(view);
    }

    @Override
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        NovelDataManager.q().b(this);
    }
}