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

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


package com.tencent.mtt.browser.account.usercenter.testnative;

import MTT.RedDotInfo;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
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 android.widget.LinearLayout;
import android.widget.TextView;
import com.taf.JceStruct;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.R;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.base.account.AccountInfo;
import com.tencent.mtt.base.functionwindow.IFunctionWndFactory;
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.browser.account.MTT.UserServiceContentItem;
import com.tencent.mtt.browser.account.MTT.UserServiceContentLocalItem;
import com.tencent.mtt.browser.account.usercenter.ILightView;
import com.tencent.mtt.browser.account.usercenter.commonicon.IIconAreaItemView;
import com.tencent.mtt.browser.account.usercenter.reddot.IRedDotView;
import com.tencent.mtt.browser.download.core.facade.IStoragePermissionCheckCallback;
import com.tencent.mtt.browser.download.core.impl.DownloadServiceManager;
import com.tencent.mtt.browser.openplatform.utils.OpenPlatformUtils;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.cmc.CMC;
import com.tencent.mtt.lottie.LottieAnimationView;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.newskin.badgeview.BadgeHelper;
import com.tencent.mtt.operation.event.EventLog;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.uifw2.base.resource.QBResource;
import java.util.HashMap;
import qb.a.e;
import qb.a.f;
import qb.a.g;

public class ImageTextItem extends LinearLayout implements ILightView, IIconAreaItemView, IRedDotView {

    TextView f35199a;

    QBWebImageView f35200b;

    ImageView f35201c;

    ImageView f35202d;
    TextView e;
    String f;
    View g;
    LottieAnimationView h;
    FrameLayout i;
    private LottieAnimationView j;
    private RedDotInfo k;
    private ImageView l;

    public ImageTextItem(Context context) {
        super(context);
        setOrientation(1);
        setGravity(1);
        SimpleSkinBuilder.a(this).c().f();
        this.i = new FrameLayout(context);
        addView(this.i, new LinearLayout.LayoutParams(-1, -2));
        this.f35199a = new TextView(context);
        SimpleSkinBuilder.a(this.f35199a).a(g.cH).g(R.color.new_icon_text_color);
        this.f35199a.setTextSize(MttResources.h(f.l));
        this.f35199a.setGravity(17);
        this.f35199a.setIncludeFontPadding(false);
        this.f35199a.setPadding(MttResources.h(f.e), 0, MttResources.h(f.e), MttResources.h(f.f85879c));
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, MttResources.h(f.t));
        layoutParams.topMargin = MttResources.s(2);
        layoutParams.gravity = 1;
        this.i.addView(this.f35199a, layoutParams);
        this.f35200b = new QBWebImageView(context);
        this.f35200b.setEnableNoPicMode(false);
        SimpleSkinBuilder.a((ImageView) this.f35200b).i(R.color.uc_icon_area_click_color).f();
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(MttResources.h(f.M), MttResources.h(f.M));
        layoutParams2.topMargin = MttResources.h(f.l);
        layoutParams2.bottomMargin = MttResources.h(f.f85879c);
        layoutParams2.gravity = 1;
        this.i.addView(this.f35200b, layoutParams2);
        this.f35201c = new ImageView(context);
        SimpleSkinBuilder.a(this.f35201c).i(R.color.uc_icon_area_click_color).f();
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(MttResources.h(f.M), MttResources.h(f.M));
        layoutParams3.topMargin = MttResources.h(f.l);
        layoutParams3.bottomMargin = MttResources.h(f.f85879c);
        layoutParams3.gravity = 1;
        this.f35201c.setVisibility(8);
        this.i.addView(this.f35201c, layoutParams3);
        this.g = this.f35201c;
        this.h = new LottieAnimationView(getContext());
        SimpleSkinBuilder.a((ImageView) this.h).f();
        this.h.setVisibility(8);
        FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(MttResources.h(f.M), MttResources.h(f.M));
        layoutParams4.topMargin = MttResources.h(f.l);
        layoutParams4.bottomMargin = MttResources.h(f.f85879c);
        layoutParams4.gravity = 1;
        this.i.addView(this.h, layoutParams4);
        this.f35202d = new ImageView(context);
        SimpleSkinBuilder.a(this.f35202d).f();
        this.f35202d.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(MttResources.h(f.ac), MttResources.h(f.S));
        layoutParams5.topMargin = MttResources.h(f.j);
        layoutParams5.bottomMargin = MttResources.h(f.f85879c);
        layoutParams5.gravity = 1;
        this.i.addView(this.f35202d, layoutParams5);
        this.e = new TextView(context);
        this.e.setTextSize(1, 11.0f);
        SimpleSkinBuilder.a(this.e).g(e.f85873b).c().f();
        this.e.setIncludeFontPadding(false);
        addView(this.e, new LinearLayout.LayoutParams(-2, -2));
    }

    private void a(final UserServiceContentItem userServiceContentItem) {
        if (userServiceContentItem.iServiceId != 20011) {
            b(userServiceContentItem);
        } else {
            StatManager.b().c("DMKCLK001_10");
            DownloadServiceManager.a().checkStoragePermission(new IStoragePermissionCheckCallback() {
                @Override
                public void a(boolean z) {
                    if (z) {
                        ImageTextItem.this.b(userServiceContentItem);
                    }
                }
            }, null);
        }
    }

    public void b(UserServiceContentItem userServiceContentItem) {
        String str = userServiceContentItem.sUrl;
        if (userServiceContentItem.iServiceId == 20001 && OpenPlatformUtils.f == 1) {
            str = "qb://usercentersub?" + UrlUtils.addParamsToUrl("https://res.imtt.qq.com/walletqb/app.html#page=cover", "sandbox=1");
        }
        c(userServiceContentItem);
        Bundle bundle = new Bundle();
        bundle.putString("down:key_from_scene", "grzx");
        UrlParams a2 = new UrlParams(str).b(1).d(true).c(0).a(bundle);
        if (str.startsWith(IFunctionWndFactory.FUNCTIONPRE)) {
            a2.d(2);
        }
        a2.f(userServiceContentItem.iServiceId == 20009 ? 112 : userServiceContentItem.iServiceId == 20010 ? 113 : 115);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(a2);
    }

    public void c() {
        if (this.j == null) {
            this.j = new LottieAnimationView(getContext());
            SimpleSkinBuilder.a((ImageView) this.j).f();
            this.j.setAnimation("usercenter_common_enter_light_anim.json");
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(this.i.getWidth(), this.i.getHeight() - MttResources.s(4));
            layoutParams.gravity = 49;
            layoutParams.topMargin = MttResources.s(4);
            this.i.addView(this.j, layoutParams);
        }
        this.j.addAnimatorListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animator) {
                ImageTextItem.this.j.setVisibility(8);
            }

            @Override
            public void onAnimationStart(Animator animator) {
                ImageTextItem.this.j.setVisibility(0);
            }
        });
        this.j.playAnimation();
    }

    private void c(UserServiceContentItem userServiceContentItem) {
        StatManager b2;
        String str;
        StatManager.b().c("LFFT02_" + userServiceContentItem.iServiceId);
        if (userServiceContentItem.iServiceId == 20009) {
            b2 = StatManager.b();
            str = "DMKCLK001_8";
        } else if (userServiceContentItem.iServiceId == 20010) {
            b2 = StatManager.b();
            str = "DMKCLK001_9";
        } else if (userServiceContentItem.iServiceId == 20004) {
            b2 = StatManager.b();
            str = "DMKCLK001_13";
        } else if (userServiceContentItem.iServiceId == 20019) {
            b2 = StatManager.b();
            str = "DMKCLK001_14";
        } else if (userServiceContentItem.iServiceId == 20022) {
            StatManager.b().c("DMXCX002");
            b2 = StatManager.b();
            str = "DMKCLK001_15";
        } else {
            if (userServiceContentItem.iServiceId != 20021) {
                return;
            }
            b2 = StatManager.b();
            str = "DMKQK001";
        }
        b2.c(str);
    }

    private void d() {
        if (this.l == null) {
            Drawable c2 = QBResource.c(R.drawable.bak);
            this.l = new ImageView(getContext());
            this.l.setImageDrawable(c2);
            SimpleSkinBuilder.a(this.l).f();
        }
        this.g.post(new Runnable() {
            @Override
            public void run() {
                if (ImageTextItem.this.l != null && ImageTextItem.this.l.getParent() != null) {
                    ((ViewGroup) ImageTextItem.this.l.getParent()).removeView(ImageTextItem.this.l);
                }
                FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
                layoutParams.gravity = 49;
                layoutParams.topMargin = ImageTextItem.this.g.getTop();
                layoutParams.leftMargin = ImageTextItem.this.g.getWidth() / 2;
                ImageTextItem.this.l.setVisibility(0);
                ImageTextItem.this.i.addView(ImageTextItem.this.l, layoutParams);
            }
        });
    }

    private void e() {
        ImageView imageView = this.l;
        if (imageView != null) {
            imageView.setVisibility(8);
        }
    }

    public void a() {
    }

    public void a(int i, String str) {
        if (i == 1) {
            this.h.setVisibility(0);
            this.h.setImageAssetsFolder("images");
            this.h.setAnimation(str);
            this.h.setAlpha(255);
            if (SkinManager.s().l()) {
                this.h.setAlpha(0.4f);
            }
            this.h.loop(false);
            this.h.playAnimation();
            this.h.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) {
                    ImageTextItem.this.g.setVisibility(4);
                }
            });
        }
    }

    @Override
    public void a(RedDotInfo redDotInfo) {
        this.k = redDotInfo;
        if (redDotInfo != null) {
            d();
        } else {
            e();
        }
    }

    @Override
    public void a(JceStruct jceStruct) {
        TextView textView;
        float f;
        if (jceStruct instanceof UserServiceContentItem) {
            UserServiceContentItem userServiceContentItem = (UserServiceContentItem) jceStruct;
            AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
            String string = BaseSettings.a().getString(currentUserInfo.qbId + "common_service_state_" + userServiceContentItem.iServiceId, "");
            if (!TextUtils.isEmpty(string) && TextUtils.equals(string, String.valueOf(userServiceContentItem.iBubbleTaskId))) {
                userServiceContentItem.iRedBubbleType = 0;
            }
            if (userServiceContentItem instanceof UserServiceContentLocalItem) {
                UserServiceContentLocalItem userServiceContentLocalItem = (UserServiceContentLocalItem) userServiceContentItem;
                if (userServiceContentLocalItem.viewId > 0) {
                    setId(userServiceContentLocalItem.viewId);
                }
                a(userServiceContentItem.sRedBubbleTitle, userServiceContentLocalItem.mLocalDrawableId, userServiceContentItem.sIcon, userServiceContentItem.sTitle, userServiceContentItem.iRedBubbleType, userServiceContentItem.sUrl);
                a((RedDotInfo) null);
            } else {
                a(userServiceContentItem.sRedBubbleTitle, 0, userServiceContentItem.sIcon, userServiceContentItem.sTitle, userServiceContentItem.iRedBubbleType, userServiceContentItem.sUrl);
            }
            a();
            if (userServiceContentItem.animType != 0) {
                a(userServiceContentItem.animType, userServiceContentItem.defaultAnimName);
            }
            if (userServiceContentItem.isEdit) {
                textView = this.e;
                f = 0.4f;
            } else {
                textView = this.e;
                f = 1.0f;
            }
            textView.setAlpha(f);
            this.f35200b.setAlpha(f);
            this.f35201c.setAlpha(f);
            this.f35199a.setAlpha(f);
            this.f35202d.setAlpha(f);
        }
    }

    public void a(String str, int i, String str2, String str3, int i2, String str4) {
        View view;
        this.f35199a.setVisibility(8);
        this.g.setVisibility(8);
        this.h.setVisibility(8);
        this.g = null;
        b();
        if (i2 == 1) {
            BadgeHelper.a(this.f35202d).a("");
        } else if (i2 == 2) {
            BadgeHelper.a(this.f35202d).a(str);
        } else if (i2 == 3 && !TextUtils.isEmpty(str)) {
            this.f35199a.setText(str);
            this.f35199a.setVisibility(0);
        }
        EventLog.a("个人中心", "个人中心ui相关", "常用入口更新icon", " imageurl : " + str2 + " | imageid : " + i, "alinli", 1);
        if (TextUtils.isEmpty(str2)) {
            SimpleSkinBuilder.a(this.f35201c).g(i).f();
            this.f35200b.setVisibility(8);
            this.f35201c.setVisibility(0);
            view = this.f35201c;
        } else {
            this.f35200b.setUrl(str2);
            this.f35200b.setVisibility(0);
            this.f35201c.setVisibility(8);
            view = this.f35200b;
        }
        this.g = view;
        this.e.setText(str3);
        this.f = str4;
    }

    @Override
    public void a(boolean z) {
        if (z) {
            post(new Runnable() {
                @Override
                public void run() {
                    ImageTextItem.this.c();
                }
            });
        }
    }

    public void b() {
        this.f35199a.setVisibility(8);
        BadgeHelper.a(this.f35202d).b();
    }

    @Override
    public void b(JceStruct jceStruct) {
        if (jceStruct instanceof UserServiceContentItem) {
            UserServiceContentItem userServiceContentItem = (UserServiceContentItem) jceStruct;
            a((RedDotInfo) null);
            if (userServiceContentItem.mClickRunnable != null) {
                userServiceContentItem.mClickRunnable.run();
                HashMap hashMap = new HashMap();
                hashMap.put("url", "");
                hashMap.put("entry", String.valueOf(115));
                CMC.a("cmc://statistics/m?cmd=onStatEntryType", hashMap);
            } else {
                a(userServiceContentItem);
            }
            AccountInfo currentUserInfo = ((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo();
            BaseSettings.a().setString(currentUserInfo.qbId + "common_service_state_" + userServiceContentItem.iServiceId, String.valueOf(userServiceContentItem.iBubbleTaskId));
            b();
            StatManager.b().c("CCHM" + userServiceContentItem.iServiceId);
        }
    }

    public TextView getTextView() {
        return this.e;
    }
}