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

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


package com.tencent.mtt.search.directShare;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.tencent.common.fresco.pipeline.ImageHub;
import com.tencent.common.task.QBTask;
import com.tencent.luggage.wxa.gq.a;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.ui.widget.QBWebImageView;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.browser.share.facade.IShare;
import com.tencent.mtt.browser.share.facade.IShareStateListener;
import com.tencent.mtt.browser.share.facade.ShareBundle;
import com.tencent.mtt.camera.plugin.CameraForPluginImp;
import com.tencent.mtt.camera.plugin.ICameraForPlugin;
import com.tencent.mtt.external.qrcode.facade.IQRCodeExtension;
import com.tencent.mtt.external.qrcode.facade.IQrCodeProviderListener;
import com.tencent.mtt.external.qrcode.facade.IQrcodeService;
import com.tencent.mtt.external.qrcode.facade.IQrcodeStateListener;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.search.view.SearchViewUtils;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.dialog.QBDialogBase;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.layout.QBRelativeLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import java.util.concurrent.Callable;
import qb.a.e;

public class SearchDirectShareDialog extends QBDialogBase implements View.OnClickListener, IShareStateListener {
    private static boolean S;
    private QBRelativeLayout A;
    private QBWebImageView B;
    private QBLinearLayout C;
    private QBLinearLayout D;
    private QBTextView E;
    private QBTextView F;
    private QBImageView G;
    private QBLinearLayout H;
    private QBImageView I;
    private QBTextView J;
    private QBLinearLayout K;
    private QBLinearLayout L;
    private QBImageView M;
    private QBImageView N;
    private QBImageView O;
    private QBImageView P;
    private QBTextView Q;
    private QBImageView R;
    private final SearchDirectShareBean T;
    private final ShareBundle U;
    private final IShare V;

    private final int f70179a;

    private final int f70180b;

    private final int f70181c;

    private final int f70182d;
    private final int e;
    private final int f;
    private final int g;
    private final int h;
    private final int i;
    private final int j;
    private final int k;
    private final int l;
    private final int m;
    private final int n;
    private final int o;
    private final int p;
    private final int q;
    private final int r;
    private final int s;
    private final float t;
    private final float u;
    private final float v;
    private boolean w;
    private boolean x;
    private QBLinearLayout y;
    private QBLinearLayout z;

    public SearchDirectShareDialog(Context context, SearchDirectShareBean searchDirectShareBean) {
        super(context, R.style.fm);
        this.f70179a = MttResources.s(45);
        this.f70180b = MttResources.s(48);
        this.f70181c = MttResources.s(4);
        this.f70182d = MttResources.s(8);
        this.e = MttResources.s(16);
        this.f = MttResources.s(8);
        this.g = MttResources.s(18);
        this.h = MttResources.s(12);
        this.i = MttResources.s(32);
        this.j = MttResources.s(4);
        this.k = MttResources.s(8);
        this.l = MttResources.s(24);
        this.m = MttResources.s(14);
        this.n = MttResources.s(48);
        this.o = MttResources.s(10);
        this.p = MttResources.s(36);
        this.q = MttResources.s(100);
        this.r = MttResources.s(46);
        this.s = MttResources.s(16);
        this.t = MttResources.s(3);
        this.u = MttResources.s(2);
        this.v = 1.6f;
        this.w = false;
        this.x = false;
        this.T = searchDirectShareBean;
        this.U = new ShareBundle(1);
        this.w = false;
        this.x = false;
        this.U.D = 33;
        this.V = (IShare) QBContext.getInstance().getService(IShare.class);
        if (context == null || this.T == null) {
            MttToaster.show("数据异常,分享失败", 0);
            return;
        }
        ViewGroup.LayoutParams a2 = a(context);
        a(searchDirectShareBean);
        setContentView(this.y, a2);
    }

    private ViewGroup.LayoutParams a(Context context) {
        this.y = new QBLinearLayout(context);
        this.y.setBackgroundColor(Color.parseColor("#7f040404"));
        this.y.setOrientation(1);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, -1);
        LinearLayout.LayoutParams b2 = b(context);
        LinearLayout.LayoutParams c2 = c(context);
        this.y.addView(this.z, b2);
        this.y.addView(this.K, c2);
        return layoutParams;
    }

    public static void a() {
        if (S) {
            return;
        }
        S = true;
        ImageHub.a().a("https://res.imtt.qq.com/search/search_direct_share_bg.jpg");
    }

    private void a(View view) {
        if (this.C == null || this.T == null) {
            return;
        }
        Bitmap b2 = SearchViewUtils.b(SearchViewUtils.a(this.A), getContext().getResources().getColor(R.color.white));
        if (b2 == null) {
            MttToaster.showSysToast(getContext(), "分享失败", 0);
            return;
        }
        this.U.i = b2;
        int b3 = b(view);
        if (b3 == 1 || b3 == 8) {
            if (!this.V.canShareTo(1)) {
                MttToaster.showSysToast(getContext(), "未安装微信", 0);
                return;
            }
        } else if (b3 == 4) {
            if (!this.V.canShareTo(4)) {
                MttToaster.showSysToast(getContext(), "未安装QQ", 0);
                return;
            }
        } else if (b3 != 3) {
            MttToaster.showSysToast(getContext(), MttResources.l(R.string.b_1), 0);
            return;
        } else if (!this.V.canShareTo(3)) {
            MttToaster.showSysToast(getContext(), "未安装QQ空间", 0);
            return;
        }
        ShareBundle shareBundle = this.U;
        shareBundle.w = b3;
        shareBundle.f45014b = this.T.b();
        this.U.f45015c = this.T.c();
        this.V.addShareStateListener(this);
        this.U.a(this.V);
        StatManager.b().c("CV02");
    }

    public void a(IQRCodeExtension iQRCodeExtension, String str) {
        if (iQRCodeExtension != null) {
            iQRCodeExtension.icreateQrBitmap(str, this.n, new IQrCodeProviderListener() {
                @Override
                public void a() {
                    SearchDirectShareDialog.this.b();
                }

                @Override
                public void a(final Bitmap bitmap, boolean z, String str2) {
                    if (bitmap == null || !z) {
                        SearchDirectShareDialog.this.b();
                    } else {
                        QBTask.b((Callable) new Callable<Object>() {
                            @Override
                            public Object call() throws Exception {
                                SearchDirectShareDialog.this.I.setImageBitmap(bitmap);
                                return null;
                            }
                        });
                    }
                }
            });
        } else {
            b();
        }
    }

    private void a(SearchDirectShareBean searchDirectShareBean) {
        this.E.setText(searchDirectShareBean.b());
        this.F.setText(searchDirectShareBean.c());
        this.G.setImageBitmap(a(searchDirectShareBean.d(), this.u));
        this.J.setText(searchDirectShareBean.f());
        a(searchDirectShareBean.e());
    }

    private void a(final String str) {
        CameraForPluginImp.getInstance().a(new ICameraForPlugin.Callback() {
            @Override
            public void a(boolean z, int i, String str2) {
                IQrcodeService iQrcodeService = (IQrcodeService) QBContext.getInstance().getService(IQrcodeService.class);
                if (iQrcodeService != null) {
                    iQrcodeService.getIQRCodeExtension(new IQrcodeStateListener() {
                        @Override
                        public void a() {
                            SearchDirectShareDialog.this.b();
                        }

                        @Override
                        public void a(IQRCodeExtension iQRCodeExtension) {
                            SearchDirectShareDialog.this.a(iQRCodeExtension, str);
                        }
                    });
                } else {
                    SearchDirectShareDialog.this.b();
                }
            }
        }, false);
    }

    private int b(View view) {
        int id = view.getId();
        if (id == 1) {
            return 1;
        }
        if (id == 2) {
            return 8;
        }
        if (id != 3) {
            return id != 4 ? -1 : 3;
        }
        return 4;
    }

    private LinearLayout.LayoutParams b(Context context) {
        this.z = new QBLinearLayout(context);
        QBLinearLayout qBLinearLayout = this.z;
        int i = this.f70179a;
        qBLinearLayout.setPadding(i, 0, i, 0);
        this.z.setGravity(17);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, 0);
        layoutParams.weight = 1.0f;
        this.A = new QBRelativeLayout(context);
        this.A.setBackgroundDrawable(context.getResources().getDrawable(R.drawable.b5o));
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, (int) ((DeviceUtils.af() - (this.f70179a * 2)) * 1.6f));
        this.B = new QBWebImageView(context);
        this.B.setUrl("https://res.imtt.qq.com/search/search_direct_share_bg.jpg");
        this.B.setUseMaskForNightMode(false);
        this.B.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-1, -1);
        layoutParams3.addRule(13);
        this.C = new QBLinearLayout(context);
        this.C.setOrientation(1);
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(-1, -1);
        this.D = new QBLinearLayout(context);
        this.D.setGravity(81);
        this.D.setOrientation(1);
        LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(-1, 0);
        layoutParams5.weight = 1.0f;
        this.E = new QBTextView(context);
        LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-2, -2);
        this.E.setTextColor(context.getResources().getColor(R.color.ha));
        this.E.setTextSize(this.l);
        this.F = new QBTextView(context);
        this.F.setTextColor(Color.parseColor("#8f8f8f"));
        LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(-2, -2);
        layoutParams7.topMargin = this.f70181c;
        layoutParams7.bottomMargin = this.f70182d;
        this.F.setTextSize(this.m);
        this.G = new SearchShadowImageView(context, this.u, this.k);
        this.G.setScaleType(ImageView.ScaleType.FIT_CENTER);
        QBImageView qBImageView = this.G;
        int i2 = this.k;
        qBImageView.setPadding(i2, i2, i2, i2);
        LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(-1, 0);
        layoutParams8.weight = 2.0f;
        int i3 = this.e;
        layoutParams8.leftMargin = i3;
        layoutParams8.rightMargin = i3;
        this.H = new QBLinearLayout(context);
        this.H.setGravity(49);
        this.H.setOrientation(1);
        LinearLayout.LayoutParams layoutParams9 = new LinearLayout.LayoutParams(-1, 0);
        layoutParams9.weight = 1.0f;
        this.I = new QBImageView(context);
        int i4 = this.n;
        LinearLayout.LayoutParams layoutParams10 = new LinearLayout.LayoutParams(i4, i4);
        this.J = new QBTextView(context);
        this.J.setTextColor(Color.parseColor("#8f8f8f"));
        this.J.setTextSize(this.o);
        LinearLayout.LayoutParams layoutParams11 = new LinearLayout.LayoutParams(-2, -2);
        layoutParams11.topMargin = this.j;
        this.R = new QBImageView(context);
        this.R.setImageNormalIds(R.drawable.b5f);
        this.R.setScaleType(ImageView.ScaleType.FIT_CENTER);
        RelativeLayout.LayoutParams layoutParams12 = new RelativeLayout.LayoutParams(this.q, this.r);
        layoutParams12.addRule(12);
        layoutParams12.addRule(14);
        this.D.addView(this.E, layoutParams6);
        this.D.addView(this.F, layoutParams7);
        this.H.addView(this.I, layoutParams10);
        this.H.addView(this.J, layoutParams11);
        this.C.addView(this.D, layoutParams5);
        this.C.addView(this.G, layoutParams8);
        this.C.addView(this.H, layoutParams9);
        this.A.addView(this.B, layoutParams3);
        this.A.addView(this.C, layoutParams4);
        this.A.addView(this.R, layoutParams12);
        this.z.addView(this.A, layoutParams2);
        return layoutParams;
    }

    public void b() {
        QBTask.b((Callable) new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                MttToaster.showSysToast(ContextHolder.getAppContext(), MttResources.l(R.string.b9y), 0);
                return null;
            }
        });
    }

    private LinearLayout.LayoutParams c(Context context) {
        this.K = new QBLinearLayout(context);
        this.K.setBackgroundNormalIds(0, e.W);
        this.K.setOrientation(1);
        this.K.setPadding(0, this.h, 0, 0);
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -2);
        this.L = new QBLinearLayout(context);
        LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-1, this.p);
        int i = this.i;
        layoutParams2.leftMargin = i;
        layoutParams2.rightMargin = i;
        this.M = new QBImageView(context);
        this.M.setImageNormalIds(R.drawable.b6w);
        this.M.setId(1);
        this.M.setOnClickListener(this);
        this.M.setScaleType(ImageView.ScaleType.FIT_CENTER);
        LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(0, -1);
        layoutParams3.weight = 1.0f;
        this.N = new QBImageView(context);
        this.N.setImageNormalIds(R.drawable.b6v);
        this.N.setScaleType(ImageView.ScaleType.FIT_CENTER);
        this.N.setId(2);
        this.N.setOnClickListener(this);
        LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams(0, -1);
        layoutParams4.weight = 1.0f;
        this.O = new QBImageView(context);
        this.O.setScaleType(ImageView.ScaleType.FIT_CENTER);
        this.O.setId(3);
        this.O.setOnClickListener(this);
        this.O.setImageNormalIds(R.drawable.b6t);
        LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(0, -1);
        layoutParams5.weight = 1.0f;
        this.P = new QBImageView(context);
        this.P.setId(4);
        this.P.setOnClickListener(this);
        this.P.setScaleType(ImageView.ScaleType.FIT_CENTER);
        this.P.setImageNormalIds(R.drawable.b6x);
        LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(0, -1);
        layoutParams6.weight = 1.0f;
        this.Q = new QBTextView(context, false);
        this.Q.setTextColor(context.getResources().getColor(R.color.ha));
        this.Q.setBackgroundNormalPressIds(0, R.color.a1f, 0, R.color.a1g);
        this.Q.setGravity(17);
        this.Q.setTextSize(this.s);
        this.Q.setOnClickListener(this);
        QBTextView qBTextView = this.Q;
        int i2 = this.g;
        qBTextView.setPadding(0, i2, 0, i2);
        this.Q.setId(5);
        this.Q.setText(MttResources.l(R.string.ud));
        LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(-1, -2);
        layoutParams7.topMargin = this.f;
        this.L.addView(this.M, layoutParams3);
        this.L.addView(this.N, layoutParams4);
        this.L.addView(this.O, layoutParams5);
        this.L.addView(this.P, layoutParams6);
        this.K.addView(this.L, layoutParams2);
        this.K.addView(this.Q, layoutParams7);
        return layoutParams;
    }

    private void c() {
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.y, a.ab, 0.0f, 1.0f);
        ofFloat.setDuration(80L);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.K, "translationY", 300.0f, 0.0f);
        ofFloat2.setDuration(80L);
        ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this.A, a.ab, 0.0f, 0.0f);
        ofFloat3.setDuration(80L);
        ObjectAnimator ofFloat4 = ObjectAnimator.ofFloat(this.A, a.ab, 0.0f, 1.0f);
        ofFloat4.setDuration(150L);
        ObjectAnimator ofFloat5 = ObjectAnimator.ofFloat(this.A, "translationY", 300.0f, 0.0f);
        ofFloat5.setDuration(150L);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setInterpolator(new LinearInterpolator());
        animatorSet.play(ofFloat).with(ofFloat2).with(ofFloat3).before(ofFloat4).before(ofFloat5);
        animatorSet.start();
    }

    public Bitmap a(Bitmap bitmap, float f) {
        if (bitmap == null) {
            return null;
        }
        Bitmap createBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(createBitmap);
        Paint paint = new Paint();
        Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
        RectF rectF = new RectF(rect);
        paint.setAntiAlias(true);
        paint.setDither(true);
        canvas.drawARGB(0, 0, 0, 0);
        canvas.drawRoundRect(rectF, f, f, paint);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        canvas.drawBitmap(bitmap, rect, rectF, paint);
        return createBitmap;
    }

    @Override
    public void dismiss() {
        if (this.w) {
            return;
        }
        this.w = true;
        if (this.A == null || this.z == null || this.K == null) {
            return;
        }
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.y, a.ab, 1.0f, 0.0f);
        ofFloat.setDuration(80L);
        ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.K, "translationY", 0.0f, 300.0f);
        ofFloat2.setDuration(80L);
        ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this.A, a.ab, 0.0f, 0.0f);
        ofFloat.setDuration(80L);
        ObjectAnimator ofFloat4 = ObjectAnimator.ofFloat(this.A, a.ab, 1.0f, 0.0f);
        ofFloat4.setDuration(150L);
        ObjectAnimator ofFloat5 = ObjectAnimator.ofFloat(this.A, "translationY", 0.0f, 300.0f);
        ofFloat5.setDuration(150L);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.setInterpolator(new LinearInterpolator());
        animatorSet.play(ofFloat).with(ofFloat2).with(ofFloat3).after(ofFloat4).after(ofFloat5);
        animatorSet.start();
        animatorSet.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animator) {
                super.onAnimationEnd(animator);
                SearchDirectShareDialog.super.dismiss();
            }
        });
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        if (view.getId() == 5) {
            this.Q.setEnabled(false);
            this.M.setEnabled(false);
            this.N.setEnabled(false);
            this.O.setEnabled(false);
            this.P.setEnabled(false);
            dismiss();
        } else {
            a(view);
        }
        EventCollector.getInstance().onViewClicked(view);
    }

    @Override
    public void onShareFinished(int i, int i2) {
        Context appContext;
        int i3;
        ShareBundle shareBundle = this.U;
        if (shareBundle == null || shareBundle.w != 3) {
            if (i == 0) {
                appContext = ContextHolder.getAppContext();
                i3 = R.string.b_2;
            } else if (i == -1) {
                appContext = ContextHolder.getAppContext();
                i3 = R.string.b_0;
            } else {
                appContext = ContextHolder.getAppContext();
                i3 = R.string.b_1;
            }
            MttToaster.showSysToast(appContext, MttResources.l(i3), 0);
        }
        if (i == 0) {
            StatManager.b().c("CV03");
        }
        this.V.removeShareStateListener(this);
        dismiss();
    }

    @Override
    public void onShareInfoUpdated() {
    }

    @Override
    public void show() {
        if (this.x) {
            return;
        }
        this.x = true;
        if (this.A == null || this.z == null || this.K == null) {
            MttToaster.showSysToast(getContext(), MttResources.l(R.string.b_1), 0);
        } else {
            c();
            super.show();
        }
    }
}