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

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


package com.tencent.mtt.external.setting.defaultbrowser;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.eclipsesource.mmv8.Platform;
import com.tencent.luggage.wxa.lk.a;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.QbActivityBase;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.stat.facade.IUserActionStatServer;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.UIUtil;
import com.tencent.mtt.browser.WebEngine;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.compliance.MethodDelegate;
import com.tencent.mtt.external.setting.base.RotateScreenManager;
import com.tencent.mtt.external.setting.facade.SettingView;
import com.tencent.mtt.external.setting.inhost.SettingDefines;
import com.tencent.mtt.newskin.SimpleSkinBuilder;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.support.utils.ViewCompat;
import com.tencent.mtt.view.setting.SettingItem;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import qb.a.e;
import qb.a.f;
import qb.a.g;

public class DefaultBrowserSettingView extends SettingView implements View.OnClickListener, ActivityHandler.ActivityStateListener {

    public static boolean f59651a;

    private int f59652b;

    private LinearLayout f59653c;

    private TextView f59654d;
    private TextView e;
    private int f;

    public DefaultBrowserSettingView(Context context, Bundle bundle) {
        super(context);
        this.f59652b = -1;
        int i = 0;
        this.f = 0;
        SettingDefines.f59708a = false;
        if (bundle != null) {
            int i2 = bundle.getInt("showSecondView");
            this.f = bundle.getInt("set_default_browser_from_where", 0);
            if (this.f == 1) {
                StatManager.b().c("BHS0001");
            }
            i = i2;
        }
        if (i == 100) {
            a(MttResources.l(R.string.bc3), "");
        } else {
            h();
        }
    }

    public static synchronized String a(Context context, String str) {
        String charSequence;
        synchronized (DefaultBrowserSettingView.class) {
            try {
                PackageManager packageManager = context.getPackageManager();
                charSequence = packageManager.getApplicationLabel(packageManager.getApplicationInfo(str, 128)).toString();
            } catch (Exception unused) {
                return null;
            }
        }
        return charSequence;
    }

    private void a(Bitmap bitmap, String str, String str2, int i) {
        this.f59652b = i;
        this.f59653c = c(0);
        SimpleSkinBuilder.a(this.f59653c).a(e.J).c().f();
        BitmapDrawable bitmapDrawable = bitmap == null ? new BitmapDrawable(MttResources.p(g.bW)) : SkinManager.s().p ? new BitmapDrawable(UIUtil.a(bitmap, MttResources.c(R.color.theme_bookmark_item_unchecked_image_color))) : new BitmapDrawable(bitmap);
        if (MttResources.e() != null) {
            bitmapDrawable.setTargetDensity(MttResources.e());
        }
        TextView textView = new TextView(getContext()) {
            @Override
            protected void dispatchDraw(Canvas canvas) {
                super.dispatchDraw(canvas);
                RectF rectF = new RectF();
                Paint paint = new Paint();
                paint.setColor(MttResources.c(e.L));
                rectF.set(0.0f, getHeight() - 1, getWidth(), getHeight());
                canvas.drawRect(rectF, paint);
                rectF.set(0.0f, 0.0f, getWidth(), 1.0f);
                canvas.drawRect(rectF, paint);
            }
        };
        ImageView imageView = new ImageView(getContext());
        imageView.setImageDrawable(bitmapDrawable);
        ViewCompat.a(imageView, SkinManager.s().l() ? 0.5f : 1.0f);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, bitmapDrawable.getIntrinsicHeight());
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-2, -2);
        this.f59654d = new TextView(getContext());
        SimpleSkinBuilder.a(this.f59654d).g(e.av).f();
        this.f59654d.setTextSize(1, MttResources.r(MttResources.g(f.cQ)));
        this.f59654d.setText(str);
        this.f59654d.setGravity(19);
        this.e = new TextView(getContext());
        SimpleSkinBuilder.a(this.e).g(e.av).f();
        this.e.setTextSize(1, MttResources.r(MttResources.g(f.cQ)));
        this.e.setText(str2);
        this.e.setGravity(19);
        if (i == 0) {
            layoutParams.topMargin = MttResources.g(f.di);
            layoutParams.bottomMargin = MttResources.g(f.di);
            int g = ((MttResources.g(R.dimen.a2b) - MttResources.g(R.dimen.a38)) - bitmapDrawable.getIntrinsicHeight()) - MttResources.g(f.di);
            layoutParams2.topMargin = MttResources.g(R.dimen.a38);
            if (str2 == null) {
                layoutParams2.bottomMargin = g;
            } else {
                layoutParams3.bottomMargin = g;
            }
            textView.setText(MttResources.l(R.string.bc5));
        } else {
            layoutParams.topMargin = MttResources.g(R.dimen.a2q);
            layoutParams.bottomMargin = MttResources.g(f.di);
            MttResources.g(R.dimen.a2b);
            MttResources.g(R.dimen.a2p);
            bitmapDrawable.getIntrinsicHeight();
            MttResources.g(R.dimen.a2q);
            textView.setText(MttResources.l(i == 2 ? R.string.bbw : R.string.bc2));
            if (str2 == null) {
                layoutParams2.bottomMargin = MttResources.g(f.di);
            }
        }
        imageView.setLayoutParams(layoutParams);
        this.f59653c.addView(imageView);
        LinearLayout linearLayout = new LinearLayout(getContext());
        linearLayout.setOrientation(1);
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-2, -2);
        layoutParams4.gravity = 1;
        if (i != 0) {
            layoutParams4.rightMargin = bitmapDrawable.getIntrinsicWidth() / 8;
            layoutParams4.leftMargin = bitmapDrawable.getIntrinsicWidth() / 8;
            this.f59653c.addView(linearLayout, layoutParams4);
        }
        this.f59654d.setLayoutParams(layoutParams2);
        linearLayout.addView(this.f59654d);
        this.e.setLayoutParams(layoutParams3);
        if (i == 0) {
            linearLayout.addView(this.e);
        }
        addView(this.f59653c);
        textView.setId(i);
        textView.setOnClickListener(this);
        textView.setGravity(17);
        SimpleSkinBuilder.a(textView).g(e.f).a(e.J).c().f();
        textView.setFocusable(true);
        FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-1, MttResources.h(f.dh));
        layoutParams5.topMargin = z;
        layoutParams5.bottomMargin = y;
        textView.setLayoutParams(layoutParams5);
        addView(textView);
    }

    private void a(String str, String str2) {
        TextView m = m();
        m.setText(str);
        addView(m);
        if (Build.VERSION.SDK_INT >= 17) {
            String l = MttResources.l(R.string.bbx);
            Activity a2 = ActivityHandler.b().a();
            if (a2 == null) {
                return;
            }
            int g = MttResources.g(f.z);
            LinearLayout linearLayout = new LinearLayout(a2);
            linearLayout.setOrientation(1);
            SimpleSkinBuilder.a(linearLayout).a(e.J).c().f();
            TextView textView = new TextView(a2);
            SimpleSkinBuilder.a(textView).g(R.color.theme_common_color_a1).f();
            textView.setTextAlignment(4);
            textView.setText(l);
            textView.setTextSize(1, MttResources.r(MttResources.g(f.r)));
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
            layoutParams.gravity = 1;
            layoutParams.topMargin = MttResources.s(14);
            layoutParams.bottomMargin = MttResources.s(14);
            layoutParams.setMarginStart(g);
            layoutParams.setMarginEnd(g);
            linearLayout.addView(textView, layoutParams);
            int s = MttResources.s(4);
            int g2 = MttResources.g(f.f85878b);
            int g3 = MttResources.g(f.f85878b);
            int s2 = MttResources.s(80);
            int s3 = MttResources.s(28);
            FrameLayout frameLayout = new FrameLayout(a2);
            LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, s2 + MttResources.g(f.m));
            layoutParams2.setMarginStart(g);
            layoutParams2.setMarginEnd(g);
            FrameLayout frameLayout2 = new FrameLayout(a2);
            ViewGroup.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, s2);
            GradientDrawable gradientDrawable = new GradientDrawable();
            float f = s;
            gradientDrawable.setCornerRadius(f);
            gradientDrawable.setStroke(g2, this.D.h);
            frameLayout2.setBackgroundDrawable(gradientDrawable);
            ImageView imageView = new ImageView(a2);
            SimpleSkinBuilder.a(imageView).g(R.drawable.ads).f();
            FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(MttResources.g(f.k), MttResources.g(f.p));
            layoutParams4.gravity = 8388659;
            layoutParams4.topMargin = MttResources.g(f.h);
            layoutParams4.setMarginStart(MttResources.g(f.n));
            frameLayout2.addView(imageView, layoutParams4);
            String l2 = MttResources.l(R.string.bby);
            TextView textView2 = new TextView(a2);
            SimpleSkinBuilder.a(textView2).g(R.color.theme_common_color_a1).f();
            textView2.setGravity(16);
            textView2.setText(l2);
            textView2.setTextSize(1, MttResources.r(MttResources.h(f.cQ)));
            FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-1, s3);
            layoutParams5.gravity = 48;
            layoutParams5.topMargin = 0;
            layoutParams5.setMarginStart(g2 + MttResources.g(f.C));
            layoutParams5.setMarginEnd(g2);
            frameLayout2.addView(textView2, layoutParams5);
            FrameLayout frameLayout3 = new FrameLayout(a2);
            int i = s2 - s3;
            FrameLayout.LayoutParams layoutParams6 = new FrameLayout.LayoutParams(-1, i);
            layoutParams6.gravity = 80;
            GradientDrawable gradientDrawable2 = new GradientDrawable();
            float f2 = s - g3;
            gradientDrawable2.setCornerRadii(new float[]{0.0f, 0.0f, 0.0f, 0.0f, f2, f2, f2, f2});
            gradientDrawable2.setColor(MttResources.c(e.G));
            gradientDrawable2.setStroke(g2, this.D.h);
            frameLayout3.setBackgroundDrawable(gradientDrawable2);
            String l3 = MttResources.l(R.string.bbz);
            TextView textView3 = new TextView(a2);
            SimpleSkinBuilder.a(textView3).g(R.color.theme_common_color_a1).f();
            textView3.setTextAlignment(4);
            textView3.setText(l3);
            textView3.setTextSize(1, MttResources.r(MttResources.g(f.t)));
            FrameLayout.LayoutParams layoutParams7 = new FrameLayout.LayoutParams(-2, -2);
            layoutParams7.gravity = 8388627;
            layoutParams7.setMarginStart(MttResources.s(12));
            frameLayout3.addView(textView3, layoutParams7);
            frameLayout2.addView(frameLayout3, layoutParams6);
            frameLayout.addView(frameLayout2, layoutParams3);
            linearLayout.addView(frameLayout, layoutParams2);
            String l4 = MttResources.l(R.string.bc0);
            TextView textView4 = new TextView(a2);
            SimpleSkinBuilder.a(textView4).g(R.color.theme_common_color_a1).f();
            textView4.setTextAlignment(4);
            textView4.setText(l4);
            textView4.setTextSize(1, MttResources.r(MttResources.g(f.r)));
            LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams8.gravity = 1;
            layoutParams8.topMargin = MttResources.s(5);
            layoutParams8.bottomMargin = MttResources.s(14);
            layoutParams8.setMarginStart(g);
            layoutParams8.setMarginEnd(g);
            linearLayout.addView(textView4, layoutParams8);
            FrameLayout frameLayout4 = new FrameLayout(a2);
            LinearLayout.LayoutParams layoutParams9 = new LinearLayout.LayoutParams(-1, s2);
            layoutParams9.setMarginStart(g);
            layoutParams9.setMarginEnd(g);
            layoutParams9.bottomMargin = y;
            GradientDrawable gradientDrawable3 = new GradientDrawable();
            gradientDrawable3.setCornerRadius(f);
            gradientDrawable3.setStroke(g2, this.D.h);
            frameLayout4.setBackgroundDrawable(gradientDrawable3);
            ImageView imageView2 = new ImageView(a2);
            SimpleSkinBuilder.a(imageView2).g(R.drawable.ads).f();
            FrameLayout.LayoutParams layoutParams10 = new FrameLayout.LayoutParams(MttResources.g(f.k), MttResources.g(f.p));
            layoutParams10.gravity = 8388659;
            layoutParams10.topMargin = MttResources.g(f.h);
            layoutParams10.setMarginStart(MttResources.g(f.n));
            frameLayout4.addView(imageView2, layoutParams10);
            String l5 = MttResources.l(R.string.bbz);
            TextView textView5 = new TextView(a2);
            SimpleSkinBuilder.a(textView5).g(R.color.theme_common_color_a1).f();
            textView5.setGravity(16);
            textView5.setText(l5);
            textView5.setTextSize(1, MttResources.r(MttResources.g(f.p)));
            FrameLayout.LayoutParams layoutParams11 = new FrameLayout.LayoutParams(-1, s3);
            layoutParams11.gravity = 48;
            layoutParams11.topMargin = 0;
            layoutParams11.setMarginStart(MttResources.g(f.C) + g2);
            layoutParams11.setMarginEnd(g2);
            frameLayout4.addView(textView5, layoutParams11);
            FrameLayout frameLayout5 = new FrameLayout(a2);
            FrameLayout.LayoutParams layoutParams12 = new FrameLayout.LayoutParams(-1, i);
            layoutParams12.gravity = 80;
            GradientDrawable gradientDrawable4 = new GradientDrawable();
            gradientDrawable4.setCornerRadii(new float[]{0.0f, 0.0f, 0.0f, 0.0f, f2, f2, f2, f2});
            gradientDrawable4.setColor(MttResources.c(e.G));
            gradientDrawable4.setStroke(g2, this.D.h);
            frameLayout5.setBackgroundDrawable(gradientDrawable4);
            TextView textView6 = new TextView(a2);
            SimpleSkinBuilder.a(textView6).g(R.color.theme_common_color_a1).f();
            textView6.setTextAlignment(4);
            textView6.setText(MttResources.l(R.string.bc1));
            textView6.setTextSize(1, MttResources.r(MttResources.g(f.t)));
            FrameLayout.LayoutParams layoutParams13 = new FrameLayout.LayoutParams(-2, -2);
            layoutParams13.gravity = 8388627;
            layoutParams13.setMarginStart(MttResources.s(12));
            frameLayout5.addView(textView6, layoutParams13);
            frameLayout4.addView(frameLayout5, layoutParams12);
            linearLayout.addView(frameLayout4, layoutParams9);
            LinearLayout.LayoutParams layoutParams14 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams14.topMargin = y;
            addView(linearLayout, layoutParams14);
        }
        SettingItem settingItem = new SettingItem(getContext(), 103, this.D);
        settingItem.setId(3);
        settingItem.setMainText(MttResources.l(R.string.bc2));
        settingItem.setOnClickListener(this);
        FrameLayout.LayoutParams layoutParams15 = new FrameLayout.LayoutParams(-1, MttResources.h(f.dh));
        layoutParams15.topMargin = MttResources.s(16);
        addView(settingItem, layoutParams15);
    }

    public static void b(Context context, String str) {
        Intent intent = new Intent();
        intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
        intent.setData(Uri.fromParts("package", str, null));
        intent.setFlags(1342177280);
        Activity a2 = ActivityHandler.b().a();
        if (a2 != null) {
            a2.startActivity(intent);
        }
    }

    private void h() {
        String G = WebEngine.e().G();
        if (DeviceUtils.t || DeviceUtils.aC || DeviceUtils.i() || ((DeviceUtils.u() && Build.VERSION.SDK_INT > 19) || (f() && Build.VERSION.SDK_INT > 21))) {
            f59651a = true;
            if (!"com.tencent.mtt".equals(G)) {
                i();
                return;
            }
        } else {
            f59651a = false;
            if (TextUtils.isEmpty(G)) {
                if (this.f != 1) {
                    a(MttResources.p(R.drawable.a5b), MttResources.l(R.string.bii), MttResources.l(R.string.bik), 0);
                    return;
                } else {
                    e();
                    StatManager.b().c("BHS0002");
                    return;
                }
            }
            if (!G.equalsIgnoreCase("com.tencent.mtt")) {
                String a2 = a(ContextHolder.getAppContext(), G);
                a(TextUtils.isEmpty(a2) ? MttResources.a(R.string.bc3, MttResources.l(R.string.bc4)) : MttResources.a(R.string.bc3, a2), a2);
                return;
            }
        }
        j();
    }

    private void i() {
        if (Build.VERSION.SDK_INT >= 17) {
            String l = MttResources.l(R.string.bio);
            Activity a2 = ActivityHandler.b().a();
            if (a2 == null) {
                return;
            }
            int g = MttResources.g(f.z);
            LinearLayout linearLayout = new LinearLayout(a2);
            linearLayout.setOrientation(1);
            SimpleSkinBuilder.a(linearLayout).a(e.J).c().f();
            TextView textView = new TextView(a2);
            SimpleSkinBuilder.a(textView).g(R.color.theme_common_color_a1).f();
            textView.setTextAlignment(4);
            textView.setText(l);
            textView.setTextSize(1, MttResources.r(MttResources.g(f.r)));
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
            layoutParams.gravity = 1;
            layoutParams.topMargin = MttResources.s(14);
            layoutParams.bottomMargin = MttResources.s(14);
            layoutParams.setMarginStart(g);
            layoutParams.setMarginEnd(g);
            linearLayout.addView(textView, layoutParams);
            int s = MttResources.s(4);
            int g2 = MttResources.g(f.f85878b);
            int g3 = MttResources.g(f.f85878b);
            int s2 = MttResources.s(80);
            int s3 = MttResources.s(28);
            FrameLayout frameLayout = new FrameLayout(a2);
            LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, s2 + MttResources.g(f.m));
            layoutParams2.setMarginStart(g);
            layoutParams2.setMarginEnd(g);
            FrameLayout frameLayout2 = new FrameLayout(a2);
            ViewGroup.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-1, s2);
            GradientDrawable gradientDrawable = new GradientDrawable();
            float f = s;
            gradientDrawable.setCornerRadius(f);
            gradientDrawable.setStroke(g2, this.D.h);
            frameLayout2.setBackgroundDrawable(gradientDrawable);
            ImageView imageView = new ImageView(a2);
            SimpleSkinBuilder.a(imageView).g(R.drawable.ads).f();
            FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(MttResources.g(f.k), MttResources.g(f.p));
            layoutParams4.gravity = 8388659;
            layoutParams4.topMargin = MttResources.g(f.h);
            layoutParams4.setMarginStart(MttResources.g(f.n));
            frameLayout2.addView(imageView, layoutParams4);
            String l2 = MttResources.l(R.string.bim);
            TextView textView2 = new TextView(a2);
            SimpleSkinBuilder.a(textView2).g(R.color.theme_common_color_a1).f();
            textView2.setGravity(16);
            textView2.setText(l2);
            textView2.setTextSize(1, MttResources.r(MttResources.h(f.cQ)));
            FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-1, s3);
            layoutParams5.gravity = 48;
            layoutParams5.topMargin = 0;
            layoutParams5.setMarginStart(MttResources.g(f.C) + g2);
            layoutParams5.setMarginEnd(g2);
            frameLayout2.addView(textView2, layoutParams5);
            FrameLayout frameLayout3 = new FrameLayout(a2);
            int i = s2 - s3;
            FrameLayout.LayoutParams layoutParams6 = new FrameLayout.LayoutParams(-1, i);
            layoutParams6.gravity = 80;
            GradientDrawable gradientDrawable2 = new GradientDrawable();
            float f2 = s - g3;
            gradientDrawable2.setCornerRadii(new float[]{0.0f, 0.0f, 0.0f, 0.0f, f2, f2, f2, f2});
            gradientDrawable2.setColor(MttResources.c(e.G));
            gradientDrawable2.setStroke(g2, this.D.h);
            frameLayout3.setBackgroundDrawable(gradientDrawable2);
            String l3 = MttResources.l(R.string.f30783bin);
            TextView textView3 = new TextView(a2);
            SimpleSkinBuilder.a(textView3).g(R.color.theme_common_color_a1).f();
            textView3.setTextAlignment(4);
            textView3.setText(l3);
            textView3.setTextSize(1, MttResources.r(MttResources.g(f.t)));
            FrameLayout.LayoutParams layoutParams7 = new FrameLayout.LayoutParams(-2, -2);
            layoutParams7.gravity = 8388627;
            layoutParams7.setMarginStart(MttResources.s(12));
            frameLayout3.addView(textView3, layoutParams7);
            frameLayout2.addView(frameLayout3, layoutParams6);
            frameLayout.addView(frameLayout2, layoutParams3);
            linearLayout.addView(frameLayout, layoutParams2);
            String l4 = MttResources.l(R.string.biq);
            TextView textView4 = new TextView(a2);
            SimpleSkinBuilder.a(textView4).g(R.color.theme_common_color_a1).f();
            textView4.setTextAlignment(4);
            textView4.setText(l4);
            textView4.setTextSize(1, MttResources.r(MttResources.g(f.r)));
            LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams8.gravity = 1;
            layoutParams8.topMargin = MttResources.s(5);
            layoutParams8.bottomMargin = MttResources.s(14);
            layoutParams8.setMarginStart(g);
            layoutParams8.setMarginEnd(g);
            linearLayout.addView(textView4, layoutParams8);
            FrameLayout frameLayout4 = new FrameLayout(a2);
            LinearLayout.LayoutParams layoutParams9 = new LinearLayout.LayoutParams(-1, s2);
            layoutParams9.setMarginStart(g);
            layoutParams9.setMarginEnd(g);
            GradientDrawable gradientDrawable3 = new GradientDrawable();
            gradientDrawable3.setCornerRadius(f);
            gradientDrawable3.setStroke(g2, this.D.h);
            frameLayout4.setBackgroundDrawable(gradientDrawable3);
            ImageView imageView2 = new ImageView(a2);
            SimpleSkinBuilder.a(imageView2).g(R.drawable.ads).f();
            FrameLayout.LayoutParams layoutParams10 = new FrameLayout.LayoutParams(MttResources.g(f.k), MttResources.g(f.p));
            layoutParams10.gravity = 8388659;
            layoutParams10.topMargin = MttResources.g(f.h);
            layoutParams10.setMarginStart(MttResources.g(f.n));
            frameLayout4.addView(imageView2, layoutParams10);
            String l5 = MttResources.l(R.string.f30783bin);
            TextView textView5 = new TextView(a2);
            SimpleSkinBuilder.a(textView5).g(R.color.theme_common_color_a1).f();
            textView5.setGravity(16);
            textView5.setText(l5);
            textView5.setTextSize(1, MttResources.r(MttResources.g(f.p)));
            FrameLayout.LayoutParams layoutParams11 = new FrameLayout.LayoutParams(-1, s3);
            layoutParams11.gravity = 48;
            layoutParams11.topMargin = 0;
            layoutParams11.setMarginStart(MttResources.g(f.C) + g2);
            layoutParams11.setMarginEnd(g2);
            frameLayout4.addView(textView5, layoutParams11);
            FrameLayout frameLayout5 = new FrameLayout(a2);
            FrameLayout.LayoutParams layoutParams12 = new FrameLayout.LayoutParams(-1, i);
            layoutParams12.gravity = 80;
            GradientDrawable gradientDrawable4 = new GradientDrawable();
            gradientDrawable4.setCornerRadii(new float[]{0.0f, 0.0f, 0.0f, 0.0f, f2, f2, f2, f2});
            gradientDrawable4.setColor(MttResources.c(e.G));
            gradientDrawable4.setStroke(g2, this.D.h);
            frameLayout5.setBackgroundDrawable(gradientDrawable4);
            TextView textView6 = new TextView(a2);
            SimpleSkinBuilder.a(textView6).g(R.color.theme_common_color_a1).f();
            textView6.setTextAlignment(4);
            textView6.setText(MttResources.l(R.string.bip));
            textView6.setTextSize(1, MttResources.r(MttResources.g(f.t)));
            FrameLayout.LayoutParams layoutParams13 = new FrameLayout.LayoutParams(-2, -2);
            layoutParams13.gravity = 8388627;
            layoutParams13.setMarginStart(MttResources.s(12));
            frameLayout5.addView(textView6, layoutParams13);
            frameLayout4.addView(frameLayout5, layoutParams12);
            linearLayout.addView(frameLayout4, layoutParams9);
            TextView textView7 = new TextView(a2);
            SimpleSkinBuilder.a(textView7).g(R.color.theme_common_color_a1).f();
            textView7.setTextAlignment(4);
            textView7.setText(MttResources.l(R.string.bir));
            textView7.setTextSize(1, MttResources.r(MttResources.g(f.r)));
            LinearLayout.LayoutParams layoutParams14 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams14.gravity = 1;
            layoutParams14.topMargin = MttResources.s(14);
            layoutParams14.bottomMargin = MttResources.s(14);
            layoutParams14.setMarginStart(g);
            layoutParams14.setMarginEnd(g);
            linearLayout.addView(textView7, layoutParams14);
            FrameLayout frameLayout6 = new FrameLayout(a2);
            LinearLayout.LayoutParams layoutParams15 = new LinearLayout.LayoutParams(-1, s2);
            layoutParams15.setMarginStart(g);
            layoutParams15.setMarginEnd(g);
            layoutParams15.bottomMargin = MttResources.s(14);
            GradientDrawable gradientDrawable5 = new GradientDrawable();
            gradientDrawable5.setCornerRadius(f);
            gradientDrawable5.setStroke(g2, this.D.h);
            frameLayout6.setBackgroundDrawable(gradientDrawable5);
            ImageView imageView3 = new ImageView(a2);
            SimpleSkinBuilder.a(imageView3).g(R.drawable.ads).f();
            FrameLayout.LayoutParams layoutParams16 = new FrameLayout.LayoutParams(MttResources.g(f.k), MttResources.g(f.p));
            layoutParams16.gravity = 8388659;
            layoutParams16.topMargin = MttResources.g(f.h);
            layoutParams16.setMarginStart(MttResources.g(f.n));
            frameLayout6.addView(imageView3, layoutParams16);
            String l6 = MttResources.l(R.string.bip);
            TextView textView8 = new TextView(a2);
            SimpleSkinBuilder.a(textView8).g(R.color.theme_common_color_a1).f();
            textView8.setGravity(16);
            textView8.setText(l6);
            textView8.setTextSize(1, MttResources.r(MttResources.g(f.p)));
            FrameLayout.LayoutParams layoutParams17 = new FrameLayout.LayoutParams(-1, s3);
            layoutParams17.gravity = 48;
            layoutParams17.topMargin = 0;
            layoutParams17.setMarginStart(MttResources.g(f.C) + g2);
            layoutParams17.setMarginEnd(g2);
            frameLayout6.addView(textView8, layoutParams17);
            FrameLayout frameLayout7 = new FrameLayout(a2);
            FrameLayout.LayoutParams layoutParams18 = new FrameLayout.LayoutParams(-1, i);
            layoutParams18.gravity = 80;
            GradientDrawable gradientDrawable6 = new GradientDrawable();
            gradientDrawable6.setCornerRadii(new float[]{0.0f, 0.0f, 0.0f, 0.0f, f2, f2, f2, f2});
            gradientDrawable6.setColor(MttResources.c(e.G));
            gradientDrawable6.setStroke(g2, this.D.h);
            frameLayout7.setBackgroundDrawable(gradientDrawable6);
            int s4 = MttResources.s(30);
            ImageView imageView4 = new ImageView(a2);
            imageView4.setLayoutParams(new FrameLayout.LayoutParams(s4, s4));
            SimpleSkinBuilder.a(imageView4).g(g.f85884b).f();
            FrameLayout.LayoutParams layoutParams19 = new FrameLayout.LayoutParams(s4, s4);
            layoutParams19.gravity = 8388627;
            layoutParams19.setMarginStart(MttResources.s(12));
            frameLayout7.addView(imageView4, layoutParams19);
            String l7 = MttResources.l(R.string.iv);
            TextView textView9 = new TextView(a2);
            SimpleSkinBuilder.a(textView9).g(R.color.theme_common_color_a1).f();
            textView9.setTextAlignment(4);
            textView9.setText(l7);
            textView9.setTextSize(1, MttResources.r(MttResources.g(f.t)));
            FrameLayout.LayoutParams layoutParams20 = new FrameLayout.LayoutParams(-2, -2);
            layoutParams20.gravity = 8388627;
            layoutParams20.setMarginStart(MttResources.s(20) + s4);
            frameLayout7.addView(textView9, layoutParams20);
            ImageView imageView5 = new ImageView(a2);
            SimpleSkinBuilder.a(imageView5).g(R.drawable.adt).f();
            FrameLayout.LayoutParams layoutParams21 = new FrameLayout.LayoutParams(MttResources.g(f.t), MttResources.g(f.t));
            layoutParams21.gravity = 8388629;
            layoutParams21.setMarginEnd(MttResources.g(f.n));
            frameLayout7.addView(imageView5, layoutParams21);
            frameLayout6.addView(frameLayout7, layoutParams18);
            linearLayout.addView(frameLayout6, layoutParams15);
            LinearLayout.LayoutParams layoutParams22 = new LinearLayout.LayoutParams(-1, -2);
            layoutParams22.topMargin = y;
            layoutParams22.bottomMargin = y;
            addView(linearLayout, layoutParams22);
        }
        TextView textView10 = new TextView(getContext()) {
            @Override
            protected void dispatchDraw(Canvas canvas) {
                super.dispatchDraw(canvas);
                RectF rectF = new RectF();
                Paint paint = new Paint();
                paint.setColor(MttResources.c(e.L));
                rectF.set(0.0f, getHeight() - 1, getWidth(), getHeight());
                canvas.drawRect(rectF, paint);
                rectF.set(0.0f, 0.0f, getWidth(), 1.0f);
                canvas.drawRect(rectF, paint);
            }
        };
        textView10.setId(0);
        textView10.setOnClickListener(this);
        textView10.setGravity(17);
        SimpleSkinBuilder.a(textView10).g(e.f).c().a(e.J).f();
        textView10.setFocusable(true);
        FrameLayout.LayoutParams layoutParams23 = new FrameLayout.LayoutParams(-1, MttResources.h(f.dh));
        layoutParams23.bottomMargin = y;
        textView10.setText(MttResources.l(R.string.bc5));
        textView10.setLayoutParams(layoutParams23);
        textView10.setTextSize(1, MttResources.r((int) textView10.getTextSize()));
        addView(textView10);
    }

    private void j() {
        this.f59652b = 1;
        Drawable i = MttResources.i(g.bW);
        this.f59653c = c(0);
        SimpleSkinBuilder.a(this.f59653c).a(e.J).f();
        if (i != null) {
            ImageView imageView = new ImageView(getContext());
            imageView.setImageDrawable(i);
            ViewCompat.a(imageView, SkinManager.s().l() ? 0.5f : 1.0f);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, i.getIntrinsicHeight());
            layoutParams.topMargin = MttResources.h(R.dimen.a2c);
            imageView.setLayoutParams(layoutParams);
            this.f59653c.addView(imageView);
        }
        TextView textView = new TextView(getContext());
        SimpleSkinBuilder.a(textView).g(e.av).f();
        textView.setTextSize(1, MttResources.r(MttResources.h(f.cQ)));
        textView.setText(MttResources.l(R.string.bbq));
        textView.setGravity(17);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams2.topMargin = MttResources.g(f.f);
        layoutParams2.bottomMargin = MttResources.g(R.dimen.a28);
        this.f59653c.addView(textView, layoutParams2);
        addView(this.f59653c);
        SettingItem settingItem = new SettingItem(getContext(), 103, this.D);
        settingItem.setId(3);
        settingItem.setMainText(MttResources.l(R.string.bc2));
        settingItem.setOnClickListener(this);
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-1, MttResources.h(f.dh));
        layoutParams3.topMargin = z;
        layoutParams3.bottomMargin = y;
        addView(settingItem, layoutParams3);
    }

    private void k() {
        String G = WebEngine.e().G();
        if (TextUtils.isEmpty(G)) {
            return;
        }
        Activity a2 = ActivityHandler.b().a();
        PackageManager packageManager = a2.getPackageManager();
        try {
            ApplicationInfo applicationInfo = packageManager.getApplicationInfo(G, 0);
            if (applicationInfo != null) {
                packageManager.getApplicationLabel(applicationInfo);
            }
            b(a2, G);
        } catch (ActivityNotFoundException | PackageManager.NameNotFoundException unused) {
        }
    }

    private void l() {
        if (f59651a) {
            DefaultBrowserManager.a().e = true;
            StatManager.b().c("AWNM7");
            StatManager.b().c("EIC2201");
            p();
            return;
        }
        StatManager.b().c("AWNM4");
        StatManager.b().c("EIC2201");
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.addCategory("android.intent.category.BROWSABLE");
        intent.setData(Uri.parse("https://static.res.qq.com/qbt/help/adr/page/about_qb.html"));
        if (!DeviceUtils.q()) {
            intent.setComponent(DeviceUtils.t() ? new ComponentName(Platform.ANDROID, "com.tencent.qrom.app.TencentResolverActivity") : new ComponentName(Platform.ANDROID, "com.android.internal.app.ResolverActivity"));
        }
        intent.putExtra("set_default_browser", true);
        try {
            ActivityHandler.b().n().startActivity(intent);
        } catch (Throwable unused) {
        }
    }

    private void p() {
        Intent launchIntentForPackage;
        Intent intent;
        Context appContext = ContextHolder.getAppContext();
        if (DeviceUtils.t) {
            try {
                try {
                    Intent intent2 = new Intent();
                    intent2.setAction("com.iqoo.secure.DEFAULTAPPSETTING");
                    intent2.setFlags(268435456);
                    appContext.startActivity(intent2);
                    return;
                } catch (Exception unused) {
                    if (Build.VERSION.SDK_INT >= 23) {
                        launchIntentForPackage = new Intent();
                        launchIntentForPackage.setAction("android.settings.APPLICATION_SETTINGS");
                        launchIntentForPackage.setFlags(268435456);
                    } else {
                        launchIntentForPackage = appContext.getPackageManager().getLaunchIntentForPackage("com.iqoo.secure");
                    }
                    appContext.startActivity(launchIntentForPackage);
                    return;
                }
            } catch (Exception unused2) {
                MttToaster.show(R.string.bbt, 0);
                return;
            }
        }
        try {
            if (!DeviceUtils.aC) {
                if (DeviceUtils.i()) {
                    try {
                        Intent intent3 = new Intent();
                        intent3.setAction("miui.intent.action.PREFERRED_APPLICATION_SETTINGS");
                        intent3.setFlags(268435456);
                        appContext.startActivity(intent3);
                        return;
                    } catch (Exception unused3) {
                        intent = new Intent();
                        intent.setAction("android.settings.MANAGE_DEFAULT_APPS_SETTINGS");
                    }
                } else if (DeviceUtils.u()) {
                    if (Build.VERSION.SDK_INT >= 23) {
                        intent = new Intent();
                        intent.setAction("android.settings.MANAGE_DEFAULT_APPS_SETTINGS");
                    } else {
                        intent = new Intent();
                        intent.setAction("android.settings.APPLICATION_SETTINGS");
                    }
                } else {
                    if (!f()) {
                        return;
                    }
                    if (Build.VERSION.SDK_INT >= 26) {
                        intent = new Intent();
                        intent.setAction("android.settings.MANAGE_DEFAULT_APPS_SETTINGS");
                    } else {
                        intent = new Intent();
                        intent.setAction("android.settings.APPLICATION_SETTINGS");
                    }
                }
                intent.setFlags(268435456);
                appContext.startActivity(intent);
                return;
            }
            try {
                Intent intent4 = new Intent();
                intent4.setAction("action.coloros.safecenter.DefaultAppListActivity");
                intent4.setFlags(268435456);
                appContext.startActivity(intent4);
            } catch (Exception unused4) {
                if (Build.VERSION.SDK_INT < 21) {
                    MttToaster.show(R.string.bbt, 0);
                } else {
                    intent = new Intent();
                    intent.setAction("android.settings.APPLICATION_SETTINGS");
                }
            }
        } catch (Exception unused5) {
        }
    }

    @Override
    public void b() {
        super.b();
        ActivityHandler.b().a(this);
    }

    @Override
    public void c() {
        super.c();
        ActivityHandler.b().b(this);
    }

    public void e() {
        ((IUserActionStatServer) QBContext.getInstance().getService(IUserActionStatServer.class)).addUserAction(a.CTRL_INDEX);
        SettingDefines.f59708a = true;
        if (SettingDefines.f59708a) {
            RotateScreenManager.a().a((Activity) null, 5, 2);
        }
        SettingDefines.f59710c = true;
        l();
    }

    public boolean f() {
        String lowerCase = MethodDelegate.getModel().trim().toLowerCase();
        return lowerCase.length() == 6 && lowerCase.startsWith("nx") && lowerCase.endsWith("j");
    }

    @Override
    public void onActivityState(QbActivityBase qbActivityBase, ActivityHandler.LifeCycle lifeCycle) {
        if (lifeCycle == ActivityHandler.LifeCycle.onResume) {
            SettingDefines.f59708a = false;
        }
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.C > 300) {
            this.C = currentTimeMillis;
            int id = view.getId();
            if (id != 0) {
                if (id != 2) {
                    if (id == 3) {
                        StatManager.b().b("DJ1057", StatManager.SamplingRate.PERCENT_20);
                        StatManager.b().c("EIC2202");
                    }
                }
                DefaultBrowserManager.a().f59650d = true;
                StatManager.b().c("AWNM10");
                k();
            } else {
                e();
            }
        }
        EventCollector.getInstance().onViewClicked(view);
    }
}