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

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


package com.tencent.mtt.file.page.filepickpage.homepage;

import android.graphics.Rect;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.RelativeSizeSpan;
import android.view.View;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.FrameLayout;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.browser.file.recyclerbin.RecyclerBinSize;
import com.tencent.mtt.browser.file.recyclerbin.RecyclerBinStat;
import com.tencent.mtt.browser.file.recyclerbin.guide.FirstRecycledRecord;
import com.tencent.mtt.browser.intent.facade.IShortcutInstallerService;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.external.reader.ReaderFileCreator;
import com.tencent.mtt.external.setting.util.FeedBackUrlHelper;
import com.tencent.mtt.file.page.homepage.content.userguide.HomeBigBubbleData;
import com.tencent.mtt.file.page.homepage.content.userguide.HomeUserGuideFactory;
import com.tencent.mtt.file.page.search.page.FileSearchJumper;
import com.tencent.mtt.file.page.statistics.FileStatHelper;
import com.tencent.mtt.file.pagecommon.filepick.base.IFileTopNormalBar;
import com.tencent.mtt.file.pagecommon.utils.FileCommonUtils;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.newskin.badgeview.BadgeHelper;
import com.tencent.mtt.nxeasy.page.AppEventHandler;
import com.tencent.mtt.nxeasy.page.EasyPageContext;
import com.tencent.mtt.nxeasy.pageview.EasyTitleBarLayout;
import com.tencent.mtt.nxeasy.pageview.OnBackClickListener;
import com.tencent.mtt.nxeasy.uibase.EasyPageTitleView;
import com.tencent.mtt.nxeasy.uibase.HighLightMaskView;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.tool.FilePreferenceManager;
import com.tencent.mtt.view.common.QBImageTextView;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.dialog.popmenu.QBPopupMenu;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import qb.a.d;
import qb.a.e;

public class FilePickHomeTitleBar extends EasyTitleBarLayout implements View.OnClickListener, IFileTopNormalBar {

    static final int f60949a = MttResources.s(24);
    public static final int g = R.id.file_home_right_top_menu;

    EasyPageTitleView f60950b;

    QBFrameLayout f60951c;

    QBImageView f60952d;
    QBPopupMenu e;
    protected EasyPageContext f;
    boolean h;
    FileSearchJumper i;
    private HomeBigBubbleData j;
    private boolean k;
    private boolean l;

    public FilePickHomeTitleBar(EasyPageContext easyPageContext) {
        super(easyPageContext.f68800c);
        this.f60950b = null;
        this.k = true;
        this.l = false;
        this.i = null;
        this.f = easyPageContext;
        g();
    }

    private void a(AnimationSet animationSet) {
        final QBImageTextView a2 = this.e.a(11, "回收站", this, animationSet);
        a2.setText("回收站");
        a(a2, false);
        new RecyclerBinSize().a(new RecyclerBinSize.SizeResult() {
            private SpannableString a(String str) {
                if (TextUtils.isEmpty(str)) {
                    return new SpannableString("回收站");
                }
                SpannableString spannableString = new SpannableString("回收站" + str);
                spannableString.setSpan(new RelativeSizeSpan(0.8f), 3, str.length() + 3, 17);
                return spannableString;
            }

            @Override
            public void a(long j) {
                String str;
                if (j <= 0) {
                    str = "";
                } else {
                    str = "(" + StringUtils.b((float) j, 0) + ")";
                }
                boolean z = str.length() >= 7;
                a2.mQBTextView.setTextSize(1, z ? 14.0f : 16.0f);
                a2.setText(a(str));
                FilePickHomeTitleBar.this.a(a2, z);
            }
        });
    }

    public void a(final QBImageTextView qBImageTextView, final boolean z) {
        if (l()) {
            qBImageTextView.post(new Runnable() {
                @Override
                public void run() {
                    BadgeHelper.a(FilePickHomeTitleBar.this.e.c()).b((qBImageTextView.getRight() - qBImageTextView.mQBTextView.getRight()) - (z ? 0 : MttResources.s(2))).a(MttResources.s(z ? 78 : 82)).a("");
                }
            });
        }
    }

    public static boolean a() {
        return false;
    }

    private void g() {
        this.i = new FileSearchJumper(this.f, -1);
        a(this.i.a(), MttResources.s(56));
        this.f60950b = new EasyPageTitleView(getContext());
        this.f60950b.setGravity(17);
        this.f60950b.setText("文件管理");
        setMiddleView(this.f60950b);
        this.f60951c = new QBFrameLayout(getContext());
        this.f60951c.setId(R.id.file_home_right_top_menu);
        this.f60951c.setOnClickListener(this);
        this.f60952d = new QBImageView(getContext());
        n();
        this.f60952d.setImageNormalPressDisableIds(R.drawable.bd0, e.f85871a, 0, R.color.theme_common_color_b1, 0, 45);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(f60949a + MttResources.s(8), f60949a);
        this.f60952d.setPadding(0, 0, MttResources.s(8), 0);
        layoutParams.gravity = 1;
        layoutParams.topMargin = MttResources.s(21);
        this.f60951c.addView(this.f60952d, layoutParams);
        b(this.f60951c, MttResources.s(56));
    }

    public void h() {
        QBPopupMenu qBPopupMenu = this.e;
        if (qBPopupMenu == null || !qBPopupMenu.isShowing()) {
            return;
        }
        this.e.dismiss();
    }

    private boolean i() {
        return FirstRecycledRecord.a().b();
    }

    private boolean j() {
        return FilePreferenceManager.a().getBoolean("FILE_MORE_BTN_SHOW_RED_POT", true) && i();
    }

    private void k() {
        if (i()) {
            FilePreferenceManager.a().setBoolean("FILE_MORE_BTN_SHOW_RED_POT", false);
        }
    }

    private boolean l() {
        return FilePreferenceManager.a().getBoolean("FILE_RECYCLER_BIN_SHOW_RED_POT", true) && i();
    }

    private void m() {
        if (i()) {
            FilePreferenceManager.a().setBoolean("FILE_RECYCLER_BIN_SHOW_RED_POT", false);
        }
    }

    private void n() {
        QBFrameLayout qBFrameLayout;
        if (!j() || (qBFrameLayout = this.f60951c) == null) {
            return;
        }
        qBFrameLayout.post(new Runnable() {
            @Override
            public void run() {
                int top = FilePickHomeTitleBar.this.f60952d.getTop() - MttResources.s(4);
                BadgeHelper.a(FilePickHomeTitleBar.this.f60951c).a(top).b((FilePickHomeTitleBar.this.f60951c.getWidth() - FilePickHomeTitleBar.this.f60952d.getRight()) + MttResources.s(3)).a("");
            }
        });
    }

    public void a(int i) {
        AnimationSet animationSet;
        if (i > 0) {
            animationSet = new AnimationSet(true);
            ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 1.2f, 1.0f, 1.2f, 1, 0.5f, 1, 0.5f);
            scaleAnimation.setDuration(200L);
            scaleAnimation.setInterpolator(new DecelerateInterpolator(1.0f));
            animationSet.addAnimation(scaleAnimation);
            ScaleAnimation scaleAnimation2 = new ScaleAnimation(1.2f, 1.0f, 1.2f, 1.0f, 1, 0.5f, 1, 0.5f);
            scaleAnimation2.setDuration(300L);
            animationSet.addAnimation(scaleAnimation2);
        } else {
            animationSet = null;
        }
        this.e = new QBPopupMenu(getContext(), false, false);
        this.e.a(2, "私密空间", this, 2 == i ? animationSet : null);
        a(11 == i ? animationSet : null);
        this.e.b(5, "帮助与反馈", this);
        if (a()) {
            this.e.b(8, "安装桌面入口", this);
        }
        this.e.b(53);
        this.e.c(MttResources.s(32));
        this.e.show();
        StatManager.b().c("BHD116");
        StatManager.b().c("BMMP0032");
        this.h = i > 0;
    }

    public void a(HomeBigBubbleData homeBigBubbleData) {
        this.j = homeBigBubbleData;
        a(0);
        BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
            @Override
            public void run() {
                if (!FilePickHomeTitleBar.this.k) {
                    FilePickHomeTitleBar.this.h();
                    FilePickHomeTitleBar.this.l = true;
                    return;
                }
                View findViewById = FilePickHomeTitleBar.this.e.findViewById(2);
                if (findViewById == null) {
                    return;
                }
                Rect rect = new Rect();
                rect.left = (DeviceUtils.af() - FilePickHomeTitleBar.this.e.c().getWidth()) + findViewById.getLeft();
                rect.right = rect.left + findViewById.getWidth();
                rect.top = BaseSettings.a().m() + FilePickHomeTitleBar.this.getHeight();
                rect.bottom = rect.top + findViewById.getHeight();
                HighLightMaskView a2 = HomeUserGuideFactory.a(FilePickHomeTitleBar.this.j, findViewById, FilePickHomeTitleBar.this.f);
                a2.setFocusRect(rect);
                a2.c();
            }
        });
    }

    void b() {
        k();
        QBFrameLayout qBFrameLayout = this.f60951c;
        if (qBFrameLayout != null) {
            BadgeHelper.a(qBFrameLayout).b();
        }
        this.e = new QBPopupMenu(getContext(), false, false);
        this.e.b(2, "私密空间", this);
        a((AnimationSet) null);
        this.e.b(5, "帮助与反馈", this);
        if (a()) {
            this.e.b(8, "安装桌面入口", this);
        }
        if (FileCommonUtils.a("FILE_READER_NEW_DOC_SWITCH")) {
            this.e.b(9, "新建DOC", this);
            this.e.b(10, "新建EXCEL", this);
        }
        this.e.b(53);
        this.e.c(MttResources.s(32));
        this.e.show();
        StatManager.b().c("BHD116");
        StatManager.b().c("BHD121");
        this.h = false;
    }

    public void c() {
        this.k = true;
        n();
        if (this.l) {
            a(this.j);
        }
    }

    public void d() {
        h();
        this.k = false;
    }

    public QBFrameLayout getMoreBtn() {
        return this.f60951c;
    }

    @Override
    public View getView() {
        return this;
    }

    @Override
    public int getViewHeight() {
        return MttResources.s(48);
    }

    @Override
    public void onClick(View view) {
        ReaderFileCreator a2;
        String str;
        int id;
        FileStatHelper a3;
        String str2;
        String str3;
        String str4;
        EventCollector.getInstance().onViewClickedBefore(view);
        h();
        if (view.getId() == R.id.file_home_right_top_menu) {
            b();
        } else {
            if (view.getId() == 9) {
                a2 = ReaderFileCreator.a();
                str = "doc";
            } else {
                if (view.getId() == 10) {
                    a2 = ReaderFileCreator.a();
                    str = "xls";
                }
                id = view.getId();
                if (id == 2) {
                    if (id == 3) {
                        this.f.f68798a.a(new UrlParams("qb://filesdk/setting/main"));
                        StatManager.b().c("BHD124");
                        a3 = FileStatHelper.a();
                        str2 = this.f.g;
                        str3 = this.f.h;
                        str4 = "click_settings";
                    } else if (id == 5) {
                        if (MttResources.a(d.f85870a)) {
                            this.f.f68798a.a(new UrlParams(UrlUtils.addParamsToUrl("qb://filesdk/webview", "pageurl=" + UrlUtils.encode(AppEventHandler.a().b().b()))));
                        } else {
                            ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(FeedBackUrlHelper.a("https://bbs.mb.qq.com/mobilefb/fbList?tid=fcf4391d-4b0b-431e-b2f1-5fb27a924445&ttype=0&tname=%E6%96%87%E4%BB%B6")));
                        }
                        FileStatHelper.a().b("click_feedback", this.f.g, this.f.h);
                    } else if (id == 11) {
                        m();
                        this.f.f68798a.a(new UrlParams("qb://filesdk/recyclerbin/list"));
                        new RecyclerBinStat(this.f).a();
                    } else if (id == 7) {
                        this.f.f68798a.a(new UrlParams("qb://filesdk/search"));
                        StatManager.b().c("BHD117");
                        a3 = FileStatHelper.a();
                        str2 = this.f.g;
                        str3 = this.f.h;
                        str4 = "click_search";
                    } else if (id == 8) {
                        StatManager.b().c("BMSY266");
                        if (a()) {
                            ((IShortcutInstallerService) QBContext.getInstance().getService(IShortcutInstallerService.class)).showAddShortcutDlg(6, 3);
                        } else {
                            MttToaster.show("快捷方式已经添加到桌面。", 0);
                        }
                    }
                    a3.b(str4, str2, str3);
                } else {
                    Logs.c("FilePickHomeTitleBar", "[ID855969291] onClick item=私密空间");
                    this.f.f68798a.a(new UrlParams("qb://filesdk/secret"));
                    StatManager.b().c("BHD123");
                    FileStatHelper.a().b("click_secret", this.f.g, this.f.h);
                    if (this.h) {
                        StatManager.b().c("BMMP0033");
                    }
                }
            }
            a2.a(str);
            id = view.getId();
            if (id == 2) {
            }
        }
        EventCollector.getInstance().onViewClicked(view);
    }

    @Override
    public void setOnBackClickListener(OnBackClickListener onBackClickListener) {
    }
}