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

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


package com.tencent.mtt.browser.homepage.fastcut.view.holder.panel;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.tencent.common.boot.BootFeatureToggle;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.utils.LayoutInflaterCacheManager;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.browser.homepage.fastcut.IFastCutItem;
import com.tencent.mtt.browser.homepage.fastcut.manager.FastCutFrequentlyUseDataProvider;
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.model.bean.FastCutItemRecordWrapper;
import com.tencent.mtt.browser.homepage.fastcut.reddot.bluepoint.BlueBadgeHelper;
import com.tencent.mtt.browser.homepage.fastcut.reddot.bluepoint.BlueBadgeManager;
import com.tencent.mtt.browser.homepage.fastcut.reddot.bluepoint.badge.IBluePointItem;
import com.tencent.mtt.browser.homepage.fastcut.report.FastCutReportHelper;
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.ISortable;
import com.tencent.mtt.browser.homepage.fastcut.view.XHomeFastCutPanelView;
import com.tencent.mtt.browser.homepage.fastcut.view.anim.FastCutItemAnimManager;
import com.tencent.mtt.browser.homepage.fastcut.view.edit.FastCutEditDialog;
import com.tencent.mtt.browser.homepage.fastcut.view.edit.base.ListenKeyBoardDialogFragmentBase;
import com.tencent.mtt.browser.homepage.fastcut.view.edit.util.FastCutEditColorUtil;
import com.tencent.mtt.browser.homepage.fastcut.view.frequently.layout.JoinLayout;
import com.tencent.mtt.browser.homepage.fastcut.view.recent.FastcutRecentItem;
import com.tencent.mtt.browser.homepage.fastcut.view.recent.FastcutRecentItemClickListener;
import com.tencent.mtt.browser.homepage.fastcut.view.recent.FastcutRecentItemGroupView;
import com.tencent.mtt.browser.homepage.visit.action.XHomeUserActionRecorder;
import com.tencent.mtt.browser.homepage.xhome.background.XHomeBackgroundSkinOpManager;
import com.tencent.mtt.browser.homepage.xhome.util.XHomeFeatUtil;
import com.tencent.mtt.browser.menu.facade.IMenuService;
import com.tencent.mtt.browser.setting.manager.SkinManagerNew;
import com.tencent.mtt.external.pagetoolbox.facade.IPageToolBoxService;
import com.tencent.mtt.frequence.visit.IVisit;
import com.tencent.mtt.hippy.qb.views.HippyQBViewTouchAndDrawData;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.newskin.SimpleSkinManager;
import com.tencent.mtt.nxeasy.listview.base.ItemDataHolder;
import com.tencent.mtt.nxeasy.listview.base.ItemLocation;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.builder.api.ICommonDialogBuilder;
import com.tencent.mtt.view.dialog.newui.builder.api.base.IDialogBuilderInterface;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.dialog.newui.view.ViewOnClickListener;
import com.tencent.mtt.view.dialog.newui.view.getter.IViewGetter;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.mtt.xhome.rule.IXHomeTabGuideService;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import qb.homepage.BuildConfig;

public class SimpleFastCutItemHolder extends ItemDataHolder<View> implements IBluePointItem, ISortable {

    public static final int f39943a = 2131558764;

    public IFastCutItem f39944b;

    private boolean f39946d;
    private int e;
    private XHomeFastCutPanelView f;
    private ImageView g;
    private ImageView h;
    private FastcutRecentItemGroupView i;
    private View j;

    protected View.OnClickListener f39945c = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            EventCollector.getInstance().onViewClickedBefore(view);
            if (!(SimpleFastCutItemHolder.this.f39944b instanceof FastCutItemRecord) || ((FastCutItemRecord) SimpleFastCutItemHolder.this.f39944b).g()) {
                if (SimpleFastCutItemHolder.this.m()) {
                    if (SimpleFastCutItemHolder.this.f39944b.getFastCutDeepLink().equals("qb://no_history") || SimpleFastCutItemHolder.this.f39944b.getFastCutDeepLink().equals("qb://darkmode") || "qb://short_frequently_used".equals(SimpleFastCutItemHolder.this.f39944b.getFastCutDeepLink())) {
                        MttToaster.show("该直达暂不支持修改标题和图标", 0);
                    } else {
                        FastCutReportHelper.b(SimpleFastCutItemHolder.this.f39944b, SimpleFastCutItemHolder.this.e);
                        Activity a2 = ActivityHandler.b().a();
                        if ((a2 instanceof FragmentActivity) && (SimpleFastCutItemHolder.this.f39944b instanceof FastCutItemRecord)) {
                            SimpleFastCutItemHolder.this.a(true);
                            FastCutEditDialog.a((FragmentActivity) a2, (FastCutItemRecord) SimpleFastCutItemHolder.this.f39944b, SimpleFastCutItemHolder.this.e).a(new ListenKeyBoardDialogFragmentBase.OnDialogDismissListener() {
                                @Override
                                public void a() {
                                    SimpleFastCutItemHolder.this.a(false);
                                }
                            });
                        }
                    }
                } else if (SimpleFastCutItemHolder.this.e == FastCutManager.f39534d) {
                    SimpleFastCutItemHolder.this.onClick(view);
                } else {
                    if (SimpleFastCutItemHolder.this.f39944b instanceof FastCutItemRecord) {
                        FastCutManager.getInstance().a(100, (FastCutItemRecord) SimpleFastCutItemHolder.this.f39944b);
                    }
                    if (!SimpleFastCutItemHolder.this.a(view)) {
                        if ("qb://short_frequently_used".equals(SimpleFastCutItemHolder.this.f39944b.getFastCutDeepLink())) {
                            SimpleFastCutItemHolder.this.c(view);
                        } else if (SimpleFastCutItemHolder.this.e == FastCutManager.f39531a) {
                            FastCutClickJumpUtil.a(Scene.MainPage, SimpleFastCutItemHolder.this.f39944b);
                            XHomeUserActionRecorder.a(com.tencent.mtt.frequence.visit.Scene.OTHER_SCENE_XHOME_PANEL, HippyQBViewTouchAndDrawData.GES_TYPE_CLICK);
                        } else {
                            FastCutClickJumpUtil.a(Scene.ManagePage, SimpleFastCutItemHolder.this.f39944b);
                        }
                    }
                    FastCutReportHelper.a(SimpleFastCutItemHolder.this.f39944b, SimpleFastCutItemHolder.this.e);
                    if (SimpleFastCutItemHolder.this.e == FastCutManager.f39531a) {
                        BlueBadgeManager.getInstance().a(SimpleFastCutItemHolder.this.f39944b.getFastCutId());
                    }
                }
                ((IVisit) QBContext.getInstance().getService(IVisit.class)).visitOtherScene(com.tencent.mtt.frequence.visit.Scene.OTHER_SCENE_DEFUALT_TAB_GUIDE, IXHomeTabGuideService.XHOME_TAB_SCENE, IXHomeTabGuideService.XHOME_TAB_SCENE);
            }
            EventCollector.getInstance().onViewClicked(view);
        }
    };
    private AnimatorListenerAdapter k = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            super.onAnimationEnd(animator);
            SimpleFastCutItemHolder.this.f.c(false);
        }

        @Override
        public void onAnimationStart(Animator animator) {
            super.onAnimationStart(animator);
            if (SimpleFastCutItemHolder.this.h != null) {
                SimpleFastCutItemHolder.this.h.setVisibility(4);
            }
            SimpleFastCutItemHolder.this.f.l = true;
            SimpleFastCutItemHolder.this.f.c(false);
        }
    };
    private AnimatorListenerAdapter l = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationCancel(Animator animator) {
            super.onAnimationCancel(animator);
            SimpleFastCutItemHolder.this.p();
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            super.onAnimationEnd(animator);
            SimpleFastCutItemHolder.this.p();
            FastCutManager.getInstance().e();
        }

        @Override
        public void onAnimationStart(Animator animator) {
            super.onAnimationStart(animator);
        }
    };

    public SimpleFastCutItemHolder(IFastCutItem iFastCutItem, boolean z, int i, XHomeFastCutPanelView xHomeFastCutPanelView) {
        this.f39944b = iFastCutItem;
        this.f39946d = z;
        this.e = i;
        this.f = xHomeFastCutPanelView;
    }

    public static String a(FastCutItemRecord fastCutItemRecord) {
        return (fastCutItemRecord.d() != 1 || TextUtils.isEmpty(fastCutItemRecord.f())) ? fastCutItemRecord.getTitle() : fastCutItemRecord.f();
    }

    public static void a(final View view, final int i) {
        final View view2 = (View) view.getParent();
        view2.post(new Runnable() {
            @Override
            public void run() {
                Rect rect = new Rect();
                view.getHitRect(rect);
                rect.top -= i;
                rect.bottom += i;
                rect.left -= i;
                rect.right += i;
                view2.setTouchDelegate(new TouchDelegate(rect, view));
            }
        });
    }

    private void a(ImageView imageView) {
        IFastCutItem iFastCutItem;
        String str;
        String str2;
        if (this.e != FastCutManager.f39531a) {
            if (this.e == FastCutManager.f39532b) {
                iFastCutItem = this.f39944b;
                str = "100204";
                str2 = "1";
            }
            imageView.setVisibility(!this.f39946d ? 0 : 8);
            if (this.f39946d) {
                imageView.setOnClickListener(null);
                return;
            } else {
                imageView.setOnClickListener(this);
                return;
            }
        }
        iFastCutItem = this.f39944b;
        str = "100112";
        str2 = "0";
        FastCutReportHelper.a(str, imageView, iFastCutItem, "", str2);
        imageView.setVisibility(!this.f39946d ? 0 : 8);
        if (this.f39946d) {
        }
    }

    private void a(TextView textView) {
        int parseColor;
        if (SkinManagerNew.b().j()) {
            if (XHomeBackgroundSkinOpManager.getInstance().getSkinType() != 2) {
            }
            parseColor = Color.parseColor("#B2FFFFFF");
        } else if (!SkinManagerNew.b().f()) {
            if (SkinManagerNew.b().g()) {
                parseColor = Color.parseColor("#ff4b5057");
            }
            parseColor = Color.parseColor("#8F8F8F");
        }
        textView.setTextColor(parseColor);
    }

    private void a(QBWebImageView qBWebImageView, TextView textView, ImageView imageView) {
        IFastCutItem iFastCutItem = this.f39944b;
        if (iFastCutItem instanceof FastCutItemRecord) {
            FastCutItemRecord fastCutItemRecord = (FastCutItemRecord) iFastCutItem;
            if (fastCutItemRecord.c() == 1 && fastCutItemRecord.e() > 0) {
                SimpleSkinManager.a().a(textView);
                textView.setVisibility(0);
                qBWebImageView.setVisibility(8);
                textView.setText(FastCutIconUtil.a(fastCutItemRecord.getExternalInfo(), fastCutItemRecord.getFastCutDeepLink(), a(fastCutItemRecord)));
                textView.setBackground(FastCutEditColorUtil.c(fastCutItemRecord.e()));
                return;
            }
        }
        String k = k();
        if (TextUtils.equals("qb://short_frequently_used", this.f39944b.getFastCutDeepLink())) {
            textView.setVisibility(8);
            qBWebImageView.setVisibility(8);
            imageView.setVisibility(0);
            imageView.setImageBitmap(FastCutManager.getInstance().getFrequentlyCombineBitmap());
            SimpleSkinBuilder.a(imageView).f();
            return;
        }
        if (!TextUtils.isEmpty(k)) {
            qBWebImageView.setIsCircle(true);
            qBWebImageView.setVisibility(0);
            textView.setVisibility(8);
            imageView.setVisibility(8);
            if (a(qBWebImageView) || k.equals(qBWebImageView.getUrl())) {
                return;
            }
            qBWebImageView.setImageDrawable(null);
            qBWebImageView.setUrl(k);
            return;
        }
        SimpleSkinManager.a().a(textView);
        textView.setVisibility(0);
        qBWebImageView.setVisibility(8);
        imageView.setVisibility(8);
        IFastCutItem iFastCutItem2 = this.f39944b;
        if (iFastCutItem2 instanceof FastCutItemRecord) {
            String a2 = a((FastCutItemRecord) iFastCutItem2);
            textView.setText(FastCutIconUtil.a(this.f39944b.getExternalInfo(), this.f39944b.getFastCutDeepLink(), a2));
            textView.setBackground(FastCutIconUtil.a(FastCutIconUtil.a(this.f39944b.getFastCutDeepLink()), a2));
        }
    }

    private void a(final String str, String str2) {
        Activity a2 = ActivityHandler.b().a();
        if (a2 == null) {
            return;
        }
        ICommonDialogBuilder a3 = SimpleDialogBuilder.a(a2).a(IDialogBuilderInterface.ButtonOrientation.VERTICAL).a(IDialogBuilderInterface.ButtonStyle.RED).a((CharSequence) "确认删除").c("取消").d(str2).a_(new ViewOnClickListener() {
            @Override
            public void onClick(View view, DialogBase dialogBase) {
                dialogBase.dismiss();
                SimpleFastCutItemHolder.this.b(dialogBase, str);
            }
        }).c(new ViewOnClickListener() {
            @Override
            public void onClick(View view, DialogBase dialogBase) {
                dialogBase.dismiss();
            }
        }).b(true).a(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialogInterface) {
                SimpleFastCutItemHolder.this.a((DialogBase) dialogInterface, str);
            }
        });
        IViewGetter b2 = a3.b();
        DialogBase d2 = a3.d();
        QBTextView b3 = b2.b();
        b3.setEllipsize(TextUtils.TruncateAt.END);
        b3.setMaxLines(2);
        d2.show();
        FastCutReportHelper.a(str, "0", this.f39944b);
        FastCutReportHelper.a(d2, str, "0", this.f39944b);
    }

    private void a(List<FastCutItemRecordWrapper> list) {
        for (FastCutItemRecordWrapper fastCutItemRecordWrapper : list) {
            FastCutReportHelper.a((IFastCutItem) fastCutItemRecordWrapper.d(), fastCutItemRecordWrapper.f());
        }
    }

    private boolean a(QBWebImageView qBWebImageView) {
        if ("qb://no_history".equals(this.f39944b.getFastCutDeepLink())) {
            b(qBWebImageView);
            return true;
        }
        if (!"qb://darkmode".equals(this.f39944b.getFastCutDeepLink())) {
            return false;
        }
        c(qBWebImageView);
        return true;
    }

    private void b(View view) {
        if (TextUtils.equals(this.f39944b.getFastCutDeepLink(), FastCutItemAnimManager.f39827a) && FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_867975155) && !this.f39946d) {
            view.setVisibility(4);
        }
    }

    private void b(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);
    }

    private boolean b(TextView textView) {
        if ("qb://no_history".equals(this.f39944b.getFastCutDeepLink())) {
            textView.setText(PublicSettingManager.a().e() ? "关闭无痕" : "无痕浏览");
            return true;
        }
        if (!"qb://darkmode".equals(this.f39944b.getFastCutDeepLink())) {
            return false;
        }
        textView.setText(SkinManagerNew.b().g() ? "日间模式" : "夜间模式");
        return true;
    }

    public void c(View view) {
        l();
        List<FastCutItemRecordWrapper> o = FastCutManager.getInstance().o();
        ArrayList arrayList = new ArrayList();
        Iterator<FastCutItemRecordWrapper> it = o.iterator();
        while (it.hasNext()) {
            arrayList.add(it.next().c());
        }
        View findViewById = view.findViewById(R.id.rl_content_bkg);
        View findViewById2 = view.findViewById(R.id.rl_content);
        View findViewById3 = view.findViewById(R.id.iv_big_item);
        this.i = new FastcutRecentItemGroupView.Builder(view.getContext()).a(arrayList).a("经常使用").a((int) (JoinLayout.b(o.size())[0] * FastCutFrequentlyUseDataProvider.f39521a)).b(MttResources.s(44)).a(findViewById3.getWidth(), findViewById3.getHeight(), view.getLeft() + findViewById.getLeft() + findViewById3.getLeft() + findViewById2.getLeft(), view.getTop() + findViewById.getTop() + findViewById3.getTop() + findViewById2.getTop()).b(this.f.getWidth() - MttResources.s(24), (XHomeFastCutPanelView.f39759b * 2) + XHomeFastCutPanelView.f39761d, MttResources.s(12), 0.0f).c(300).b(this.k).a(this.l).a(new FastcutRecentItemClickListener() {
            @Override
            public void a(FastcutRecentItem fastcutRecentItem) {
                if (fastcutRecentItem.h() != null && fastcutRecentItem.h().d() != null) {
                    FastCutClickJumpUtil.a(Scene.FrequentUse, fastcutRecentItem.h().d().getFastCutDeepLink());
                    FastCutReportHelper.b((IFastCutItem) fastcutRecentItem.h().d(), fastcutRecentItem.h().f());
                }
                SimpleFastCutItemHolder.this.g();
            }
        }).a();
        if (this.i.getParent() == null) {
            ((ViewGroup) this.f.getParent()).addView(this.i);
        }
        this.i.a();
        a(o);
    }

    private void c(TextView textView) {
        String fastCutDeepLink;
        IFastCutItem iFastCutItem = this.f39944b;
        if (iFastCutItem instanceof FastCutItemRecord) {
            FastCutItemRecord fastCutItemRecord = (FastCutItemRecord) iFastCutItem;
            if (fastCutItemRecord.d() == 1 && !TextUtils.isEmpty(fastCutItemRecord.f()) && !TextUtils.equals(fastCutItemRecord.f(), fastCutItemRecord.getTitle())) {
                textView.setText(fastCutItemRecord.f());
                return;
            }
        }
        if (TextUtils.isEmpty(this.f39944b.getTitle())) {
            fastCutDeepLink = this.f39944b.getFastCutDeepLink();
        } else if (b(textView)) {
            return;
        } else {
            fastCutDeepLink = this.f39944b.getTitle();
        }
        textView.setText(fastCutDeepLink);
    }

    private void c(QBWebImageView qBWebImageView) {
        String str;
        if (SkinManagerNew.b().g()) {
            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);
    }

    private void i() {
        if (this.e != FastCutManager.f39531a) {
            return;
        }
        if (!"qb://short_frequently_used".equals(this.f39944b.getFastCutDeepLink())) {
            BlueBadgeManager.getInstance().a(this);
        } else if (PublicSettingManager.a().getBoolean("KEY_CAN_SHOW_FREQUENTLY_BLUE_DOT", true)) {
            BlueBadgeHelper.a(this).b(d()).a();
        } else {
            BlueBadgeHelper.a(this).b(d()).b();
        }
    }

    private void j() {
        boolean z;
        if (this.e == FastCutManager.f39534d) {
            IFastCutItem iFastCutItem = this.f39944b;
            if (iFastCutItem instanceof FastCutItemRecord) {
                z = ((FastCutItemRecord) iFastCutItem).f39663d;
                a(z);
            }
        }
        z = false;
        a(z);
    }

    private String k() {
        if (!TextUtils.isEmpty(this.f39944b.getFastCatIconUrl())) {
            return this.f39944b.getFastCatIconUrl();
        }
        if (FastCutIconUtil.a(this.f39944b.getFastCutDeepLink()) == 7) {
            return FastCutIconUtil.b(this.f39944b.getFastCutDeepLink());
        }
        return null;
    }

    private void l() {
        PublicSettingManager.a().setBoolean("KEY_CAN_SHOW_FREQUENTLY_BLUE_DOT", false);
        BlueBadgeHelper.a(this).b(d()).b();
    }

    public boolean m() {
        XHomeFastCutPanelView xHomeFastCutPanelView;
        if (this.e == FastCutManager.f39532b) {
            return true;
        }
        if (this.e == FastCutManager.f39534d || (xHomeFastCutPanelView = this.f) == null) {
            return false;
        }
        return xHomeFastCutPanelView.e();
    }

    private void n() {
        ImageView imageView;
        Drawable drawable;
        if (SkinManagerNew.b().j()) {
            if (XHomeBackgroundSkinOpManager.getInstance().getSkinType() != 1) {
            }
            imageView = this.g;
            drawable = AppCompatResources.getDrawable(ContextHolder.getAppContext(), R.drawable.u4);
        } else {
            if (SkinManagerNew.b().f()) {
            }
            imageView = this.g;
            drawable = AppCompatResources.getDrawable(ContextHolder.getAppContext(), R.drawable.u2);
        }
        imageView.setBackground(drawable);
    }

    private void o() {
        ImageView imageView;
        Drawable drawable;
        if (SkinManagerNew.b().j()) {
            if (XHomeBackgroundSkinOpManager.getInstance().getSkinType() != 1) {
            }
            imageView = this.g;
            drawable = AppCompatResources.getDrawable(ContextHolder.getAppContext(), R.drawable.u1);
        } else {
            if (SkinManagerNew.b().f()) {
            }
            imageView = this.g;
            drawable = AppCompatResources.getDrawable(ContextHolder.getAppContext(), R.drawable.tz);
        }
        imageView.setBackground(drawable);
    }

    public void p() {
        ImageView imageView = this.h;
        if (imageView != null) {
            imageView.setVisibility(0);
        }
        q();
        this.f.d(false);
        this.f.l = false;
    }

    private void q() {
        if (this.i.getParent() != null) {
            ((ViewGroup) this.i.getParent()).removeView(this.i);
        }
    }

    @Override
    public String a() {
        IFastCutItem iFastCutItem = this.f39944b;
        return iFastCutItem == null ? "" : iFastCutItem.getFastCutId();
    }

    @Override
    public void a(int i) {
        this.f39944b.setSortNum(i);
    }

    public void a(IFastCutItem iFastCutItem, boolean z, int i, XHomeFastCutPanelView xHomeFastCutPanelView) {
        this.f39944b = iFastCutItem;
        this.f39946d = z;
        this.e = i;
        this.f = xHomeFastCutPanelView;
    }

    protected void a(DialogBase dialogBase, String str) {
        FastCutReportHelper.b(str, "0", this.f39944b);
        FastCutReportHelper.b(dialogBase, str, "0", this.f39944b);
    }

    public void a(boolean z) {
        ImageView imageView;
        Context appContext;
        int i;
        if (this.g == null) {
            return;
        }
        if (z) {
            if (this.e == FastCutManager.f39531a) {
                n();
                return;
            } else {
                imageView = this.g;
                appContext = ContextHolder.getAppContext();
                i = R.drawable.u2;
            }
        } else if (this.e == FastCutManager.f39531a) {
            o();
            return;
        } else {
            imageView = this.g;
            appContext = ContextHolder.getAppContext();
            i = R.drawable.tz;
        }
        imageView.setBackground(AppCompatResources.getDrawable(appContext, i));
    }

    public boolean a(View view) {
        if (this.f39944b.getFastCutDeepLink().equals("qb://no_history")) {
            if (PublicSettingManager.a().e()) {
                ((IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class)).switchNoHistoryMode(false);
            } else {
                ((IPageToolBoxService) QBContext.getInstance().getService(IPageToolBoxService.class)).switchNoHistoryMode(true);
            }
            bindDataToView(view);
            return true;
        }
        if (!this.f39944b.getFastCutDeepLink().equals("qb://darkmode")) {
            return false;
        }
        FastCutReportHelper.a(this.f39944b, this.e);
        ((IMenuService) QBContext.getInstance().getService(IMenuService.class)).showSkinSwitchDialog();
        return true;
    }

    @Override
    public View b() {
        return this.j;
    }

    protected void b(DialogBase dialogBase, String str) {
        FastCutReportHelper.b(this.f39944b, "0", str);
        a(dialogBase, str);
        if (FastCutManager.getInstance().a(this.f39944b, this.e == FastCutManager.f39531a, false)) {
            return;
        }
        MttToaster.show("移除失败,稍后再试", 0);
    }

    @Override
    public void bindDataToView(View view) {
        IFastCutItem iFastCutItem;
        String str;
        if (this.f39944b == null) {
            return;
        }
        this.j = view;
        b(view);
        ViewPressAlphaHelper.a(view);
        if (!this.f39946d) {
            view.setAlpha(1.0f);
        }
        if (this.e != FastCutManager.f39531a) {
            if (this.e == FastCutManager.f39532b) {
                iFastCutItem = this.f39944b;
                str = "1";
            }
            TextView textView = (TextView) view.findViewById(R.id.tv_content);
            QBWebImageView qBWebImageView = (QBWebImageView) view.findViewById(R.id.iv_content);
            TextView textView2 = (TextView) view.findViewById(R.id.tv_fast_cut_name);
            ImageView imageView = (ImageView) view.findViewById(R.id.iv_delete_fast_cut);
            this.h = (ImageView) view.findViewById(R.id.iv_big_item);
            ViewPressAlphaHelper.a(imageView);
            this.g = (ImageView) view.findViewById(R.id.iv_item_bkg);
            a(imageView);
            a(imageView, MttResources.s(15));
            a(qBWebImageView, textView, this.h);
            c(textView2);
            j();
            i();
            if (SkinManagerNew.b().g()) {
                textView.setAlpha(1.0f);
            } else {
                textView.setAlpha(0.4f);
            }
            if (!this.f39946d) {
                view.setOnLongClickListener(this);
            }
            view.setOnClickListener(this.f39945c);
            SimpleSkinManager.a().a(view, true);
            if (XHomeFeatUtil.a()) {
                if (this.e == FastCutManager.f39531a) {
                    a(textView2);
                    return;
                } else {
                    textView2.setTextColor(MttResources.d(R.color.theme_common_color_a3));
                    return;
                }
            }
            return;
        }
        iFastCutItem = this.f39944b;
        str = "0";
        FastCutReportHelper.a("100107", view, iFastCutItem, "", str);
        TextView textView3 = (TextView) view.findViewById(R.id.tv_content);
        QBWebImageView qBWebImageView2 = (QBWebImageView) view.findViewById(R.id.iv_content);
        TextView textView22 = (TextView) view.findViewById(R.id.tv_fast_cut_name);
        ImageView imageView2 = (ImageView) view.findViewById(R.id.iv_delete_fast_cut);
        this.h = (ImageView) view.findViewById(R.id.iv_big_item);
        ViewPressAlphaHelper.a(imageView2);
        this.g = (ImageView) view.findViewById(R.id.iv_item_bkg);
        a(imageView2);
        a(imageView2, MttResources.s(15));
        a(qBWebImageView2, textView3, this.h);
        c(textView22);
        j();
        i();
        if (SkinManagerNew.b().g()) {
        }
        if (!this.f39946d) {
        }
        view.setOnClickListener(this.f39945c);
        SimpleSkinManager.a().a(view, true);
        if (XHomeFeatUtil.a()) {
        }
    }

    @Override
    public int c() {
        return 0;
    }

    @Override
    public View createItemView(Context context) {
        LayoutInflater from;
        int i;
        View view;
        ViewGroup.LayoutParams layoutParams;
        int i2;
        if (this.e != FastCutManager.f39532b && this.e != FastCutManager.f39534d) {
            view = (BootFeatureToggle.h() || BootFeatureToggle.i()) ? LayoutInflaterCacheManager.a().a(f39943a) : null;
            if (view == null) {
                from = LayoutInflater.from(context);
                i = f39943a;
            }
            QBWebImageView qBWebImageView = (QBWebImageView) view.findViewById(R.id.iv_content);
            if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_A_869427113)) {
                if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_B_869427113)) {
                    layoutParams = qBWebImageView.getLayoutParams();
                    i2 = 36;
                }
                qBWebImageView.setEnableNoPicMode(false);
                return view;
            }
            layoutParams = qBWebImageView.getLayoutParams();
            i2 = 33;
            layoutParams.height = MttResources.s(i2);
            layoutParams.width = MttResources.s(i2);
            qBWebImageView.setLayoutParams(layoutParams);
            qBWebImageView.setEnableNoPicMode(false);
            return view;
        }
        from = LayoutInflater.from(context);
        i = R.layout.j3;
        view = from.inflate(i, (ViewGroup) null, false);
        QBWebImageView qBWebImageView2 = (QBWebImageView) view.findViewById(R.id.iv_content);
        if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_A_869427113)) {
        }
        layoutParams.height = MttResources.s(i2);
        layoutParams.width = MttResources.s(i2);
        qBWebImageView2.setLayoutParams(layoutParams);
        qBWebImageView2.setEnableNoPicMode(false);
        return view;
    }

    @Override
    public int d() {
        return MttResources.s(5);
    }

    @Override
    public boolean e() {
        return this.e == FastCutManager.f39531a;
    }

    @Override
    public int f() {
        return this.f39944b.getSortNum();
    }

    public void g() {
        FastcutRecentItemGroupView fastcutRecentItemGroupView = this.i;
        if (fastcutRecentItemGroupView != null) {
            if (fastcutRecentItemGroupView.c()) {
                this.i.b();
            } else {
                q();
            }
        }
    }

    @Override
    public int getBottomMargin(int i) {
        if (this.e != FastCutManager.f39531a || getPosition() / 5 <= 0) {
            return XHomeFastCutPanelView.f39761d;
        }
        return 0;
    }

    @Override
    public long getItemId() {
        return this.f39944b.getFastCutDeepLink().hashCode();
    }

    @Override
    public RecyclerView.LayoutParams getLayoutParams(RecyclerView.LayoutParams layoutParams, int i, int i2) {
        RecyclerView.LayoutParams layoutParams2 = super.getLayoutParams(layoutParams, i, i2);
        layoutParams2.width = XHomeFastCutPanelView.f39758a;
        layoutParams2.height = XHomeFastCutPanelView.f39759b;
        return layoutParams2;
    }

    @Override
    public int getLeftMargin(int i) {
        return this.e == FastCutManager.f39532b ? ItemLocation.b(i) ? MttResources.s(12) : XHomeFastCutPanelView.h : XHomeFastCutPanelView.g;
    }

    @Override
    public int getRightMargin(int i) {
        return this.e == FastCutManager.f39532b ? ItemLocation.a(i) ? MttResources.s(12) : XHomeFastCutPanelView.h : XHomeFastCutPanelView.g;
    }

    public boolean h() {
        FastcutRecentItemGroupView fastcutRecentItemGroupView;
        if (!TextUtils.equals("qb://short_frequently_used", this.f39944b.getFastCutDeepLink()) || (fastcutRecentItemGroupView = this.i) == null || !fastcutRecentItemGroupView.c() || this.i.getParent() == null) {
            return false;
        }
        g();
        return true;
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        super.onClick(view);
        if (view.getId() == R.id.iv_delete_fast_cut) {
            String str = this.e == FastCutManager.f39531a ? "0" : "1";
            boolean z = PublicSettingManager.a().getBoolean("fastcut_frequent_use_delete_dialog", false);
            if (!TextUtils.equals("qb://short_frequently_used", this.f39944b.getFastCutDeepLink()) || z) {
                b(null, str);
            } else {
                PublicSettingManager.a().setBoolean("fastcut_frequent_use_delete_dialog", true);
                a(str, "删除后可通过\"发现面板—特色服务\"找回直达");
            }
        }
        EventCollector.getInstance().onViewClicked(view);
    }
}