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

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


package com.tencent.mtt.browser.homepage.fastcut.view.holder.recommendv2.common;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.tencent.connect.common.Constants;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.browser.homepage.appdata.AppInfoLoader;
import com.tencent.mtt.browser.homepage.fastcut.IFastCutItem;
import com.tencent.mtt.browser.homepage.fastcut.IFastCutManager;
import com.tencent.mtt.browser.homepage.fastcut.manager.FastCutManager;
import com.tencent.mtt.browser.homepage.fastcut.model.FastCutItemRecord;
import com.tencent.mtt.browser.homepage.fastcut.report.FastCutReportHelper;
import com.tencent.mtt.browser.homepage.fastcut.report.FastCutReportStrategyHelper;
import com.tencent.mtt.browser.homepage.fastcut.report.Scene;
import com.tencent.mtt.browser.homepage.fastcut.util.FastCutClickJumpUtil;
import com.tencent.mtt.browser.homepage.fastcut.util.FastCutIconUtil;
import com.tencent.mtt.browser.homepage.fastcut.util.ViewPressAlphaHelper;
import com.tencent.mtt.browser.homepage.fastcut.view.holder.panel.SimpleFastCutItemHolder;
import com.tencent.mtt.browser.homepage.fastcut.view.holder.recommendv2.reddot.AddClickRedDotCallback;
import com.tencent.mtt.browser.menu.facade.IMenuService;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.external.pagetoolbox.facade.IPageToolBoxService;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.newskin.SimpleSkinManager;
import com.tencent.mtt.newskin.viewBuilder.IImageBuilder;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.tencent.trpcprotocol.weapp.qb_quick_start_svr.qb_quick_start_svr.qbQuickStartSvr;
import java.util.HashSet;
import java.util.Set;

public class RecommendItemCommMgr {

    static Handler f40039a = new Handler(Looper.getMainLooper());

    private static Set<String> f40040b = new HashSet();

    public static class AnonymousClass1 implements View.OnClickListener {

        final AddClickRedDotCallback f40041a;

        final qbQuickStartSvr.CardBaseInfo f40042b;

        final FastCutItemRecord f40043c;

        final ImageView f40044d;
        final String e;

        AnonymousClass1(AddClickRedDotCallback addClickRedDotCallback, qbQuickStartSvr.CardBaseInfo cardBaseInfo, FastCutItemRecord fastCutItemRecord, ImageView imageView, String str) {
            this.f40041a = addClickRedDotCallback;
            this.f40042b = cardBaseInfo;
            this.f40043c = fastCutItemRecord;
            this.f40044d = imageView;
            this.e = str;
        }

        @Override
        public void onClick(View view) {
            FastCutItemRecord fastCutItemRecord;
            int i;
            EventCollector.getInstance().onViewClickedBefore(view);
            AddClickRedDotCallback addClickRedDotCallback = this.f40041a;
            if (addClickRedDotCallback != null) {
                addClickRedDotCallback.a();
            }
            if (this.f40042b.getCardType() == qbQuickStartSvr.CardType.SpecicalService) {
                fastCutItemRecord = this.f40043c;
                i = 18;
            } else if (this.f40042b.getCardType() == qbQuickStartSvr.CardType.SceneType) {
                fastCutItemRecord = this.f40043c;
                i = 19;
            } else if (this.f40042b.getCardType() == qbQuickStartSvr.CardType.BannerType) {
                fastCutItemRecord = this.f40043c;
                i = 16;
            } else if (this.f40042b.getCardType() == qbQuickStartSvr.CardType.NewUserType) {
                fastCutItemRecord = this.f40043c;
                i = 15;
            } else {
                fastCutItemRecord = this.f40043c;
                i = -1;
            }
            fastCutItemRecord.setSourceId(i);
            if (this.f40043c.g()) {
                if (this.f40043c.f39661b) {
                    RecommendItemCommMgr.a(new Runnable() {
                        @Override
                        public void run() {
                            RecommendItemCommMgr.b(AnonymousClass1.this.f40044d, AnonymousClass1.this.f40043c, AnonymousClass1.this.e, AnonymousClass1.this.f40042b);
                        }
                    });
                } else {
                    FastCutManager.getInstance().addFastCut(this.f40043c, false, new IFastCutManager.OnAddFastCutListener() {
                        @Override
                        public void onResult(final int i2) {
                            RecommendItemCommMgr.a(new Runnable() {
                                @Override
                                public void run() {
                                    RecommendItemCommMgr.a(i2, AnonymousClass1.this.f40044d, AnonymousClass1.this.f40043c, AnonymousClass1.this.e, AnonymousClass1.this.f40042b);
                                }
                            });
                        }
                    }, false, false);
                    if (!RecommendItemCommMgr.f40040b.contains(this.f40043c.getFastCutDeepLink())) {
                        FastCutReportStrategyHelper.a().a(this.f40042b, this.f40043c.getFastCutDeepLink(), System.currentTimeMillis());
                        RecommendItemCommMgr.f40040b.add(this.f40043c.getFastCutDeepLink());
                    }
                }
            }
            EventCollector.getInstance().onViewClicked(view);
        }
    }

    public enum GoHippyPageFrom {
        FromBanner,
        FromGoAll,
        FromHotCategory
    }

    public static void a() {
        Set<String> set = f40040b;
        if (set != null) {
            set.clear();
        }
    }

    public static void a(int i, ImageView imageView, FastCutItemRecord fastCutItemRecord, String str, qbQuickStartSvr.CardBaseInfo cardBaseInfo) {
        String str2;
        if (i == 0) {
            if (cardBaseInfo.getCardType() == qbQuickStartSvr.CardType.BannerType) {
                FastCutReportHelper.a((IFastCutItem) fastCutItemRecord, Constants.VIA_SHARE_TYPE_INFO, String.valueOf(cardBaseInfo.getCardId()), true);
            } else {
                FastCutReportHelper.a(fastCutItemRecord, "0", str);
            }
            fastCutItemRecord.f39661b = true;
            a(imageView, fastCutItemRecord, str, cardBaseInfo);
            return;
        }
        if (i == 1) {
            MttToaster.show(MttResources.l(R.string.a3r), 0);
            str2 = "1";
            FastCutReportHelper.a(fastCutItemRecord, str, "0", "2", "1");
        } else {
            if (i == 5) {
                return;
            }
            MttToaster.show("添加失败,稍后再试", 0);
            if (i == 3) {
                FastCutReportHelper.a(fastCutItemRecord, str, "0", "2", "2");
                FastCutReportHelper.b(fastCutItemRecord, str, "0", "2", "2");
                return;
            }
            FastCutReportHelper.a(fastCutItemRecord, str, "0", "2", "" + i);
            str2 = "" + i;
        }
        FastCutReportHelper.b(fastCutItemRecord, str, "0", "2", str2);
    }

    public static void a(View view, final TextView textView, final QBWebImageView qBWebImageView, final TextView textView2, final TextView textView3) {
        view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view2, MotionEvent motionEvent) {
                int action = motionEvent.getAction();
                if (action == 0) {
                    QBWebImageView.this.animate().alpha(0.4f).setDuration(0L).setStartDelay(50L);
                    textView2.animate().alpha(0.4f).setDuration(0L).setStartDelay(50L);
                    TextView textView4 = textView3;
                    if (textView4 != null) {
                        textView4.animate().alpha(0.4f).setDuration(0L).setStartDelay(50L);
                    }
                    textView.animate().alpha(textView.getAlpha() * 0.4f).setDuration(0L).setStartDelay(50L);
                    return false;
                }
                if (action != 1 && action != 3) {
                    return false;
                }
                QBWebImageView.this.animate().cancel();
                textView2.animate().cancel();
                TextView textView5 = textView3;
                if (textView5 != null) {
                    textView5.animate().cancel();
                }
                textView.animate().cancel();
                QBWebImageView.this.setAlpha(1.0f);
                textView2.setAlpha(1.0f);
                TextView textView6 = textView3;
                if (textView6 != null) {
                    textView6.setAlpha(1.0f);
                }
                if (SkinManager.s().l()) {
                    textView.setAlpha(0.4f);
                    return false;
                }
                textView.setAlpha(1.0f);
                return false;
            }
        });
    }

    public static void a(ImageView imageView, FastCutItemRecord fastCutItemRecord, String str, qbQuickStartSvr.CardBaseInfo cardBaseInfo) {
        a(imageView, fastCutItemRecord, str, cardBaseInfo, (AddClickRedDotCallback) null);
    }

    public static void a(ImageView imageView, FastCutItemRecord fastCutItemRecord, String str, qbQuickStartSvr.CardBaseInfo cardBaseInfo, AddClickRedDotCallback addClickRedDotCallback) {
        IImageBuilder a2;
        int i;
        FastCutReportHelper.a("100201", imageView, fastCutItemRecord, "0", str);
        ViewPressAlphaHelper.a((View) imageView, false);
        if (fastCutItemRecord.f39661b) {
            a2 = SimpleSkinBuilder.a(imageView);
            i = SkinManager.s().l() ? R.drawable.bii : R.drawable.bih;
        } else {
            a2 = SimpleSkinBuilder.a(imageView);
            i = SkinManager.s().l() ? R.drawable.big : R.drawable.bif;
        }
        a2.g(i).c().f();
        b(imageView, fastCutItemRecord, str, cardBaseInfo, addClickRedDotCallback);
    }

    public static void a(QBWebImageView qBWebImageView) {
        String str;
        if (PublicSettingManager.a().e()) {
            str = "https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/no_history_1_new2.png";
            if ("https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/no_history_1_new2.png".equals(qBWebImageView.getUrl())) {
                return;
            }
        } else {
            str = "https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/no_history_new2.png";
            if ("https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/no_history_new2.png".equals(qBWebImageView.getUrl())) {
                return;
            }
        }
        qBWebImageView.setImageDrawable(null);
        qBWebImageView.setUrl(str);
    }

    public static void a(QBWebImageView qBWebImageView, TextView textView, FastCutItemRecord fastCutItemRecord) {
        qBWebImageView.setEnableNoPicMode(false);
        if (!TextUtils.isEmpty(fastCutItemRecord.getFastCatIconUrl()) || "qb://short_frequently_used".equals(fastCutItemRecord.getFastCutDeepLink())) {
            qBWebImageView.setIsCircle(true);
            qBWebImageView.setVisibility(0);
            textView.setVisibility(8);
            if (!a(qBWebImageView, fastCutItemRecord)) {
                qBWebImageView.setImageDrawable(null);
                qBWebImageView.setUrl(fastCutItemRecord.getFastCatIconUrl());
            }
        } else {
            SimpleSkinManager.a().a(textView);
            if (SkinManager.s().l()) {
                textView.setAlpha(0.4f);
            } else {
                textView.setAlpha(1.0f);
            }
            textView.setVisibility(0);
            qBWebImageView.setVisibility(8);
            textView.setText(AppInfoLoader.a(fastCutItemRecord.getTitle()));
            textView.setBackgroundDrawable(FastCutIconUtil.a(FastCutIconUtil.a(fastCutItemRecord.getFastCutDeepLink()), fastCutItemRecord.getTitle()));
        }
        if (SkinManager.s().l()) {
            textView.setAlpha(0.4f);
        } else {
            textView.setAlpha(1.0f);
        }
    }

    static void a(Runnable runnable) {
        if (Looper.myLooper() == Looper.getMainLooper()) {
            runnable.run();
        } else {
            f40039a.post(runnable);
        }
    }

    public static void a(String str, GoHippyPageFrom goHippyPageFrom) {
        if (TextUtils.isEmpty(str)) {
            Logs.e("RecommendItemCommMgr", "goFastCutNavPage jumpUrl is null");
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putString("jump_url", str);
        new UrlParams("qb://fastcutnav?layoutfromtop=true").b(1).d(false).a(bundle).e();
        if (goHippyPageFrom == GoHippyPageFrom.FromGoAll) {
            FastCutReportHelper.k();
        }
    }

    public static boolean a(View view, FastCutItemRecord fastCutItemRecord, ISettingClickCallback iSettingClickCallback) {
        if ("qb://no_history".equals(fastCutItemRecord.getFastCutDeepLink())) {
            if (PublicSettingManager.a().e()) {
                ((IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class)).switchNoHistoryMode(false);
            } else {
                ((IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class)).switchNoHistoryMode(true);
            }
            if (iSettingClickCallback != null) {
                iSettingClickCallback.a(view);
            }
            return true;
        }
        if ("qb://darkmode".equals(fastCutItemRecord.getFastCutDeepLink())) {
            ((IMenuService) QBContext.getInstance().getService(IMenuService.class)).showSkinSwitchDialog();
            return true;
        }
        if (!"qb://short_frequently_used".equals(fastCutItemRecord.getFastCutDeepLink())) {
            return false;
        }
        FastCutClickJumpUtil.a(Scene.ManagePage, "qb://ext/rn?module=shortcutOftenUsed&component=shortcutOftenUsed&coverToolbar=true&orientation=1");
        return true;
    }

    public static boolean a(TextView textView, FastCutItemRecord fastCutItemRecord) {
        if ("qb://no_history".equals(fastCutItemRecord.getFastCutDeepLink())) {
            textView.setText(PublicSettingManager.a().e() ? "关闭无痕" : "无痕浏览");
            return true;
        }
        if (!"qb://darkmode".equals(fastCutItemRecord.getFastCutDeepLink())) {
            return false;
        }
        textView.setText(SkinManager.s().l() ? "日间模式" : "夜间模式");
        return true;
    }

    private static boolean a(QBWebImageView qBWebImageView, FastCutItemRecord fastCutItemRecord) {
        if ("qb://no_history".equals(fastCutItemRecord.getFastCutDeepLink())) {
            a(qBWebImageView);
            return true;
        }
        if ("qb://darkmode".equals(fastCutItemRecord.getFastCutDeepLink())) {
            b(qBWebImageView);
            return true;
        }
        if (!"qb://short_frequently_used".equals(fastCutItemRecord.getFastCutDeepLink())) {
            return false;
        }
        Bitmap frequentlyCombineBitmap = FastCutManager.getInstance().getFrequentlyCombineBitmap();
        if (frequentlyCombineBitmap != null && !frequentlyCombineBitmap.isRecycled()) {
            qBWebImageView.setImageBitmap(frequentlyCombineBitmap);
            SimpleSkinBuilder.a((ImageView) qBWebImageView).f();
        }
        return true;
    }

    public static void b(ImageView imageView, FastCutItemRecord fastCutItemRecord, String str, qbQuickStartSvr.CardBaseInfo cardBaseInfo) {
        if (cardBaseInfo.getCardType() == qbQuickStartSvr.CardType.BannerType) {
            FastCutReportHelper.a((IFastCutItem) fastCutItemRecord, str, String.valueOf(cardBaseInfo.getCardId()), false);
        } else {
            FastCutReportHelper.b(fastCutItemRecord, "0", str);
        }
        if (!FastCutManager.getInstance().a((IFastCutItem) fastCutItemRecord, false)) {
            MttToaster.show("移除失败,稍后再试", 0);
            return;
        }
        MttToaster.show("已移除直达", 0);
        fastCutItemRecord.f39661b = false;
        a(imageView, fastCutItemRecord, str, cardBaseInfo);
    }

    static void b(ImageView imageView, FastCutItemRecord fastCutItemRecord, String str, qbQuickStartSvr.CardBaseInfo cardBaseInfo, AddClickRedDotCallback addClickRedDotCallback) {
        SimpleFastCutItemHolder.a(imageView, MttResources.s(20));
        imageView.setOnClickListener(new AnonymousClass1(addClickRedDotCallback, cardBaseInfo, fastCutItemRecord, imageView, str));
    }

    public static void b(QBWebImageView qBWebImageView) {
        String str;
        if (SkinManager.s().l()) {
            str = "https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/light_mode_new2.png";
            if ("https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/light_mode_new2.png".equals(qBWebImageView.getUrl())) {
                return;
            }
        } else {
            str = "https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/night_mode_new2.png";
            if ("https://m4.publicimg.browser.qq.com/publicimg/nav/xhome/night_mode_new2.png".equals(qBWebImageView.getUrl())) {
                return;
            }
        }
        qBWebImageView.setImageDrawable(null);
        qBWebImageView.setUrl(str);
    }
}