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

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


package com.tencent.mtt.base.notification;

import MTT.ClickEvent;
import android.animation.Animator;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.text.style.UnderlineSpan;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.webkit.ValueCallback;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.qq.e.comm.constants.TangramHippyConstants;
import com.tencent.common.CommonCallback;
import com.tencent.common.manifest.EventEmiter;
import com.tencent.common.manifest.EventMessage;
import com.tencent.common.utils.GdiMeasureImpl;
import com.tencent.common.utils.bitmap.BitmapUtils;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.animation.QBViewPropertyAnimator;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.functionwindow.IFunctionWndFactory;
import com.tencent.mtt.base.notification.facade.INotify;
import com.tencent.mtt.base.notification.facade.WindowBlockTipInfo;
import com.tencent.mtt.base.notification.tipsnode.ContentNode;
import com.tencent.mtt.base.notification.tipsnode.PContent;
import com.tencent.mtt.base.notification.tipsnode.StarNode;
import com.tencent.mtt.base.notification.tipsnode.TipsContentParser;
import com.tencent.mtt.base.notification.tipsnode.TxtNode;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.browser.setting.manager.SkinEventHub;
import com.tencent.mtt.browser.setting.skin.ISkinChangeListener;
import com.tencent.mtt.browser.setting.skin.SkinChangeEvent;
import com.tencent.mtt.browser.share.export.socialshare.qqshare.QQShareActivity;
import com.tencent.mtt.browser.window.BrowserUIParams;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.browser.window.WindowChangedListener;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.sdkcontext.SDKContext;
import com.tencent.mtt.support.utils.ViewCompat;
import com.tencent.mtt.video.browser.export.wc.m3u8.M3U8Constants;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.dialog.alert.QBAlertDialog;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.widget.QBStyledButtonView;
import com.tencent.qimei.s.a;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.tencent.thumbplayer.tplayer.plugins.report.TPReportKeys;
import java.util.HashMap;
import java.util.List;
import org.json.JSONObject;
import qb.a.e;
import qb.a.f;
import qb.a.h;

public class MttMessageBubbleView extends QBLinearLayout implements ISkinChangeListener, WindowChangedListener {
    private int A;
    private Object B;
    private String C;
    private boolean D;
    private int E;
    private String F;
    private String G;
    private final int H;
    private final int I;
    private final int J;
    private int K;
    private int L;

    String f32730a;

    Object f32731b;

    int f32732c;

    int f32733d;
    String e;
    ClickEvent f;
    int g;
    int h;
    CommonCallback i;
    Handler j;
    private QBImageView l;
    private Bitmap m;
    private int n;
    private int o;
    private QBLinearLayout p;
    private QBTextView q;
    private QBImageView r;
    private final int s;
    private QBStyledButtonView v;
    private QBStyledButtonView w;
    private byte x;
    private int y;
    private final int z;
    private static final int k = MttResources.h(f.n);
    private static final int t = MttResources.h(f.q);
    private static final int u = MttResources.h(f.l);
    private static int M = 0;

    public MttMessageBubbleView(Context context) {
        super(context);
        this.n = MttResources.h(f.M);
        this.o = MttResources.h(f.ak);
        this.s = MttResources.h(f.l);
        this.y = 0;
        this.z = MttResources.h(f.cQ);
        this.D = false;
        this.F = null;
        this.G = null;
        this.f = null;
        this.g = 0;
        this.h = 0;
        this.H = MttResources.h(f.Q);
        this.I = MttResources.h(f.ai);
        this.J = MttResources.h(f.x);
        this.j = new Handler(Looper.getMainLooper()) {
            @Override
            public void handleMessage(Message message) {
                int i = message.what;
                if (i == 1) {
                    MttMessageBubbleView.this.g();
                } else if (i == 2 && MttMessageBubbleView.this.getVisibility() != 8) {
                    MttMessageBubbleView.this.f();
                }
            }
        };
        this.L = 0;
        consumeTouchEvent();
        setOrientation(0);
        SkinEventHub.a().b(this);
    }

    private int a(ContentNode contentNode) {
        Drawable i;
        String b2 = contentNode.b("ep");
        if (b2 == null || (i = MttResources.i(R.drawable.vh)) == null) {
            return 0;
        }
        return Integer.valueOf(b2).intValue() * i.getIntrinsicWidth();
    }

    private int a(String str) {
        int length = str.length();
        return length <= 2 ? this.H : length >= 4 ? this.I : MttResources.h(f.Z);
    }

    private QBTextView a(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return this.q;
        }
        if (this.q == null) {
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -1, 1.0f);
            this.q = new QBTextView(getContext());
            this.q.setLineSpacing(MttResources.h(f.e), 1.0f);
            this.q.setGravity(16);
            this.q.setTextSize(this.z);
            this.q.setTextColorNormalPressIds(e.f85871a, e.f);
            this.q.setEllipsize(TextUtils.TruncateAt.END);
            this.q.setMaxLines(2);
            if (this.A != 8388608) {
                this.q.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        EventCollector.getInstance().onViewClickedBefore(view);
                        MttMessageBubbleView.this.d();
                        HashMap hashMap = new HashMap();
                        hashMap.put(TangramHippyConstants.APPID, Integer.valueOf(MttMessageBubbleView.this.f32732c));
                        hashMap.put(RemoteMessageConst.MSGID, Integer.valueOf(MttMessageBubbleView.this.f32733d));
                        hashMap.put("clickPosition", 1);
                        hashMap.put("clickStatus", 0);
                        hashMap.put("reportNow", true);
                        hashMap.put(TPReportKeys.LiveExKeys.LIVE_EX_EXTRA_INFO, MttMessageBubbleView.this.e);
                        EventEmiter.getDefault().emit(new EventMessage("NewServiceManager.onPushMsgClick", hashMap));
                        EventCollector.getInstance().onViewClicked(view);
                    }
                });
            }
            this.q.setText(str);
            if (!TextUtils.isEmpty(str2)) {
                this.q.hightLight(str2, R.color.msg_tips_hight_light_text_normal, R.color.msg_tips_hight_light_text_pressed);
            }
            layoutParams.leftMargin = k;
            this.q.setLayoutParams(layoutParams);
            addView(this.q);
        }
        return this.q;
    }

    private void a(int i) {
        a(i, null, false);
    }

    private void a(Object obj) {
        String str;
        if (obj instanceof Dialog) {
            Object tag = ((QBAlertDialog) obj).k().getTag();
            if (tag instanceof String) {
                str = (String) tag;
                this.B = obj;
                this.f32731b = obj;
                this.C = MttResources.a(R.string.ns, str);
                this.g = 30;
                this.F = MttResources.l(R.string.xu);
                a(0);
                l();
            }
        }
        str = null;
        this.B = obj;
        this.f32731b = obj;
        this.C = MttResources.a(R.string.ns, str);
        this.g = 30;
        this.F = MttResources.l(R.string.xu);
        a(0);
        l();
    }

    private void a(Object obj, JSONObject jSONObject) {
        this.B = obj;
        this.C = jSONObject.optString("content");
        this.g = 31;
        this.F = jSONObject.optString("button");
        a(0);
        l();
    }

    private synchronized boolean a(int i, byte[] bArr, boolean z) {
        boolean z2;
        setUiStyle(i);
        o();
        setBackgroundDrawable(MttResources.i(R.drawable.msgbubble_bkg));
        b(bArr);
        if (z) {
            z2 = b(this.C);
        } else {
            a(this.C, this.G);
        }
        m();
        n();
        return z2;
    }

    private boolean a(byte[] bArr) {
        this.g = 2;
        ClickEvent clickEvent = this.f;
        boolean a2 = (clickEvent == null || !(clickEvent.eType == 6 || this.f.eType == 8 || this.f.eType == 9 || this.f.eType == 10)) ? a(0, bArr, false) : a(2, bArr, true);
        if (a2) {
            k();
        }
        return a2;
    }

    private void b(Object obj) {
        int i;
        if (obj instanceof WindowBlockTipInfo) {
            this.B = obj;
            boolean z = getVisibility() == 0 && getAlpha() == 1.0f;
            WindowBlockTipInfo windowBlockTipInfo = (WindowBlockTipInfo) obj;
            this.C = String.format(MttResources.l(R.string.bze), Integer.valueOf(windowBlockTipInfo.f32814a));
            if (windowBlockTipInfo.f32815b) {
                this.g = 26;
                i = R.string.bzg;
            } else {
                this.g = 25;
                i = R.string.bzf;
            }
            this.F = MttResources.l(i);
            setVisibility(0);
            a(0);
            this.j.removeMessages(1);
            if (z) {
                setTranslationY(0.0f);
            } else {
                l();
            }
            l();
            this.j.sendEmptyMessageDelayed(1, DateUtils.TEN_SECOND);
        }
    }

    private void b(byte[] bArr) {
        LinearLayout.LayoutParams layoutParams;
        if (bArr == null || bArr.length <= 4) {
            QBImageView qBImageView = this.l;
            if (qBImageView != null) {
                qBImageView.setVisibility(8);
                return;
            }
            return;
        }
        if (this.l == null) {
            this.l = new QBImageView(getContext());
            addView(this.l, 0);
        }
        Bitmap bitmap = null;
        try {
            bitmap = BitmapUtils.a(bArr);
        } catch (OutOfMemoryError unused) {
            EventEmiter.getDefault().emit(new EventMessage("MemoryUsageStat.handleOOMError", (Object) 0));
        }
        QBImageView qBImageView2 = this.l;
        if (bitmap == null) {
            qBImageView2.setVisibility(8);
            return;
        }
        qBImageView2.setEnabled(false);
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        if (this.A == 1) {
            LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(MttResources.h(f.M), MttResources.h(f.M));
            layoutParams2.leftMargin = MttResources.h(f.l);
            this.l.setImageBitmap(bitmap);
            this.m = bitmap;
            this.l.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
            layoutParams = layoutParams2;
        } else if (width >= this.n || height >= this.o) {
            layoutParams = new LinearLayout.LayoutParams(this.n, this.o);
            try {
                Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, this.n, width == height ? this.n : this.o, true);
                this.l.setImageBitmap(createScaledBitmap);
                this.m = createScaledBitmap;
            } catch (OutOfMemoryError unused2) {
                return;
            }
        } else {
            layoutParams = new LinearLayout.LayoutParams(width, height);
            this.l.setImageBitmap(bitmap);
            this.m = bitmap;
        }
        layoutParams.gravity = 19;
        this.l.setLayoutParams(layoutParams);
        this.l.setUseMaskForNightMode(true);
        this.l.setVisibility(0);
    }

    private boolean b(String str) {
        List<ContentNode> a2;
        int s;
        String b2;
        int parseColor;
        String b3;
        boolean booleanValue;
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        List<ContentNode> list = null;
        try {
            list = TipsContentParser.a(str);
        } catch (Exception unused) {
        }
        if (this.p == null) {
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-1, -1, 1.0f);
            this.p = new QBLinearLayout(getContext());
            this.p.setGravity(16);
            this.p.setOrientation(1);
            layoutParams.leftMargin = k;
            this.p.setLayoutParams(layoutParams);
            addView(this.p);
        }
        if (list == null || list.size() == 0) {
            return false;
        }
        if (list.size() > 0) {
            for (ContentNode contentNode : list) {
                if ((contentNode instanceof PContent) && (a2 = contentNode.a()) != null) {
                    String b4 = contentNode.b("sp");
                    String b5 = contentNode.b("ep");
                    if (b4 != null && b5 == null) {
                        int intValue = Integer.valueOf(b4).intValue();
                        for (int i = 0; i < intValue; i++) {
                            a2.get(0).f32822a = (char) 12288 + a2.get(0).f32822a;
                        }
                    }
                    SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                    for (ContentNode contentNode2 : a2) {
                        if (contentNode2 instanceof TxtNode) {
                            TxtNode txtNode = (TxtNode) contentNode2;
                            SpannableString spannableString = new SpannableString(txtNode.f32822a);
                            String b6 = txtNode.b("size");
                            if (b6 != null) {
                                try {
                                    s = MttResources.s(Integer.valueOf(b6).intValue());
                                } catch (Exception unused2) {
                                }
                                spannableString.setSpan(new AbsoluteSizeSpan(s), 0, txtNode.f32822a.length(), 33);
                                b2 = txtNode.b("color");
                                if (b2 != null) {
                                    try {
                                        parseColor = Color.parseColor(M3U8Constants.COMMENT_PREFIX + b2);
                                    } catch (Exception unused3) {
                                    }
                                    spannableString.setSpan(new ForegroundColorSpan(parseColor), 0, txtNode.f32822a.length(), 33);
                                    b3 = txtNode.b("ul");
                                    if (b3 != null) {
                                        try {
                                            booleanValue = Boolean.valueOf(b3).booleanValue();
                                        } catch (Exception unused4) {
                                        }
                                        if (booleanValue) {
                                            spannableString.setSpan(new UnderlineSpan(), 0, txtNode.f32822a.length(), 33);
                                        }
                                        spannableStringBuilder.append((CharSequence) spannableString);
                                    }
                                    booleanValue = false;
                                    if (booleanValue) {
                                    }
                                    spannableStringBuilder.append((CharSequence) spannableString);
                                }
                                parseColor = getDefaultTextColor();
                                spannableString.setSpan(new ForegroundColorSpan(parseColor), 0, txtNode.f32822a.length(), 33);
                                b3 = txtNode.b("ul");
                                if (b3 != null) {
                                }
                                booleanValue = false;
                                if (booleanValue) {
                                }
                                spannableStringBuilder.append((CharSequence) spannableString);
                            }
                            s = TxtNode.f;
                            spannableString.setSpan(new AbsoluteSizeSpan(s), 0, txtNode.f32822a.length(), 33);
                            b2 = txtNode.b("color");
                            if (b2 != null) {
                            }
                            parseColor = getDefaultTextColor();
                            spannableString.setSpan(new ForegroundColorSpan(parseColor), 0, txtNode.f32822a.length(), 33);
                            b3 = txtNode.b("ul");
                            if (b3 != null) {
                            }
                            booleanValue = false;
                            if (booleanValue) {
                            }
                            spannableStringBuilder.append((CharSequence) spannableString);
                        } else if (contentNode2 instanceof StarNode) {
                            for (int i2 = 0; i2 < contentNode2.f32822a.length() && 12288 == contentNode2.f32822a.charAt(i2); i2++) {
                                spannableStringBuilder.append((char) 12288);
                            }
                            int intValue2 = Integer.valueOf(contentNode2.f32822a.replace("\u3000", "").trim()).intValue();
                            for (int i3 = 0; i3 < intValue2; i3++) {
                                Drawable i4 = MttResources.i(R.drawable.vh);
                                if (i4 != null) {
                                    i4.setBounds(0, 0, i4.getIntrinsicWidth(), i4.getIntrinsicHeight());
                                }
                                SpannableString spannableString2 = new SpannableString(a.f77216a);
                                spannableString2.setSpan(new ImageSpan(i4, 1), 0, 1, 17);
                                spannableStringBuilder.append((CharSequence) spannableString2);
                            }
                        }
                    }
                    QBTextView qBTextView = new QBTextView(getContext());
                    qBTextView.setIncludeFontPadding(false);
                    qBTextView.setPadding(a(contentNode), qBTextView.getPaddingTop(), qBTextView.getPaddingRight(), qBTextView.getPaddingBottom());
                    qBTextView.setEllipsize(TextUtils.TruncateAt.END);
                    qBTextView.setMaxLines(2);
                    qBTextView.setTextSize(this.z);
                    qBTextView.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
                    qBTextView.setText(spannableStringBuilder.subSequence(0, spannableStringBuilder.length()));
                    this.p.addView(qBTextView);
                }
            }
        }
        return true;
    }

    private int getDefaultTextColor() {
        return MttResources.c(e.f85871a);
    }

    private ViewGroup.LayoutParams h() {
        return new FrameLayout.LayoutParams(Math.min(GdiMeasureImpl.a(getContext()), GdiMeasureImpl.b(getContext())), this.y);
    }

    private void i() {
        this.C = MttResources.l(R.string.vr);
        this.F = MttResources.l(R.string.aad);
        this.g = 6;
        a(0);
        l();
    }

    private void j() {
        String str;
        this.g = 3;
        this.F = MttResources.l(R.string.aeu);
        int i = M + 1;
        M = i;
        M = i % 4;
        int i2 = M;
        if (i2 == 0) {
            this.C = "设置我为默认浏览器,才有更快的上网速度哦!";
        } else {
            if (i2 != 1) {
                if (i2 != 2) {
                    str = i2 == 3 ? "<p><txt ul=\"true\">新书推荐:《一个:很高兴见到你》</txt></p><p><txt color=\"ffff0000\" size=\"14\">作者:韩寒(主编)</txt></p><p ep=\"3\"><txt>简介:14个月精心打磨,愿读者</txt><txt color=\"ff00ffff\" size=\"16\">享受</txt><txt>阅读的</txt><txt color=\"ffff00ff\">简单</txt><txt>快乐。</txt></p><p sp=\"3\"><star>4</star><txt color=\"ffff0000\">7.8分</txt></p>" : "<p sp=\"2\"><txt color=\"ffff0000\" size=\"14\" ul=\"true\">作者:韩寒(主编)</txt></p><p ep=\"3\"><txt>简介:14个月精心打磨,愿读者享受简单的快乐。愿读者享受简单的快乐。愿读者享受简单的快乐。愿读者享受简单的快乐。愿读者享受简单的快乐。</txt></p><p sp=\"3\"><star>4</star><txt color=\"ffff0000\">7.8分</txt></p>";
                    k();
                }
                this.C = str;
                this.g = 0;
                a(2, null, true);
                k();
            }
            this.C = "这是消息类型的测试文字\r\n联系电话:123.\r\n%^&$^%&^^%xxxx\r\n笑嘻嘻笑嘻嘻笑嘻嘻系\r\njtajfdoahfdoafho\r\n这是内容类型为1的测试文字\r\n%^&$^%&^^%xxxx\r\n联系电话:.\r\n笑嘻嘻笑嘻嘻笑嘻嘻系\r\njtajfdoahfdoafho";
            this.G = "123";
            this.g = 0;
        }
        a(0);
        k();
    }

    private void k() {
        ViewCompat.a((View) this, 0.0f);
        setTranslationY(getHeight());
        QBViewPropertyAnimator.a(this).j(1.0f).f(0.0f).a(250L).a(new AccelerateDecelerateInterpolator()).b();
    }

    private void l() {
        ViewCompat.a((View) this, 0.0f);
        QBViewPropertyAnimator.a(this).j(1.0f).a(250L).b();
    }

    private void m() {
        String substring;
        boolean z = true;
        if (TextUtils.isEmpty(this.F)) {
            substring = "";
            z = false;
        } else {
            substring = this.F.length() > 4 ? this.F.substring(0, 4) : this.F;
        }
        if (!z || this.g == 0) {
            QBStyledButtonView qBStyledButtonView = this.v;
            if (qBStyledButtonView != null) {
                qBStyledButtonView.setVisibility(8);
                return;
            }
            return;
        }
        int a2 = a(substring);
        this.v = new QBStyledButtonView(getContext(), 7);
        this.v.setTextSize(MttResources.h(f.cP));
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(a2, this.J);
        layoutParams.leftMargin = t;
        layoutParams.rightMargin = u;
        layoutParams.gravity = 16;
        this.v.setLayoutParams(layoutParams);
        this.v.setText(substring);
        addView(this.v);
        this.v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                EventCollector.getInstance().onViewClickedBefore(view);
                MttMessageBubbleView.this.d();
                HashMap hashMap = new HashMap();
                hashMap.put(TangramHippyConstants.APPID, Integer.valueOf(MttMessageBubbleView.this.f32732c));
                hashMap.put(RemoteMessageConst.MSGID, Integer.valueOf(MttMessageBubbleView.this.f32733d));
                hashMap.put("clickPosition", 2);
                hashMap.put("clickStatus", 0);
                hashMap.put("reportNow", true);
                hashMap.put(TPReportKeys.LiveExKeys.LIVE_EX_EXTRA_INFO, MttMessageBubbleView.this.e);
                EventEmiter.getDefault().emit(new EventMessage("NewServiceManager.onPushMsgClick", hashMap));
                EventCollector.getInstance().onViewClicked(view);
            }
        });
    }

    private void n() {
        LinearLayout.LayoutParams layoutParams;
        if (this.g != 6) {
            this.r = new QBImageView(getContext());
            if (this.K == 2) {
                layoutParams = new LinearLayout.LayoutParams(-2, -2);
                layoutParams.gravity = 53;
                QBImageView qBImageView = this.r;
                qBImageView.setPadding(qBImageView.getPaddingLeft(), this.s, u, this.r.getPaddingBottom());
            } else {
                layoutParams = new LinearLayout.LayoutParams(-2, -1);
                layoutParams.gravity = 17;
                QBStyledButtonView qBStyledButtonView = this.v;
                int paddingLeft = (qBStyledButtonView == null || qBStyledButtonView.getVisibility() != 0) ? t : this.r.getPaddingLeft();
                QBImageView qBImageView2 = this.r;
                qBImageView2.setPadding(paddingLeft, qBImageView2.getPaddingTop(), u, this.r.getPaddingBottom());
            }
            this.r.setLayoutParams(layoutParams);
            this.r.setImageNormalPressIds(R.drawable.b0x, 0, 0, e.f);
            this.r.setUseMaskForNightMode(true);
            addView(this.r);
            this.r.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    EventCollector.getInstance().onViewClickedBefore(view);
                    if (MttMessageBubbleView.this.i != null) {
                        MttMessageBubbleView.this.i.a(0);
                    }
                    int i = MttMessageBubbleView.this.g;
                    if (i == 25) {
                        MttMessageBubbleView.this.f32731b = null;
                    } else if (i == 30) {
                        if (MttMessageBubbleView.this.B instanceof Dialog) {
                            ((Dialog) MttMessageBubbleView.this.B).dismiss();
                        }
                        MttMessageBubbleView.this.B = null;
                    }
                    MttMessageBubbleView.this.e();
                    if (MttMessageBubbleView.this.A == 6291456) {
                        EventEmiter.getDefault().emit(new EventMessage(INotify.EVENT_BUBBLE_CLOSED, Integer.valueOf(MttMessageBubbleView.this.A)));
                    }
                    EventCollector.getInstance().onViewClicked(view);
                }
            });
        }
    }

    private void o() {
        removeAllViews();
        this.q = null;
        this.l = null;
        this.m = null;
        this.r = null;
        this.v = null;
        this.w = null;
    }

    private void p() {
        setVisibility(8);
    }

    private void q() {
        setVisibility(0);
    }

    private void setUiStyle(int i) {
        int i2;
        this.K = i;
        if (i != 0) {
            if (i == 2) {
                i2 = R.dimen.z7;
            }
            a();
        }
        i2 = R.dimen.z6;
        this.y = MttResources.h(i2);
        a();
    }

    public void a() {
        Animation animation;
        if (getParent() == null) {
            return;
        }
        if ((getVisibility() != 0 || (animation = getAnimation()) == null || !animation.hasStarted() || animation.hasEnded()) && this.E != 7) {
            WindowManager.a().c(this, b());
        }
    }

    public void a(int i, int i2, String str, String str2, String str3, int i3, int i4, byte b2, int i5, int i6, String str4) {
        this.f32732c = i;
        this.f32733d = i2;
        this.e = str4;
        this.C = str;
        this.f32730a = str2;
        this.F = str3;
        this.x = b2;
        if (i3 == 0) {
            this.j.sendEmptyMessageDelayed(1, (i4 <= 300 ? i4 : 300) * 1000);
        }
        this.E = i6;
    }

    public void a(int i, int i2, String str, String str2, String str3, int i3, int i4, byte b2, int i5, String str4) {
        a(i, i2, str, str2, str3, i3, i4, b2, 0, i5, str4);
    }

    public void a(int i, String str, String str2, int i2, boolean z, CommonCallback commonCallback) {
        this.A = i;
        this.C = str;
        this.g = i2;
        this.F = str2;
        this.D = z;
        this.i = commonCallback;
        a(0);
        l();
        a(this.A, (byte[]) null);
    }

    public void a(int i, String str, String str2, boolean z, CommonCallback commonCallback) {
        removeAllViews();
        this.A = i;
        setVisibility(0);
        this.C = str;
        this.F = str2;
        this.i = commonCallback;
        a(0);
        if (z) {
            l();
        }
    }

    public boolean a(int i, Object obj, byte[] bArr, JSONObject jSONObject) {
        int i2;
        this.A = i;
        setVisibility(0);
        if (i == 1) {
            removeAllViews();
            setVisibility(0);
            return a(bArr);
        }
        if (i == 8) {
            removeAllViews();
            setVisibility(0);
            i();
            return true;
        }
        if (i == 128) {
            removeAllViews();
            setVisibility(0);
            j();
            return true;
        }
        if (i == 524288) {
            removeAllViews();
            this.f32731b = "qb://market/startpage?b_f=001802";
            this.C = MttResources.l(R.string.b1v);
            setVisibility(0);
            this.g = 18;
            i2 = R.string.a2x;
        } else {
            if (i != 2097152) {
                if (i == 8388608) {
                    removeAllViews();
                    b(obj);
                    return true;
                }
                if (i == 9437184) {
                    removeAllViews();
                    a(obj);
                    return true;
                }
                if (i != 9502720) {
                    return true;
                }
                removeAllViews();
                a(obj, jSONObject);
                return true;
            }
            removeAllViews();
            setVisibility(0);
            this.C = MttResources.l(R.string.m8);
            this.g = 20;
            i2 = h.aA;
        }
        this.F = MttResources.l(i2);
        a(0);
        l();
        return true;
    }

    public boolean a(int i, byte[] bArr) {
        WindowManager a2;
        PageFrame s;
        if ((this.x & 1) != 0 && (a2 = WindowManager.a()) != null && (s = a2.s()) != null) {
            this.L = s.getBussinessProxy().d();
            a2.a((WindowChangedListener) this);
        }
        return a(i, null, bArr, null);
    }

    public ViewGroup.LayoutParams b() {
        if (this.E == 7) {
            return h();
        }
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(Math.min(GdiMeasureImpl.a(getContext()), GdiMeasureImpl.b(getContext())), this.y);
        layoutParams.gravity = 81;
        int h = MttResources.h(f.f85881d);
        layoutParams.rightMargin = h;
        layoutParams.leftMargin = h;
        if (!DeviceUtils.ai()) {
            layoutParams.bottomMargin = BrowserUIParams.b();
        }
        return layoutParams;
    }

    public void c() {
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mtt.base.notification.MttMessageBubbleView.c():void");
    }

    void d() {
        ValueCallback<Boolean> valueCallback;
        boolean z;
        CommonCallback commonCallback = this.i;
        if (commonCallback != null) {
            commonCallback.a(1);
        }
        int i = this.g;
        if (i != 2) {
            if (i == 3) {
                e();
                Bundle bundle = new Bundle();
                bundle.putInt("ViewID", 1);
                bundle.putInt("button", 9);
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(IFunctionWndFactory.WND_SETTING).d(2).a(bundle).d(true));
            } else if (i != 6) {
                if (i == 18) {
                    if (this.f32731b instanceof String) {
                        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams((String) this.f32731b).b(33).c(-1).a((Bundle) null));
                    }
                    this.f32731b = null;
                } else if (i == 20) {
                    try {
                        ContextHolder.getAppContext().startActivity(new Intent("android.settings.ACCESSIBILITY_SETTINGS"));
                    } catch (Exception unused) {
                    }
                } else if (i != 22) {
                    if (i != 25) {
                        if (i != 26) {
                            switch (i) {
                                case 29:
                                    Bundle bundle2 = new Bundle();
                                    bundle2.putInt(QQShareActivity.KEY_FROM_WHERE, 4);
                                    ((IAccount) SDKContext.getInstance().getService(IAccount.class)).callUserLogin(ActivityHandler.b().a(), bundle2);
                                    break;
                                case 30:
                                    Object obj = this.B;
                                    if (obj instanceof Dialog) {
                                        ((Dialog) obj).show();
                                        break;
                                    }
                                    break;
                                case 31:
                                    Object obj2 = this.B;
                                    if (obj2 instanceof Handler.Callback) {
                                        ((Handler.Callback) obj2).handleMessage(new Message());
                                        break;
                                    }
                                    break;
                            }
                        } else if (this.B != null && (this.B instanceof WindowBlockTipInfo)) {
                            valueCallback = ((WindowBlockTipInfo) this.B).f32816c;
                            z = true;
                        }
                        this.B = null;
                    } else {
                        if (this.B != null && (this.B instanceof WindowBlockTipInfo)) {
                            valueCallback = ((WindowBlockTipInfo) this.B).f32816c;
                            z = false;
                        }
                        this.B = null;
                    }
                    valueCallback.onReceiveValue(z);
                    this.B = null;
                } else {
                    ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("https://v.html5.qq.com/?ch=003002").b(33).c(125).a((Bundle) null));
                }
            }
            e();
            Bundle bundle22 = new Bundle();
            bundle22.putInt(QQShareActivity.KEY_FROM_WHERE, 4);
            ((IAccount) SDKContext.getInstance().getService(IAccount.class)).callUserLogin(ActivityHandler.b().a(), bundle22);
        } else {
            e();
        }
        if (this.D) {
            e();
        } else {
            f();
        }
    }

    public void e() {
        this.j.removeMessages(1);
        ViewCompat.a((View) this, 1.0f);
        setTranslationY(0.0f);
        QBViewPropertyAnimator.a(this).j(0.0f).f(getHeight()).a(250L).a(new AccelerateDecelerateInterpolator()).a(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                MttMessageBubbleView.this.j.removeMessages(2);
                MttMessageBubbleView.this.f();
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
            }
        }).b();
        this.j.sendEmptyMessageDelayed(2, 260L);
    }

    public void f() {
        this.j.removeMessages(1);
        setVisibility(8);
        WindowManager.a().a((View) this);
        this.F = null;
        WindowManager.a().b(this);
        MessageBubbleManager.a().d();
        SkinEventHub.a().a(this);
    }

    public void g() {
        if (getVisibility() == 0) {
            HashMap hashMap = new HashMap();
            hashMap.put(TangramHippyConstants.APPID, Integer.valueOf(this.f32732c));
            hashMap.put(RemoteMessageConst.MSGID, Integer.valueOf(this.f32733d));
            hashMap.put("clickPosition", -1);
            hashMap.put("clickStatus", 2);
            hashMap.put("reportNow", false);
            hashMap.put(TPReportKeys.LiveExKeys.LIVE_EX_EXTRA_INFO, this.e);
            EventEmiter.getDefault().emit(new EventMessage("NewServiceManager.onPushMsgClick", hashMap));
        }
        e();
    }

    public int getMessageMode() {
        return this.A;
    }

    @Override
    public void onCurrentPageFrameChanged(PageFrame pageFrame) {
        if (pageFrame != null) {
            if (pageFrame.getBussinessProxy().d() == this.L) {
                q();
            } else {
                p();
            }
        }
    }

    @Override
    public void onPageFrameAdded(PageFrame pageFrame, boolean z) {
        if (pageFrame == null || pageFrame.getBussinessProxy().d() == this.L) {
            return;
        }
        p();
    }

    @Override
    public void onPageFrameClosed(PageFrame pageFrame) {
        if (pageFrame == null || pageFrame.getBussinessProxy().d() != this.L) {
            return;
        }
        f();
    }

    @Override
    public void onSkinChanged(SkinChangeEvent skinChangeEvent) {
        switchSkin();
    }

    public void setCallback(CommonCallback commonCallback) {
        this.i = commonCallback;
    }

    public void setClickEvent(ClickEvent clickEvent) {
        this.f = clickEvent;
    }

    @Override
    public void switchSkin() {
        super.switchSkin();
        setBackgroundDrawable(MttResources.i(R.drawable.msgbubble_bkg));
        QBImageView qBImageView = this.r;
        if (qBImageView != null) {
            qBImageView.setImageNormalPressIds(R.drawable.b0x, 0, 0, e.f);
        }
        QBTextView qBTextView = this.q;
        if (qBTextView != null) {
            qBTextView.setTextColorNormalPressIds(e.f85871a, e.f);
        }
    }
}