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

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


package com.tencent.mtt.browser.download.business.ui;

import android.R;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.ScrollView;
import com.tencent.common.data.MediaFileType;
import com.tencent.common.featuretoggle.FeatureToggle;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.manifest.annotation.CreateMethod;
import com.tencent.common.manifest.annotation.EventReceiver;
import com.tencent.common.task.Continuation;
import com.tencent.common.task.QBTask;
import com.tencent.common.utils.StringUtils;
import com.tencent.common.utils.UrlUtils;
import com.tencent.midas.comm.log.util.APLogFileUtil;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.appinfo.AppInfoQuery;
import com.tencent.mtt.appinfo.MobileAssist.ApkAllData;
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.stat.utils.PlatformStatUtils;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.base.utils.PackageUtils;
import com.tencent.mtt.base.wup.DomainListDataManager;
import com.tencent.mtt.base.wup.PreferenceData;
import com.tencent.mtt.browser.bra.addressbar.AddressBarDataSource;
import com.tencent.mtt.browser.download.business.core.BusinessDownloadService;
import com.tencent.mtt.browser.download.business.core.BusinessDownloadUserManager;
import com.tencent.mtt.browser.download.business.core.DownloadBussinesController;
import com.tencent.mtt.browser.download.business.core.DownloadInfoCacheUtils;
import com.tencent.mtt.browser.download.business.core.DownloadOperationManager;
import com.tencent.mtt.browser.download.business.core.ThreadUtils;
import com.tencent.mtt.browser.download.business.core.YYBDownloadManager;
import com.tencent.mtt.browser.download.business.report.DownloadStatUtils;
import com.tencent.mtt.browser.download.business.utils.DownloadInstallStatUtils;
import com.tencent.mtt.browser.download.core.facade.IBusinessDownloadService;
import com.tencent.mtt.browser.download.core.facade.OverwritePolicy;
import com.tencent.mtt.browser.download.core.facade.ResultCallback;
import com.tencent.mtt.browser.download.core.impl.DownloadServiceManager;
import com.tencent.mtt.browser.download.engine.DownloadInfo;
import com.tencent.mtt.browser.download.engine.DownloadTask;
import com.tencent.mtt.browser.download.engine.utils.DLMttFileUtils;
import com.tencent.mtt.browser.file.facade.IFileOpenManager;
import com.tencent.mtt.browser.security.datastruct.SecurityLevel;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.external.market.facade.IMarketService;
import com.tencent.mtt.external.reader.IReader;
import com.tencent.mtt.hippy.qb.modules.appdownload.HippyAppConstants;
import com.tencent.mtt.hippy.qb.views.HippyQBViewTouchAndDrawData;
import com.tencent.mtt.log.access.Logs;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.resource.UIResourceDimen;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.uifw2.base.resource.QBResource;
import com.tencent.mtt.video.browser.export.constant.StatVideoConsts;
import com.tencent.mtt.view.common.QBImageTextView;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.common.QBView;
import com.tencent.mtt.view.dialog.newui.SimpleDialogBuilder;
import com.tencent.mtt.view.dialog.newui.builder.api.ICustomDialogBuilder;
import com.tencent.mtt.view.dialog.newui.dialog.DialogBase;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.layout.QBRelativeLayout;
import com.tencent.mtt.welfare.facade.IPendantService;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.tencent.tar.Config;
import com.tencent.tmassistantsdk.CallYYB;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import qb.a.e;
import qb.a.f;
import qb.download.business.BuildConfig;

public class QBSimpleSafetyDownloadSheet implements DialogInterface.OnDismissListener {
    private boolean B;

    JSONObject f37143a;

    Context f37146d;
    DownloadInfo e;
    String f;
    boolean g;
    String h;
    QBTextView l;
    public SecurityLevel m;
    QBTextView p;
    QBTextView q;
    private DownloadTextConfig t;
    private boolean u;
    private boolean v;
    private boolean w;
    private int x;
    private boolean y;
    private DialogBase z;

    boolean f37144b = false;

    boolean f37145c = false;
    boolean i = false;
    public boolean j = false;
    boolean k = false;
    private final String[] A = new String[2];
    private boolean C = false;
    private DownloadTask D = null;
    String n = "";
    String o = "";
    boolean r = false;
    private boolean E = false;
    private final String s = DownloadStatUtils.a();

    public static class DownloadTextConfig {

        String f37167a;

        String f37168b;

        String f37169c;

        String f37170d;
        String e;
        String f;
        String g;
    }

    public QBSimpleSafetyDownloadSheet(Context context, DownloadInfo downloadInfo, boolean z, DownloadTextConfig downloadTextConfig) {
        this.g = true;
        this.h = "";
        this.v = false;
        this.w = false;
        this.x = 0;
        this.f37146d = context;
        this.e = downloadInfo;
        this.g = z;
        this.h = this.e.f37606c;
        if (TextUtils.isEmpty(this.h)) {
            this.h = UrlUtils.guessFileName(this.e.f37604a, null, null);
        }
        DownloadInfo downloadInfo2 = this.e;
        downloadInfo2.f37606c = this.h;
        this.f = downloadInfo2.G;
        this.v = !TextUtils.isEmpty(this.e.g);
        Map<String, String> map = this.e.C;
        String str = map != null ? map.get(IPendantService.BUSINESS_ID) : "";
        this.w = TextUtils.equals(str, "8");
        if (!TextUtils.isEmpty(str)) {
            try {
                this.x = Integer.parseInt(str);
            } catch (Exception unused) {
            }
        }
        if (downloadTextConfig != null) {
            this.t = downloadTextConfig;
            this.u = true;
        } else {
            h();
        }
        this.B = PackageUtils.b(ContextHolder.getAppContext(), "com.tencent.android.qqdownloader") >= 7042130;
        d();
        e();
    }

    public StateListDrawable a(float f, float f2, int i, int i2, int i3) {
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setStroke((int) MttResources.a(f), MttResources.c(i));
        gradientDrawable.setCornerRadius(f2);
        GradientDrawable gradientDrawable2 = new GradientDrawable();
        gradientDrawable2.setStroke((int) MttResources.a(f), MttResources.c(i2));
        gradientDrawable2.setCornerRadius(f2);
        GradientDrawable gradientDrawable3 = new GradientDrawable();
        gradientDrawable3.setStroke((int) MttResources.a(f), MttResources.c(i3));
        gradientDrawable3.setCornerRadius(f2);
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[]{-16842910}, gradientDrawable3);
        stateListDrawable.addState(new int[]{R.attr.state_pressed, R.attr.state_enabled}, gradientDrawable2);
        stateListDrawable.addState(new int[0], gradientDrawable);
        return stateListDrawable;
    }

    private void a(LinearLayout linearLayout) {
        final FrameLayout frameLayout;
        if (linearLayout == null || (frameLayout = (FrameLayout) linearLayout.findViewById(com.tencent.mtt.R.id.secondButtonBorderLayout)) == null) {
            return;
        }
        frameLayout.post(new Runnable() {
            @Override
            public void run() {
                frameLayout.setBackgroundDrawable(QBSimpleSafetyDownloadSheet.this.a(1.0f, frameLayout.getHeight() / 2.0f, com.tencent.mtt.R.color.new_dialog_second_button_border_blue, com.tencent.mtt.R.color.new_dialog_second_button_border_blue, com.tencent.mtt.R.color.new_dialog_second_button_border_disable));
            }
        });
    }

    private void a(DownloadTextConfig downloadTextConfig, boolean z) {
        if (downloadTextConfig == null) {
            downloadTextConfig = new DownloadTextConfig();
        }
        if (TextUtils.isEmpty(downloadTextConfig.f37167a)) {
            downloadTextConfig.f37167a = z ? "普通下载" : "直接下载";
        }
        if (TextUtils.isEmpty(downloadTextConfig.f37168b)) {
            downloadTextConfig.f37168b = "腾讯应用宝下载(防拦截)";
        }
        if (TextUtils.isEmpty(downloadTextConfig.f37169c)) {
            downloadTextConfig.f37169c = "正在下载应用宝";
        }
        this.t = downloadTextConfig;
    }

    private void a(DownloadInfo downloadInfo) {
        DownloadTask downloadTaskByUrl;
        if (downloadInfo == null || (downloadTaskByUrl = DownloadServiceManager.a().getDownloadTaskByUrl(downloadInfo.f37604a)) == null) {
            return;
        }
        boolean z = false;
        PageFrame s = WindowManager.a().s();
        if (s != null && !TextUtils.isEmpty(s.getCurrentUrl()) && s.getCurrentUrl().startsWith("qb://pagedownload/downloadpage")) {
            String urlParamValue = UrlUtils.getUrlParamValue(s.getCurrentUrl(), "down:task_id");
            if (!TextUtils.isEmpty(urlParamValue)) {
                if (urlParamValue.equalsIgnoreCase(downloadTaskByUrl.i() + "")) {
                    z = true;
                }
            }
        }
        if (z) {
            return;
        }
        UrlParams urlParams = new UrlParams(UrlUtils.addParamsToUrl(UrlUtils.addParamsToUrl("qb://pagedownload/downloadpage", "pagefrom=yyb_dlyyb"), "shouldRestartTask=false"));
        urlParams.a(downloadInfo);
        urlParams.d(true);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
    }

    private void a(QBLinearLayout qBLinearLayout) {
        String str;
        if (FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_YYB_869857211)) {
            d(qBLinearLayout);
            str = "SAFETY_DOWNLOAD_SHEET_YYB_869857211_ON";
        } else {
            c(qBLinearLayout);
            str = "SAFETY_DOWNLOAD_SHEET_YYB_869857211_OFF";
        }
        PlatformStatUtils.a(str);
    }

    private void a(QBLinearLayout qBLinearLayout, String str) {
        QBFrameLayout qBFrameLayout = new QBFrameLayout(this.f37146d);
        qBFrameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, MttResources.h(f.T)));
        qBFrameLayout.setBackgroundColor(MttResources.d(e.H));
        QBImageTextView qBImageTextView = new QBImageTextView(this.f37146d);
        qBImageTextView.setDistanceBetweenImageAndText(MttResources.s(4));
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.gravity = 17;
        qBImageTextView.setImageNormalIds(com.tencent.mtt.R.drawable.bio);
        qBImageTextView.setLayoutParams(layoutParams);
        qBImageTextView.setText(str);
        qBImageTextView.setTextSize(MttResources.f(f.cD));
        qBImageTextView.mQBTextView.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        qBFrameLayout.addView(qBImageTextView);
        int a2 = UIResourceDimen.a(8.0f);
        QBImageView qBImageView = new QBImageView(this.f37146d);
        qBImageView.setContentDescription("关闭");
        qBImageView.setScaleType(ImageView.ScaleType.CENTER);
        qBImageView.setImageSize(MttResources.s(8), MttResources.s(8));
        qBImageView.setImageDrawable(QBResource.c(com.tencent.mtt.R.drawable.afh));
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(MttResources.s(8) + (a2 * 2), -1);
        layoutParams2.gravity = 53;
        layoutParams2.rightMargin = MttResources.s(15);
        qBImageView.setLayoutParams(layoutParams2);
        qBImageView.setPadding(a2, a2, a2, a2);
        qBImageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(false);
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBFrameLayout.addView(qBImageView);
        qBLinearLayout.addView(qBFrameLayout);
    }

    private void a(String str, String str2) {
        JSONObject jSONObject = this.f37143a;
        if (jSONObject != null) {
            try {
                jSONObject.put(str, str2);
            } catch (JSONException unused) {
            }
            ((IMarketService) QBContext.getInstance().getService(IMarketService.class)).downloadReportToNormalReport(this.f37143a);
        }
    }

    private void a(boolean z, int i, boolean z2, boolean z3) {
        if (!this.w && this.x != 0 && !z) {
            DownloadInstallStatUtils.a(7);
            DownloadOperationManager.a(this.h, this.f);
        } else {
            DownloadInstallStatUtils.a(6);
            if (DownloadServiceManager.a().tryJumpToFullDownloadPage(this.e, this.u ? "yyb_apk" : "web_apk", false)) {
                return;
            }
            a(i == 1 && z2, z3, z);
        }
    }

    private void a(boolean z, boolean z2, boolean z3) {
        String str;
        int indexOf;
        String str2;
        Bundle bundle = new Bundle();
        bundle.putBoolean("relaShouleShow", z);
        PublicSettingManager a2 = PublicSettingManager.a();
        int intValue = a2.a("ANDROID_DOWNLOAD_BUSINESS_RELATIVE_DIALOG", 1).intValue();
        boolean z4 = (a2.getString("ANDROID_PUBLIC_PREFS_DOWNLOAD_BUSINESS_RELATIVE_DIALOG_TBS", "0").equals("1") || !this.f37145c) && this.f37144b;
        if (intValue == 1 && this.e != null && z4) {
            AddressBarDataSource currentBarDataSource = (WindowManager.a() == null || WindowManager.a().s() == null) ? null : WindowManager.a().s().getBussinessProxy().getCurrentBarDataSource();
            String str3 = currentBarDataSource != null ? currentBarDataSource.f35821b : "";
            if (TextUtils.isEmpty(this.h)) {
                if (TextUtils.isEmpty(this.e.f37606c)) {
                    str = "应用";
                } else {
                    indexOf = this.h.indexOf(".apk");
                    if (indexOf > 0) {
                        str2 = this.e.f37606c;
                        str = str2.substring(0, indexOf);
                    } else {
                        str = this.e.f37606c;
                    }
                }
                bundle.putString("relaFileName", str);
                bundle.putString("relaUrl", str3);
                bundle.putString("relaPackageName", this.e.g);
                bundle.putBoolean("relaFromTBS", this.f37145c);
            } else {
                indexOf = this.h.indexOf(".apk");
                if (indexOf > 0) {
                    str2 = this.h;
                    str = str2.substring(0, indexOf);
                    bundle.putString("relaFileName", str);
                    bundle.putString("relaUrl", str3);
                    bundle.putString("relaPackageName", this.e.g);
                    bundle.putBoolean("relaFromTBS", this.f37145c);
                } else {
                    str = this.h;
                    bundle.putString("relaFileName", str);
                    bundle.putString("relaUrl", str3);
                    bundle.putString("relaPackageName", this.e.g);
                    bundle.putBoolean("relaFromTBS", this.f37145c);
                }
            }
        }
        bundle.putInt("filefromwhere", 8);
        bundle.putString("down:key_from_scene", z2 ? z3 ? "cancel" : "Re_Download" : "download_Popup");
        bundle.putString("down:action_id", this.s);
        UrlParams urlParams = new UrlParams("qb://pagedownload/downloadhomepage");
        urlParams.a(bundle);
        urlParams.d(true);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(urlParams);
    }

    private String b(boolean z) {
        return this.A[!z ? 1 : 0];
    }

    private void b(QBLinearLayout qBLinearLayout) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.uo, (ViewGroup) null);
        a(linearLayout);
        ((QBTextView) linearLayout.findViewById(com.tencent.mtt.R.id.secondButtonTextView)).setText("普通下载");
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams.topMargin = MttResources.s(30);
        layoutParams.leftMargin = MttResources.s(30);
        layoutParams.rightMargin = MttResources.s(30);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet.this.b("DLPOP_0035");
                QBSimpleSafetyDownloadSheet.this.i();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout, layoutParams);
        QBTextView qBTextView = new QBTextView(this.f37146d);
        qBTextView.setTextColorNormalIds(e.g);
        qBTextView.setGravity(17);
        qBTextView.setText("普通下载可能存在安装环境被劫持,下载");
        qBTextView.setTextSize(MttResources.s(16));
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.topMargin = MttResources.s(23);
        qBLinearLayout.addView(qBTextView, layoutParams2);
        QBTextView qBTextView2 = new QBTextView(this.f37146d);
        qBTextView2.setTextColorNormalIds(e.g);
        qBTextView2.setGravity(17);
        qBTextView2.setText("失败等状况,建议安装应用宝下载此文件");
        qBTextView2.setTextSize(MttResources.s(16));
        qBLinearLayout.addView(qBTextView2, new LinearLayout.LayoutParams(-1, -2));
        LinearLayout linearLayout2 = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.un, (ViewGroup) null);
        ((QBTextView) linearLayout2.findViewById(com.tencent.mtt.R.id.mainButtonTextView)).setText((this.B ? "使用" : "下载") + "应用宝防拦截下载");
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams3.topMargin = MttResources.s(12);
        layoutParams3.leftMargin = MttResources.s(30);
        layoutParams3.rightMargin = MttResources.s(30);
        linearLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet.this.b("DLPOP_0034");
                QBSimpleSafetyDownloadSheet.this.c(false);
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout2, layoutParams3);
    }

    public void b(String str) {
        HashMap hashMap = new HashMap();
        hashMap.put(StatVideoConsts.KEY_DIALOG_STYLE, "new");
        DownloadStatUtils.a(str, (String) null, this.s, this.e, hashMap);
    }

    private void b(String str, String str2) {
        JSONObject jSONObject = this.f37143a;
        if (jSONObject != null) {
            try {
                jSONObject.put(str, str2);
            } catch (JSONException unused) {
            }
        }
    }

    private void b(boolean z, int i, boolean z2, boolean z3) {
        if (this.w || this.x == 0 || z) {
            DownloadInstallStatUtils.a(6);
            a(i == 1 && z2, z3, z);
        } else {
            DownloadInstallStatUtils.a(7);
            DownloadOperationManager.a(this.h, this.f);
        }
    }

    private void c(QBLinearLayout qBLinearLayout) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.uo, (ViewGroup) null);
        a(linearLayout);
        ((QBTextView) linearLayout.findViewById(com.tencent.mtt.R.id.secondButtonTextView)).setText("普通下载(有拦截风险)");
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams.topMargin = MttResources.s(12);
        layoutParams.leftMargin = MttResources.s(30);
        layoutParams.rightMargin = MttResources.s(30);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet.this.g = false;
                if (PublicSettingManager.a().getInt("ANDROID_PUBLIC_PREFS_TWICE_DOWNLOAD_SHEET_YYB", 0) == 1) {
                    synchronized (QBSimpleSafetyDownloadSheet.this) {
                        QBSimpleSafetyDownloadSheet.this.j = true;
                    }
                    QBSimpleSafetyDownloadSheet.this.b("DLPOP_0030");
                    QBSimpleSafetyDownloadSheet.this.b();
                } else {
                    QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                    qBSimpleSafetyDownloadSheet.b(qBSimpleSafetyDownloadSheet.u ? QBSimpleSafetyDownloadSheet.this.g ? "DLPOP_0030" : "DLPOP_0040" : "DLPOP_0025");
                    QBSimpleSafetyDownloadSheet.this.i();
                }
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout, layoutParams);
        QBTextView qBTextView = new QBTextView(this.f37146d);
        qBTextView.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        qBTextView.setGravity(17);
        qBTextView.setText("存在拦截风险,建议下载安装应用宝下载此文件");
        qBTextView.setTextSize(MttResources.s(14));
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.topMargin = MttResources.s(8);
        qBLinearLayout.addView(qBTextView, layoutParams2);
        LinearLayout linearLayout2 = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.un, (ViewGroup) null);
        ((QBTextView) linearLayout2.findViewById(com.tencent.mtt.R.id.mainButtonTextView)).setText((this.B ? "使用" : "下载") + "应用宝防拦截下载");
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams3.topMargin = MttResources.s(8);
        layoutParams3.leftMargin = MttResources.s(30);
        layoutParams3.rightMargin = MttResources.s(30);
        linearLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet.this.b("DLPOP_0029");
                QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                qBSimpleSafetyDownloadSheet.g = false;
                qBSimpleSafetyDownloadSheet.c(false);
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout2, layoutParams3);
    }

    public void c(boolean z) {
        StatManager b2;
        String str;
        StatManager b3;
        String str2;
        if (this.B) {
            b2 = StatManager.b();
            str = "BZWY502";
        } else if (this.v) {
            b2 = StatManager.b();
            str = !this.g ? "BZWY302" : "BZWY102";
        } else {
            b2 = StatManager.b();
            str = !this.g ? "BZWY402" : "BZWY202";
        }
        b2.c(str);
        if (this.B) {
            String str3 = this.v ? "ANDROID.QQBROWSER.DOWNLOADERSY" : "ANDROID.QQBROWSER.NAPKDOWNLOADERSY";
            j();
            String str4 = "tmast://download?via=" + str3 + "&downl_url=" + UrlUtils.encode(this.e.f37604a) + "&oplist=1;2";
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(Uri.parse(str4));
            intent.addFlags(268435456);
            this.i = true;
            try {
                DownloadInstallStatUtils.a(2);
                ContextHolder.getAppContext().startActivity(intent);
                if (this.v) {
                    b3 = StatManager.b();
                    str2 = !this.g ? "BZWY305" : "BZWY105";
                } else {
                    b3 = StatManager.b();
                    str2 = !this.g ? "BZWY405" : "BZWY205";
                }
                b3.c(str2);
            } catch (Exception unused) {
            }
            Logs.c("QBSimpleSafetyDownloadSheet", "[ID857155609] doYybDownload use_yyb_download url=" + str4);
            YYBDownloadManager.a().a(this.e, true);
            this.j = true;
            return;
        }
        IBusinessDownloadService a2 = DownloadServiceManager.a();
        File completedTaskFile = a2.getCompletedTaskFile(b(this.v));
        if (completedTaskFile != null) {
            IFileOpenManager iFileOpenManager = (IFileOpenManager) QBContext.getInstance().getService(IFileOpenManager.class);
            if (iFileOpenManager != null) {
                iFileOpenManager.openFile(completedTaskFile.getParent(), completedTaskFile.getName(), "", 11, null, null);
                return;
            }
            return;
        }
        if (z) {
            a();
        }
        if (this.C && this.D != null) {
            b("DLPOP_0038");
            this.C = false;
            return;
        }
        DownloadInfo downloadInfo = new DownloadInfo();
        DownloadTask downloadTask = this.D;
        if (downloadTask == null) {
            String str5 = "tmast://download?via=" + (this.v ? "ANDROID.QQBROWSER.DOWNLOADERNEWSY" : "ANDROID.QQBROWSER.NAPKDOWNLOADERSYNEW") + "&downl_url=" + UrlUtils.encode(this.e.f37604a) + "&oplist=1;2";
            CallYYB.get().init(ContextHolder.getAppContext(), false);
            CallYYB.get().addDownloadTaskFromTmast(str5);
            j();
            downloadInfo.f37604a = b(this.v);
            downloadInfo.j = false;
            downloadInfo.h = false;
            downloadInfo.k = false;
            downloadInfo.f37606c = "应用宝.apk";
            downloadInfo.a("schema", str5);
            Logs.c("QBSimpleSafetyDownloadSheet", "[ID857155609] doYybDownload down_yyb");
            String a3 = DownloadInfoCacheUtils.a(this.e);
            Logs.c("QBSimpleSafetyDownloadSheet", "[ID857155609] doYybDownload cache_down_info=" + a3);
            if (!TextUtils.isEmpty(a3)) {
                downloadInfo.a("yybTaskInfo", a3);
            }
            DownloadTask startDownloadTask = a2.startDownloadTask(downloadInfo, OverwritePolicy.DIRECTED_OVER_WRITE, null);
            if (startDownloadTask != null) {
                this.D = startDownloadTask;
            }
        } else {
            downloadTask.b();
            b("DLPOP_0039");
        }
        a(downloadInfo);
        this.C = true;
    }

    private void d() {
        String string = PublicSettingManager.a().getString("ANDROID_PUBLIC_PREFS_YYB_DOWN_URLS", "");
        if (!TextUtils.isEmpty(string)) {
            try {
                JSONArray jSONArray = new JSONArray(string);
                if (jSONArray.length() >= 2) {
                    String string2 = jSONArray.getString(0);
                    String string3 = jSONArray.getString(1);
                    if (!TextUtils.isEmpty(string2) && !TextUtils.isEmpty(string3)) {
                        this.A[0] = string2;
                        this.A[1] = string3;
                    }
                }
            } catch (JSONException unused) {
            }
        }
        if (TextUtils.isEmpty(this.A[0])) {
            this.A[0] = "https://a.app.qq.com/o/myapp-down?g_f=1125121";
        }
        if (TextUtils.isEmpty(this.A[1])) {
            this.A[1] = "https://a.app.qq.com/o/myapp-down?g_f=1125120";
        }
    }

    private void d(QBLinearLayout qBLinearLayout) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.un, (ViewGroup) null);
        a(linearLayout);
        ((QBTextView) linearLayout.findViewById(com.tencent.mtt.R.id.mainButtonTextView)).setText("普通下载");
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams.topMargin = MttResources.s(12);
        layoutParams.leftMargin = MttResources.s(30);
        layoutParams.rightMargin = MttResources.s(30);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                qBSimpleSafetyDownloadSheet.g = false;
                qBSimpleSafetyDownloadSheet.b(qBSimpleSafetyDownloadSheet.u ? "DLPOP_0040" : "DLPOP_0025");
                QBSimpleSafetyDownloadSheet.this.i();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout, layoutParams);
        QBTextView qBTextView = new QBTextView(this.f37146d);
        qBTextView.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        qBTextView.setGravity(17);
        qBTextView.setText(FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_YYB_DESC_870813435) ? "建议通过应用宝下载,提高安全保障" : "存在拦截风险,建议下载安装应用宝下载此文件");
        qBTextView.setTextSize(MttResources.s(14));
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.topMargin = MttResources.s(8);
        qBLinearLayout.addView(qBTextView, layoutParams2);
        LinearLayout linearLayout2 = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.un, (ViewGroup) null);
        ((QBTextView) linearLayout2.findViewById(com.tencent.mtt.R.id.mainButtonTextView)).setText((this.B ? "使用" : "下载") + "应用宝进行下载");
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams3.topMargin = MttResources.s(8);
        layoutParams3.leftMargin = MttResources.s(30);
        layoutParams3.rightMargin = MttResources.s(30);
        linearLayout2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet.this.b("DLPOP_0029");
                QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                qBSimpleSafetyDownloadSheet.g = false;
                qBSimpleSafetyDownloadSheet.c(false);
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout2, layoutParams3);
    }

    public void d(boolean z) {
        this.r = z;
        Logs.c("QBSimpleSafetyDownloadSheet", "[854882707] dismiss enter");
        DialogBase dialogBase = this.z;
        if (dialogBase != null) {
            dialogBase.dismiss();
        }
        EventEmiter.getDefault().unregister("FILERENAME_KEY_NEW_FILE_NAME_EVENT", this);
        this.k = true;
    }

    private void e() {
        AppInfoQuery.a("com.tencent.android.qqdownloader").a((Continuation<ApkAllData, TContinuationResult>) new Continuation<ApkAllData, Object>() {
            @Override
            public Object then(QBTask<ApkAllData> qBTask) throws Exception {
                ApkAllData e;
                if (qBTask.f() == null && (e = qBTask.e()) != null) {
                    String format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA).format(new Date(e.updateTime * 1000));
                    QBSimpleSafetyDownloadSheet.this.n = e.versionName;
                    QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                    qBSimpleSafetyDownloadSheet.o = format;
                    qBSimpleSafetyDownloadSheet.f();
                }
                return null;
            }
        }, 6);
    }

    private void e(QBLinearLayout qBLinearLayout) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(this.f37146d).inflate(com.tencent.mtt.R.layout.un, (ViewGroup) null);
        a(linearLayout);
        ((QBTextView) linearLayout.findViewById(com.tencent.mtt.R.id.mainButtonTextView)).setText("普通下载");
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, MttResources.s(48));
        layoutParams.topMargin = MttResources.s(24);
        layoutParams.leftMargin = MttResources.s(30);
        layoutParams.rightMargin = MttResources.s(30);
        layoutParams.bottomMargin = MttResources.s(24);
        linearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet.this.d(true);
                QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                qBSimpleSafetyDownloadSheet.b(qBSimpleSafetyDownloadSheet.u ? QBSimpleSafetyDownloadSheet.this.g ? "DLPOP_0030" : "DLPOP_0040" : "DLPOP_0025");
                QBSimpleSafetyDownloadSheet.this.i();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        qBLinearLayout.addView(linearLayout, layoutParams);
    }

    public void f() {
        if (this.p != null) {
            if (TextUtils.isEmpty(this.n)) {
                String a2 = PreferenceData.a("DOWNLOAD_SHEET_YYB_VERSIONNAME");
                if (TextUtils.isEmpty(a2)) {
                    a2 = "7.6.7";
                }
                this.p.setText("应用版本:" + a2 + APLogFileUtil.SEPARATOR_LOG);
            } else {
                this.p.setText("应用版本:" + this.n + APLogFileUtil.SEPARATOR_LOG);
            }
        }
        if (this.q != null) {
            if (!TextUtils.isEmpty(this.o)) {
                this.q.setText(this.o + APLogFileUtil.SEPARATOR_LOG);
                return;
            }
            String a3 = PreferenceData.a("DOWNLOAD_SHEET_YYB_UPDATETIME");
            if (TextUtils.isEmpty(a3)) {
                a3 = "2020-12-22";
            }
            this.q.setText(a3 + APLogFileUtil.SEPARATOR_LOG);
        }
    }

    private void f(QBLinearLayout qBLinearLayout) {
        QBTextView qBTextView = new QBTextView(this.f37146d);
        qBTextView.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        qBTextView.setGravity(17);
        qBTextView.setText("应用宝开发者:深圳市腾讯计算机系统有限公司");
        qBTextView.setTextSize(MttResources.s(11));
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        layoutParams.topMargin = MttResources.s(8);
        qBLinearLayout.addView(qBTextView, layoutParams);
        QBLinearLayout qBLinearLayout2 = new QBLinearLayout(this.f37146d);
        qBLinearLayout2.setOrientation(0);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, 1);
        layoutParams2.weight = 1.0f;
        qBLinearLayout2.addView(new QBView(this.f37146d), layoutParams2);
        this.p = new QBTextView(this.f37146d);
        this.p.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        this.p.setGravity(17);
        this.p.setTextSize(MttResources.s(11));
        qBLinearLayout2.addView(this.p, new LinearLayout.LayoutParams(-2, -2));
        this.q = new QBTextView(this.f37146d);
        this.q.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        this.q.setGravity(17);
        this.q.setTextSize(MttResources.s(11));
        qBLinearLayout2.addView(this.q, new LinearLayout.LayoutParams(-2, -2));
        f();
        QBTextView qBTextView2 = new QBTextView(this.f37146d);
        qBTextView2.setTextColorNormalIds(com.tencent.mtt.R.color.theme_common_color_b9);
        qBTextView2.setGravity(17);
        qBTextView2.setText("应用权限 ");
        qBTextView2.setTextSize(MttResources.s(11));
        qBLinearLayout2.addView(qBTextView2, new LinearLayout.LayoutParams(-2, -2));
        qBTextView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("https://cftweb.3g.qq.com/privacy/permissions?appid=5848").d(true));
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        QBTextView qBTextView3 = new QBTextView(this.f37146d);
        qBTextView3.setTextColorNormalIds(com.tencent.mtt.R.color.new_dialog_third_button);
        qBTextView3.setGravity(17);
        qBTextView3.setText("| ");
        qBTextView3.setTextSize(MttResources.s(11));
        qBLinearLayout2.addView(qBTextView3, new LinearLayout.LayoutParams(-2, -2));
        QBTextView qBTextView4 = new QBTextView(this.f37146d);
        qBTextView4.setTextColorNormalIds(com.tencent.mtt.R.color.theme_common_color_b9);
        qBTextView4.setGravity(17);
        qBTextView4.setText("隐私政策");
        qBTextView4.setTextSize(MttResources.s(11));
        qBLinearLayout2.addView(qBTextView4, new LinearLayout.LayoutParams(-2, -2));
        qBTextView4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("https://cftweb.3g.qq.com/privacy/agreement?appid=5848").d(true));
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, 1);
        layoutParams3.weight = 1.0f;
        qBLinearLayout2.addView(new QBView(this.f37146d), layoutParams3);
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams4.bottomMargin = MttResources.s(20);
        qBLinearLayout.addView(qBLinearLayout2, layoutParams4);
    }

    private boolean g() {
        PageFrame s;
        ArrayList<String> a2 = DomainListDataManager.a().a(IReader.CANCEL_FILTER);
        if (a2 == null || a2.size() <= 0 || (s = WindowManager.a().s()) == null || TextUtils.isEmpty(s.getCurrentUrl())) {
            return false;
        }
        String currentUrl = s.getCurrentUrl();
        for (int i = 0; i < a2.size(); i++) {
            if (Pattern.compile(a2.get(i)).matcher(currentUrl).matches()) {
                return true;
            }
        }
        return false;
    }

    private void h() {
        DownloadTextConfig downloadTextConfig;
        this.u = false;
        this.y = !this.w && BusinessDownloadUserManager.a().a(this.e);
        if (this.y) {
            this.e.q = "33";
            a((DownloadTextConfig) null, false);
            return;
        }
        if (g()) {
            a((DownloadTextConfig) null, false);
            return;
        }
        int i = this.x;
        if (i == 8 || i == 7 || i == 9) {
            a((DownloadTextConfig) null, false);
            return;
        }
        String a2 = PreferenceData.a("PREFERENCE_DOWN_NEW_YYB_TEXT");
        if (TextUtils.isEmpty(a2) || a2.equalsIgnoreCase("0")) {
            a((DownloadTextConfig) null, false);
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(a2);
            downloadTextConfig = new DownloadTextConfig();
            try {
                downloadTextConfig.f37167a = jSONObject.optString("normalDownText");
                downloadTextConfig.f37168b = jSONObject.optString("yybDownText");
                downloadTextConfig.f37169c = jSONObject.optString("yybDownIngText");
                JSONObject jSONObject2 = jSONObject.getJSONObject("dlg");
                if (jSONObject2 != null) {
                    downloadTextConfig.f37170d = jSONObject2.optString("title");
                    downloadTextConfig.e = jSONObject2.optString("msg");
                    downloadTextConfig.f = jSONObject2.optString("posBtn");
                    downloadTextConfig.g = jSONObject2.optString("negBtn");
                }
            } catch (Exception unused) {
            }
        } catch (Exception unused2) {
            downloadTextConfig = null;
        }
        a(downloadTextConfig, true);
        this.u = true;
    }

    public void i() {
        StatManager b2;
        String str;
        DownloadInstallStatUtils.a(3);
        if (this.g) {
            DownloadInfo downloadInfo = this.e;
            if (downloadInfo != null && (downloadInfo.I & 131072) > 0) {
                b2 = StatManager.b();
                str = "BZQR3_1";
            } else if (this.v) {
                b2 = StatManager.b();
                str = "BZQR3_4";
            } else {
                b2 = StatManager.b();
                str = "BZQR3_5";
            }
        } else if (this.v) {
            b2 = StatManager.b();
            str = "BZWY306";
        } else {
            b2 = StatManager.b();
            str = "BZWY406";
        }
        b2.c(str);
        synchronized (this) {
            this.j = true;
        }
        this.i = true;
        b("location_id", "1");
        b("current_id", "download");
        a("action_type", HippyQBViewTouchAndDrawData.GES_TYPE_CLICK);
        k();
    }

    private void j() {
        IFileOpenManager iFileOpenManager;
        DownloadInfo downloadInfo = this.e;
        if (downloadInfo == null || TextUtils.isEmpty(downloadInfo.g) || (iFileOpenManager = (IFileOpenManager) QBContext.getInstance().getService(IFileOpenManager.class)) == null) {
            return;
        }
        iFileOpenManager.addDownloadAndInstallByYYB(this.e.g);
    }

    private void k() {
        DownloadInfo downloadInfo = this.e;
        downloadInfo.k = false;
        downloadInfo.j = false;
        downloadInfo.h = false;
        if (this.y) {
            DownloadStatUtils.c("EV0002");
        }
        DownloadTask startDownloadTask = BusinessDownloadService.getInstance().startDownloadTask(this.e, OverwritePolicy.NEED_CONFIRM, new ResultCallback<DownloadTask>() {
            @Override
            public void onResult(ResultCallback.Result result, DownloadTask downloadTask) {
                if (QBSimpleSafetyDownloadSheet.this.y) {
                    QBSimpleSafetyDownloadSheet.this.l();
                } else if (result == ResultCallback.Result.OK) {
                    QBSimpleSafetyDownloadSheet.this.a(false, true);
                } else {
                    QBSimpleSafetyDownloadSheet.this.b(true, true);
                }
            }
        });
        if (startDownloadTask != null) {
            if (this.y) {
                l();
            } else {
                a(false, false);
            }
            startDownloadTask.e(this.e.n);
        }
        StatManager.b().a(this.e.f37606c, false);
    }

    public void l() {
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("qb://home").b(33));
        ThreadUtils.a(new Runnable() {
            @Override
            public void run() {
                DownloadOperationManager.a(QBSimpleSafetyDownloadSheet.this.h, QBSimpleSafetyDownloadSheet.this.f);
            }
        }, 200L);
    }

    private void m() {
        ICustomDialogBuilder g = SimpleDialogBuilder.g(this.f37146d);
        ScrollView scrollView = new ScrollView(this.f37146d);
        scrollView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        QBLinearLayout qBLinearLayout = new QBLinearLayout(this.f37146d);
        scrollView.addView(qBLinearLayout, new LinearLayout.LayoutParams(-1, -2));
        qBLinearLayout.setOrientation(1);
        qBLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });
        g.a(scrollView);
        this.z = g.d();
        this.z.a(this);
        a(qBLinearLayout, FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_YYB_DESC_870813435) ? "你正在通过第三方网页下载此文件" : "你正在通过外部网页下载此文件");
        qBLinearLayout.addView(c());
        if (!FeatureToggle.a(BuildConfig.FEATURE_TOGGLE_YYB_APK_869887639) ? this.u : this.u && this.E) {
            e(qBLinearLayout);
        } else {
            a(qBLinearLayout);
            f(qBLinearLayout);
        }
        DialogBase dialogBase = this.z;
        if (dialogBase == null) {
            return;
        }
        dialogBase.show();
    }

    public void n() {
        Logs.c("QBSimpleSafetyDownloadSheet", "[854882707] onClick action=rename");
        StatManager.b().c("CQIE002_1");
        b(this.u ? this.g ? "DLPOP_0032" : "DLPOP_0042" : "DLPOP_0027");
        Bundle bundle = new Bundle();
        DownloadInfo downloadInfo = this.e;
        bundle.putString("fileParentPath", (downloadInfo == null || TextUtils.isEmpty(downloadInfo.f)) ? DLMttFileUtils.a(ContextHolder.getAppContext(), this.h) : this.e.f);
        bundle.putString(HippyAppConstants.KEY_FILE_NAME, this.h);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(IFunctionWndFactory.WND_FILE_RENAME).d(2).a(bundle).a(33).d(true));
        EventEmiter.getDefault().register("FILERENAME_KEY_NEW_FILE_NAME_EVENT", this);
    }

    private void o() {
        StatManager b2;
        String str;
        if (this.g) {
            DownloadInfo downloadInfo = this.e;
            if (downloadInfo != null && (downloadInfo.I & 131072) > 0) {
                b2 = StatManager.b();
                str = "BZQR2_1";
            } else if (this.B) {
                b2 = StatManager.b();
                str = "BZWY501";
            } else if (this.v) {
                b2 = StatManager.b();
                str = "BZQR2_4";
            } else {
                b2 = StatManager.b();
                str = "BZQR2_5";
            }
            b2.c(str);
        }
        b(this.u ? "DLPOP_0028" : "DLPOP_0024");
    }

    public void a() {
        DownloadInstallStatUtils.a(0);
        if (this.g) {
            StatManager.b().c(DownloadBussinesController.e);
        }
        this.k = false;
        b("containerpage_id", "Download_4");
        EventEmiter.getDefault().emit(new EventMessage("com.tencent.mtt.browser.security.facade.ISecurityManager.onSafetyDownloadSheetShow"));
        m();
        o();
        if (this.y) {
            DownloadStatUtils.c("EV0001");
        }
    }

    public void a(QBTextView qBTextView, long j) {
        String a2 = StringUtils.a(j);
        if (j == 0) {
            a2 = MttResources.l(com.tencent.mtt.R.string.a0o);
        }
        qBTextView.setText(a2);
        DownloadInfo downloadInfo = this.e;
        if (downloadInfo != null) {
            String str = downloadInfo.C != null ? this.e.C.get("mNewVersion") : "";
            if (TextUtils.isEmpty(str)) {
                return;
            }
            qBTextView.setText(a2 + " V" + str);
        }
    }

    public void a(String str) {
        this.h = str;
        if (TextUtils.isEmpty(str)) {
            this.h = UrlUtils.guessFileName(this.e.f37604a, null, null);
        }
        this.e.f37606c = this.h;
    }

    public void a(JSONObject jSONObject, boolean z, boolean z2) {
        this.f37143a = jSONObject;
        this.f37144b = z;
        this.f37145c = z2;
    }

    public void a(boolean z) {
        this.E = z;
    }

    void a(boolean z, boolean z2) {
        PublicSettingManager a2 = PublicSettingManager.a();
        a(z, a2.a("ANDROID_DOWNLOAD_BUSINESS_RELATIVE_DIALOG", 1).intValue(), (a2.getString("ANDROID_PUBLIC_PREFS_DOWNLOAD_BUSINESS_RELATIVE_DIALOG_TBS", "0").equals("1") || !this.f37145c) && this.f37144b, z2);
    }

    public void b() {
        ICustomDialogBuilder g = SimpleDialogBuilder.g(this.f37146d);
        ScrollView scrollView = new ScrollView(this.f37146d);
        scrollView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        QBLinearLayout qBLinearLayout = new QBLinearLayout(this.f37146d);
        scrollView.addView(qBLinearLayout, new LinearLayout.LayoutParams(-1, -2));
        qBLinearLayout.setOrientation(1);
        qBLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });
        g.a(scrollView);
        this.z = g.d();
        this.z.a(this);
        this.z.a(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dialogInterface) {
                QBSimpleSafetyDownloadSheet.this.r = false;
            }
        });
        a(qBLinearLayout, "QQ浏览器安全中心提醒您");
        b(qBLinearLayout);
        f(qBLinearLayout);
        DialogBase dialogBase = this.z;
        if (dialogBase == null) {
            return;
        }
        dialogBase.show();
        b("DLPOP_0033");
    }

    void b(boolean z, boolean z2) {
        PublicSettingManager a2 = PublicSettingManager.a();
        b(z, a2.a("ANDROID_DOWNLOAD_BUSINESS_RELATIVE_DIALOG", 1).intValue(), (a2.getString("ANDROID_PUBLIC_PREFS_DOWNLOAD_BUSINESS_RELATIVE_DIALOG_TBS", "0").equals("1") || !this.f37145c) && this.f37144b, z2);
    }

    QBLinearLayout c() {
        QBLinearLayout qBLinearLayout = new QBLinearLayout(this.f37146d);
        qBLinearLayout.setOrientation(1);
        qBLinearLayout.setGravity(1);
        if (TextUtils.isEmpty(this.f)) {
            QBImageView qBImageView = new QBImageView(this.f37146d, true);
            qBImageView.setUseMaskForNightMode(true);
            int b2 = MediaFileType.Utils.b(this.h);
            if (b2 == 0) {
                MediaFileType.b();
                b2 = MediaFileType.Utils.b(this.h);
            }
            qBImageView.setImageNormalIds(b2);
            qBImageView.setId(b2);
            qBImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(MttResources.s(70), MttResources.s(70));
            layoutParams.gravity = 1;
            layoutParams.topMargin = MttResources.s(10);
            qBImageView.setLayoutParams(layoutParams);
            qBLinearLayout.addView(qBImageView);
        } else {
            QBWebImageView qBWebImageView = new QBWebImageView(this.f37146d);
            qBWebImageView.setUseMaskForNightMode(true);
            qBWebImageView.setUrl(this.f);
            LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(MttResources.s(70), MttResources.s(70));
            layoutParams2.gravity = 1;
            layoutParams2.topMargin = MttResources.s(10);
            qBWebImageView.setLayoutParams(layoutParams2);
            qBLinearLayout.addView(qBWebImageView);
            SimpleSkinBuilder.a((ImageView) qBWebImageView).f();
        }
        QBRelativeLayout qBRelativeLayout = new QBRelativeLayout(this.f37146d);
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-1, MttResources.s(27));
        layoutParams3.topMargin = MttResources.s(10);
        layoutParams3.bottomMargin = MttResources.s(4);
        qBRelativeLayout.setLayoutParams(layoutParams3);
        this.l = new QBTextView(this.f37146d, false);
        RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2);
        layoutParams4.addRule(13);
        this.l.setTypeface(Typeface.DEFAULT_BOLD);
        this.l.setId(800);
        this.l.setLayoutParams(layoutParams4);
        this.l.setTextColorNormalIds(e.f85871a);
        this.l.setMaxWidth(MttResources.s(Config.ENABLE_FACE));
        this.l.setTextSize(MttResources.s(18));
        this.l.setText(this.h);
        this.l.setSingleLine(true);
        this.l.setEllipsize(TextUtils.TruncateAt.MIDDLE);
        this.l.setGravity(16);
        QBImageView qBImageView2 = new QBImageView(this.f37146d);
        RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-2, -1);
        layoutParams5.addRule(1, 800);
        layoutParams5.setMargins(MttResources.s(8), 0, 0, 0);
        qBImageView2.setLayoutParams(layoutParams5);
        SimpleSkinBuilder.a((ImageView) qBImageView2).g(com.tencent.mtt.R.drawable.a9f).h(e.n).i(e.ag).f(128).c().f();
        qBImageView2.setId(801);
        qBImageView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                QBSimpleSafetyDownloadSheet qBSimpleSafetyDownloadSheet = QBSimpleSafetyDownloadSheet.this;
                qBSimpleSafetyDownloadSheet.l = qBSimpleSafetyDownloadSheet.l;
                QBSimpleSafetyDownloadSheet.this.n();
                EventCollector.getInstance().onViewClicked(view);
            }
        });
        StatManager.b().c("CQIE001_1");
        qBRelativeLayout.addView(this.l);
        qBRelativeLayout.addView(qBImageView2);
        QBTextView qBTextView = new QBTextView(this.f37146d, false);
        LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-2, -2);
        layoutParams6.gravity = 1;
        qBTextView.setGravity(1);
        qBTextView.setLayoutParams(layoutParams6);
        qBTextView.setTextColorNormalIds(e.f85874c);
        qBTextView.setTextSize(MttResources.s(12));
        a(qBTextView, this.e.f37607d);
        qBTextView.setSingleLine(true);
        qBLinearLayout.addView(qBRelativeLayout);
        qBLinearLayout.addView(qBTextView);
        return qBLinearLayout;
    }

    @EventReceiver(createMethod = CreateMethod.NONE, eventName = "FILERENAME_KEY_NEW_FILE_NAME_EVENT")
    public void doOnRenameCalled(EventMessage eventMessage) {
        String string = ((Bundle) eventMessage.arg).getString("newFileName");
        Logs.c("QBSimpleSafetyDownloadSheet", "[854882707] onActivityResult newFileName=" + string);
        if (!TextUtils.isEmpty(string)) {
            a(string);
        }
        QBTask.b((Callable) new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                if (QBSimpleSafetyDownloadSheet.this.l == null) {
                    return null;
                }
                QBSimpleSafetyDownloadSheet.this.l.setText(QBSimpleSafetyDownloadSheet.this.h);
                return null;
            }
        });
    }

    @Override
    public void onDismiss(DialogInterface dialogInterface) {
        if (this.r) {
            return;
        }
        b(this.g ? this.u ? "DLPOP_0031" : "DLPOP_0026" : "DLPOP_0036");
    }
}