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

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


package com.tencent.mtt.ui.items;

import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.base.MTT.MCDetailMsg;
import com.tencent.mtt.base.MTT.MCMessage;
import com.tencent.mtt.base.MTT.MCMessageUI1;
import com.tencent.mtt.base.MTT.MCTextComponent;
import com.tencent.mtt.base.MTT.MCUserInfo;
import com.tencent.mtt.base.account.AccountInfo;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.ui.base.BubbleBgRelativeLayout;
import com.tencent.mtt.ui.base.ILetterItem;
import com.tencent.mtt.ui.base.NoLineClickableSpan;
import com.tencent.mtt.ui.base.RoundImageView;
import com.tencent.mtt.ui.base.UserMessageConstant;
import com.tencent.mtt.ui.util.MessageCenterUtil;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.layout.QBRelativeLayout;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;
import java.util.Iterator;
import qb.a.e;
import qb.a.f;
import qb.a.g;

public class LetterListItemLayout extends QBRelativeLayout implements View.OnClickListener, ILetterItem {

    private static final int f72145b = MttResources.h(f.cR);

    public String f72146a;

    private QBWebImageView f72147c;

    private QBFrameLayout f72148d;
    private RoundImageView e;
    private RoundImageView f;
    private QBTextView g;
    private QBTextView h;
    private QBRelativeLayout i;
    private QBRelativeLayout j;
    private int k;
    private int l;
    private int m;
    private int n;
    private int o;
    private int p;
    private int q;
    private int r;
    private int s;
    private int t;
    private int u;
    private String v;
    private AccountInfo w;
    private SpannableStringBuilder x;
    private MCDetailMsg y;

    public LetterListItemLayout(Context context) {
        super(context, false);
        this.e = null;
        this.f = null;
        this.g = null;
        this.h = null;
        this.i = null;
        this.j = null;
        this.k = MttResources.h(f.n);
        this.l = MttResources.h(f.P);
        this.m = MttResources.h(f.r);
        this.n = MttResources.h(f.l);
        this.o = MttResources.h(f.s);
        this.p = MttResources.h(f.m);
        this.q = MttResources.h(f.e);
        this.r = MttResources.h(f.k);
        this.s = MttResources.h(f.ap);
        this.t = MttResources.h(f.aB);
        this.u = 1280;
        this.f72146a = "";
        this.v = "";
        this.w = null;
        this.x = new SpannableStringBuilder();
        this.y = null;
        this.w = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
        this.u = DeviceUtils.af();
        this.f72148d = new QBFrameLayout(context);
        this.f72148d.setId(100);
        this.f72148d.setVisibility(8);
        int i = this.l;
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i, i);
        layoutParams.topMargin = this.m;
        layoutParams.leftMargin = this.k;
        addView(this.f72148d, layoutParams);
        this.e = new RoundImageView(context, 0);
        this.e.setUseMaskForNightMode(true);
        this.e.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        this.e.setOnClickListener(this);
        int i2 = this.l;
        this.f72148d.addView(this.e, new RelativeLayout.LayoutParams(i2, i2));
        this.f72147c = new QBWebImageView(context);
        this.f72147c.setUrl("https://res.imtt.qq.com/res_mtt/mcenter/message_center_v.png");
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(UserMessageConstant.f72095a, UserMessageConstant.f72095a);
        layoutParams2.gravity = 85;
        this.f72147c.setVisibility(8);
        SimpleSkinBuilder.a((ImageView) this.f72147c).f();
        this.f72148d.addView(this.f72147c, layoutParams2);
        this.i = new BubbleBgRelativeLayout(context, true);
        this.i.setId(105);
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams3.addRule(1, 100);
        layoutParams3.addRule(6, 100);
        layoutParams3.rightMargin = this.s;
        layoutParams3.leftMargin = this.r;
        addView(this.i, layoutParams3);
        this.g = new QBTextView(context);
        this.g.setVisibility(8);
        this.g.setId(101);
        this.g.setUseMaskForNightMode(true);
        this.g.setIncludeFontPadding(false);
        this.g.setLineSpacing(this.q, 1.0f);
        this.g.setTextColorNormalIds(e.f85871a);
        this.g.setTextSize(f72145b);
        this.g.setMovementMethod(LinkMovementMethod.getInstance());
        QBTextView qBTextView = this.g;
        int i3 = this.o;
        int i4 = this.n;
        qBTextView.setPadding(i3, i4, this.p, i4);
        this.i.addView(this.g, new RelativeLayout.LayoutParams(-2, -2));
        this.f = new RoundImageView(context, 0);
        this.f.setVisibility(8);
        this.f.setId(103);
        this.f.setUseMaskForNightMode(true);
        this.f.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        int i5 = this.l;
        RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(i5, i5);
        layoutParams4.topMargin = this.m;
        layoutParams4.rightMargin = this.k;
        layoutParams4.addRule(11);
        addView(this.f, layoutParams4);
        this.j = new BubbleBgRelativeLayout(context, false);
        this.j.setId(104);
        RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams5.addRule(0, 103);
        layoutParams5.addRule(6, 103);
        layoutParams5.rightMargin = this.r;
        layoutParams5.leftMargin = this.s;
        addView(this.j, layoutParams5);
        this.h = new QBTextView(context);
        this.h.setVisibility(8);
        this.h.setId(104);
        this.h.setUseMaskForNightMode(true);
        this.h.setIncludeFontPadding(false);
        this.h.setLineSpacing(this.q, 1.0f);
        this.h.setTextColorNormalIds(e.r);
        this.h.setTextSize(f72145b);
        this.h.setMovementMethod(LinkMovementMethod.getInstance());
        QBTextView qBTextView2 = this.h;
        int i6 = this.p;
        int i7 = this.n;
        qBTextView2.setPadding(i6, i7, this.o, i7);
        this.h.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View view, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15) {
                if ((i8 == i12 && i9 == i13 && i10 == i14 && i11 == i15) || LetterListItemLayout.this.h.getLineCount() <= 1 || LetterListItemLayout.this.h.getGravity() == 3) {
                    return;
                }
                LetterListItemLayout.this.h.setGravity(3);
            }
        });
        this.j.addView(this.h, new RelativeLayout.LayoutParams(-2, -2));
    }

    private void a(MCDetailMsg mCDetailMsg, MCUserInfo mCUserInfo, ArrayList<MCTextComponent> arrayList) {
        Iterator<MCTextComponent> it = arrayList.iterator();
        int i = 0;
        while (it.hasNext()) {
            MCTextComponent next = it.next();
            String str = next.sContent;
            this.x.append((CharSequence) str);
            if (!TextUtils.equals(mCUserInfo.sUid, MessageCenterUtil.b())) {
                String str2 = next.sTextUrl;
                int i2 = e.f85871a;
                if (next.eColor == 2) {
                    i2 = e.f85874c;
                } else if (next.eColor == 3) {
                    i2 = e.g;
                } else if (next.eColor == 4) {
                    i2 = e.f;
                }
                this.x.setSpan(!TextUtils.isEmpty(str2) ? new NoLineClickableSpan(str2, MttResources.d(i2), mCDetailMsg.stMessage.sMsgID) : new ForegroundColorSpan(MttResources.d(i2)), i, str.length() + i, 33);
            }
            i += str.length();
        }
    }

    private void a(MCUserInfo mCUserInfo) {
        if (MessageCenterUtil.a(mCUserInfo)) {
            this.f72148d.setVisibility(8);
            this.g.setVisibility(8);
            this.h.setText(MessageCenterUtil.a(this.x.toString(), f72145b, this.x));
            MessageCenterUtil.a(this.x.toString(), getContext(), this.h, false);
            this.f.setVisibility(0);
            this.h.setVisibility(0);
            if (TextUtils.isEmpty(mCUserInfo.sIconUrl) || mCUserInfo.sIconUrl.length() <= 5) {
                this.f.setImageDrawableId(g.cd);
                return;
            } else {
                this.f.setUrl(mCUserInfo.sIconUrl);
                return;
            }
        }
        this.f72148d.setVisibility(0);
        this.g.setVisibility(0);
        this.g.setText(MessageCenterUtil.a(this.x.toString(), f72145b, this.x));
        MessageCenterUtil.a(this.x.toString(), getContext(), this.g, true);
        this.f.setVisibility(8);
        this.h.setVisibility(8);
        if (TextUtils.isEmpty(mCUserInfo.sIconUrl) || mCUserInfo.sIconUrl.length() <= 5) {
            this.e.setImageDrawableId(g.cd);
        } else {
            this.e.setUrl(mCUserInfo.sIconUrl);
        }
        if (mCUserInfo.bVip) {
            this.f72147c.setVisibility(0);
        } else {
            this.f72147c.setVisibility(8);
        }
    }

    @Override
    public void a(MCDetailMsg mCDetailMsg) {
        if (mCDetailMsg == null || mCDetailMsg.stSenderInfo == null || mCDetailMsg.stMessage == null) {
            return;
        }
        MCUserInfo mCUserInfo = mCDetailMsg.stSenderInfo;
        MCMessageUI1 mCMessageUI1 = (MCMessageUI1) mCDetailMsg.stMessage.getExtJce(MCMessageUI1.class);
        if (mCMessageUI1 == null) {
            return;
        }
        this.x.clear();
        this.v = mCUserInfo.sHomePageUrl;
        ArrayList<MCTextComponent> arrayList = mCMessageUI1.vTextItems;
        if (arrayList == null || arrayList.size() <= 0) {
            return;
        }
        this.y = mCDetailMsg;
        a(mCDetailMsg, mCUserInfo, arrayList);
        a(mCUserInfo);
    }

    @Override
    public int b(MCDetailMsg mCDetailMsg) {
        MCMessage mCMessage;
        MCMessageUI1 mCMessageUI1;
        if (mCDetailMsg == null || mCDetailMsg.stSenderInfo == null || (mCMessage = mCDetailMsg.stMessage) == null || (mCMessageUI1 = (MCMessageUI1) mCMessage.getExtJce(MCMessageUI1.class)) == null) {
            return 0;
        }
        this.x.clear();
        ArrayList<MCTextComponent> arrayList = mCMessageUI1.vTextItems;
        if (arrayList == null || arrayList.size() <= 0) {
            return 0;
        }
        Iterator<MCTextComponent> it = arrayList.iterator();
        while (it.hasNext()) {
            this.x.append((CharSequence) it.next().sContent);
        }
        return MessageCenterUtil.a(this.g, this.x.toString(), (((((this.u - this.o) - this.p) - this.s) - this.r) - this.l) - this.k, 150, false) + (this.n * 2) + this.m;
    }

    @Override
    public String getJumpUr() {
        return this.f72146a;
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        new UrlParams(this.v).b(1).c(0).d(true).e();
        MCDetailMsg mCDetailMsg = this.y;
        if (mCDetailMsg != null && mCDetailMsg.stSenderInfo != null) {
            StatManager.b().c("CFHX028_" + this.y.stSenderInfo.sUid);
        }
        EventCollector.getInstance().onViewClicked(view);
    }
}