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

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


package com.tencent.mtt.browser.homepage.view.fastlink;

import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.text.TextUtils;
import android.util.JsonReader;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.tencent.common.task.Continuation;
import com.tencent.common.task.QBTask;
import com.tencent.map.geolocation.util.DateUtils;
import com.tencent.mtt.animation.QBViewPropertyAnimator;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.browser.homepage.HomePageConst;
import com.tencent.mtt.browser.homepage.appdata.FastLinkDataManager;
import com.tencent.mtt.browser.setting.manager.SkinManager;
import com.tencent.mtt.browser.window.UrlParams;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.lottie.LottieAnimationView;
import com.tencent.mtt.operation.QBOperationManager;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.PublicSettingManager;
import com.tencent.mtt.view.common.QBTextView;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.tencent.rmp.operation.interfaces.AllResTaskFinishedListener;
import com.tencent.rmp.operation.res.OperationManager;
import com.tencent.rmp.operation.res.OperationTask;
import com.tencent.rmp.operation.res.Res;
import com.tencent.rmp.operation.res.ResponseInfo;
import java.io.File;
import java.io.FileReader;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.Callable;
import qb.a.e;

public class PhoneUpIconView extends QBFrameLayout implements View.OnClickListener, View.OnTouchListener, AllResTaskFinishedListener {

    public static String f40810c = "PHONE_UP_ICON_BEGIN_ID";

    public static String f40811d = "PHONE_UP_ICON_BEGIN_FILE.json";
    public static String e = "";
    public static String f = "PHONE_UP_ICON_END_ID";
    public static String g = "PHONE_UP_ICON_END_FILE.json";
    public static String h = "";
    private static long p = 1800000;

    LottieAnimationView f40812a;

    LottieAnimationView f40813b;
    private int i;
    private QBTextView j;
    private QBTextView k;
    private QBTextView l;
    private FastLinkWorkspaceBase m;
    private QBFrameLayout n;
    private JsonReader o;
    private int q;
    private String r;
    private int s;
    private int t;
    private boolean u;

    public PhoneUpIconView(Context context, FastLinkWorkspaceBase fastLinkWorkspaceBase) {
        super(context);
        this.i = PublicSettingManager.a().getInt("PHONE_UP_LAST_VALUE", 0);
        this.o = null;
        this.q = 90;
        this.s = 1000;
        this.t = 300;
        this.u = false;
        OperationManager.a().a(this);
        this.m = fastLinkWorkspaceBase;
        a(context);
    }

    public static void d() {
        QBTask.d(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                boolean z;
                OperationTask operationTask;
                HashMap<String, Res> allRes;
                Res res;
                File resFile;
                OperationTask operationTask2;
                HashMap<String, Res> allRes2;
                Res res2;
                HashMap<String, OperationTask> a2 = OperationManager.a().a(18);
                if (a2 != null && (operationTask2 = a2.get(PhoneUpIconView.f40810c)) != null && operationTask2.mRes != null && operationTask2.mRes.isAllResReady() && (allRes2 = operationTask2.mRes.getAllRes()) != null && (res2 = allRes2.get(PhoneUpIconView.f40811d)) != null) {
                    File resFile2 = res2.getResFile();
                    if (resFile2.exists()) {
                        PhoneUpIconView.e = resFile2.getAbsolutePath();
                        z = true;
                        if (!z) {
                            ArrayList arrayList = new ArrayList();
                            ResponseInfo responseInfo = new ResponseInfo();
                            responseInfo.mTaskId = PhoneUpIconView.f40810c;
                            responseInfo.mAction = 0;
                            responseInfo.mEffectTime = 0L;
                            responseInfo.mInvalidTime = Long.MAX_VALUE;
                            responseInfo.mResMap = new HashMap<>();
                            Res res3 = new Res();
                            res3.mUrl = "https://res.imtt.qq.com/res_mtt/homepage/upbegin.json";
                            res3.mType = 0;
                            res3.mFileName = PhoneUpIconView.f40811d;
                            responseInfo.mResMap.put(res3.mFileName, res3);
                            arrayList.add(responseInfo);
                            OperationManager.a().a(18, (Serializable) arrayList);
                        }
                        if (a2 != null && (operationTask = a2.get(PhoneUpIconView.f)) != null && operationTask.mRes != null && operationTask.mRes.isAllResReady() && (allRes = operationTask.mRes.getAllRes()) != null && (res = allRes.get(PhoneUpIconView.g)) != null) {
                            resFile = res.getResFile();
                            if (resFile.exists()) {
                                PhoneUpIconView.h = resFile.getAbsolutePath();
                            }
                        }
                        ArrayList arrayList2 = new ArrayList();
                        ResponseInfo responseInfo2 = new ResponseInfo();
                        responseInfo2.mTaskId = PhoneUpIconView.f;
                        responseInfo2.mAction = 0;
                        responseInfo2.mEffectTime = 0L;
                        responseInfo2.mInvalidTime = Long.MAX_VALUE;
                        responseInfo2.mResMap = new HashMap<>();
                        Res res4 = new Res();
                        res4.mUrl = "https://res.imtt.qq.com/res_mtt/homepage/upend.json";
                        res4.mType = 0;
                        res4.mFileName = PhoneUpIconView.g;
                        responseInfo2.mResMap.put(res4.mFileName, res4);
                        arrayList2.add(responseInfo2);
                        OperationManager.a().a(18, (Serializable) arrayList2);
                        return null;
                    }
                }
                z = false;
                if (!z) {
                }
                if (a2 != null) {
                    resFile = res.getResFile();
                    if (resFile.exists()) {
                    }
                }
                ArrayList arrayList22 = new ArrayList();
                ResponseInfo responseInfo22 = new ResponseInfo();
                responseInfo22.mTaskId = PhoneUpIconView.f;
                responseInfo22.mAction = 0;
                responseInfo22.mEffectTime = 0L;
                responseInfo22.mInvalidTime = Long.MAX_VALUE;
                responseInfo22.mResMap = new HashMap<>();
                Res res42 = new Res();
                res42.mUrl = "https://res.imtt.qq.com/res_mtt/homepage/upend.json";
                res42.mType = 0;
                res42.mFileName = PhoneUpIconView.g;
                responseInfo22.mResMap.put(res42.mFileName, res42);
                arrayList22.add(responseInfo22);
                OperationManager.a().a(18, (Serializable) arrayList22);
                return null;
            }
        });
    }

    public void e() {
        JsonReader jsonReader = this.o;
        if (jsonReader != null) {
            try {
                jsonReader.close();
            } catch (Throwable unused) {
            }
        }
    }

    private void f() {
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(HomePageConst.ab, HomePageConst.ab);
        layoutParams.topMargin = HomePageConst.ac;
        layoutParams.gravity = 1;
        this.n.setLayoutParams(layoutParams);
    }

    private void g() {
        this.f40812a.setScaleType(ImageView.ScaleType.FIT_CENTER);
        this.f40812a.addAnimatorListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
                PhoneUpIconView.this.m.z(FastLinkDataManager.f39314c);
                PhoneUpIconView.this.u = false;
                PhoneUpShowManager.getInstance().a(false);
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                PhoneUpIconView.this.e();
                PhoneUpIconView.this.a();
                QBTask.a(PhoneUpIconView.this.s).a((Continuation<Void, TContinuationResult>) new Continuation<Void, Object>() {
                    @Override
                    public Object then(QBTask<Void> qBTask) throws Exception {
                        PhoneUpIconView.this.c();
                        return null;
                    }
                }, 6);
                PhoneUpIconView.this.u = false;
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
            }
        });
        this.f40812a.addAnimatorUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                if (valueAnimator.getAnimatedFraction() <= 0.6f || PhoneUpIconView.this.u) {
                    return;
                }
                PhoneUpIconView.this.u = true;
                QBViewPropertyAnimator.a(PhoneUpIconView.this.j).j(1.0f).a(300L);
            }
        });
        this.f40812a.loop(false);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(HomePageConst.ab, HomePageConst.ab);
        this.f40812a.setLayoutParams(layoutParams);
        this.f40813b.setScaleType(ImageView.ScaleType.FIT_CENTER);
        this.f40813b.addAnimatorListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationCancel(Animator animator) {
                PhoneUpShowManager.getInstance().a(false);
                PhoneUpIconView.this.m.z(FastLinkDataManager.f39314c);
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                PhoneUpShowManager.getInstance().a(false);
                PhoneUpIconView.this.e();
                PhoneUpIconView.this.m.z(FastLinkDataManager.f39314c);
            }

            @Override
            public void onAnimationRepeat(Animator animator) {
            }

            @Override
            public void onAnimationStart(Animator animator) {
                PhoneUpIconView.this.b();
                QBViewPropertyAnimator.a(PhoneUpIconView.this.j).j(0.0f).a(100L);
            }
        });
        this.f40813b.loop(false);
        this.f40813b.setLayoutParams(layoutParams);
        this.f40813b.setVisibility(8);
    }

    private void h() {
        if (SkinManager.s().o() == 1) {
            this.n.setAlpha(0.4f);
            return;
        }
        if (SkinManager.s().o() != 2) {
            SkinManager.s().o();
        }
        this.n.setAlpha(1.0f);
    }

    public void a() {
        QBViewPropertyAnimator.a(this.k).j(0.0f).a(300L);
        QBViewPropertyAnimator.a(this.l).j(1.0f).a(300L);
    }

    @Override
    public void a(int i, String str, int i2) {
        HashMap<String, OperationTask> a2;
        OperationTask operationTask;
        HashMap<String, Res> allRes;
        Res res;
        HashMap<String, OperationTask> a3;
        OperationTask operationTask2;
        HashMap<String, Res> allRes2;
        Res res2;
        if (i != 18) {
            return;
        }
        if (i2 == 0 && str == f40810c && (a3 = OperationManager.a().a(18)) != null && (operationTask2 = a3.get(str)) != null && operationTask2.mRes != null && operationTask2.mRes.isAllResReady() && (allRes2 = operationTask2.mRes.getAllRes()) != null && (res2 = allRes2.get(f40811d)) != null) {
            File resFile = res2.getResFile();
            if (resFile.exists()) {
                e = resFile.getAbsolutePath();
            }
        }
        if (i2 != 0 || str != f || (a2 = OperationManager.a().a(18)) == null || (operationTask = a2.get(str)) == null || operationTask.mRes == null || !operationTask.mRes.isAllResReady() || (allRes = operationTask.mRes.getAllRes()) == null || (res = allRes.get(g)) == null) {
            return;
        }
        File resFile2 = res.getResFile();
        if (resFile2.exists()) {
            h = resFile2.getAbsolutePath();
        }
    }

    public void a(Context context) {
        setLayoutParams(new FrameLayout.LayoutParams(HomePageConst.R, HomePageConst.aa));
        setUseMaskForNightMode(true);
        setOnTouchListener(this);
        setOnClickListener(this);
        this.n = new QBFrameLayout(context);
        f();
        addView(this.n);
        this.f40812a = new LottieAnimationView(context);
        this.f40813b = new LottieAnimationView(context);
        g();
        this.n.addView(this.f40812a);
        this.f40813b.setVisibility(8);
        this.n.addView(this.f40813b);
        this.j = new QBTextView(context);
        this.j.setTextColorNormalIds(e.e);
        this.j.setTextSize(MttResources.s(12));
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.gravity = 17;
        this.n.addView(this.j, layoutParams);
        this.k = new QBTextView(context);
        this.k.setTextColorNormalIds(e.f85871a);
        this.k.setTextSize(FastLinkViewBase.o);
        this.k.setText("手机加速");
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams2.gravity = 49;
        layoutParams2.topMargin = (((HomePageConst.ab + FastLinkViewBase.n) - ((HomePageConst.ab - HomePageConst.S) / 2)) - FastLinkViewBase.o) + MttResources.s(6) + 1;
        this.k.setAlpha(1.0f);
        addView(this.k, layoutParams2);
        this.l = new QBTextView(context);
        this.l.setTextColorNormalIds(e.g);
        this.l.setTextSize(FastLinkViewBase.o);
        this.l.setText("内存占用");
        this.l.setAlpha(0.0f);
        addView(this.l, layoutParams2);
        h();
    }

    public boolean a(int i) {
        int i2 = this.i;
        int i3 = this.q;
        if (i2 < i3 && i >= i3) {
            return true;
        }
        int i4 = this.i;
        int i5 = this.q;
        return i4 >= i5 && i >= i5 && System.currentTimeMillis() - PublicSettingManager.a().getLong("PHONE_UP_LAST_UPDATE_TIME", 0L) > p;
    }

    public void b() {
        QBViewPropertyAnimator.a(this.l).j(0.0f).a(300L);
        QBViewPropertyAnimator.a(this.k).j(1.0f).a(300L);
    }

    public void b(int i) {
        int i2 = this.i;
        int i3 = this.q;
        if (i2 >= i3 || i < i3) {
            int i4 = this.i;
            int i5 = this.q;
            if (i4 >= i5) {
                if (i >= i5) {
                }
            }
            this.i = i;
            PublicSettingManager.a().setInt("PHONE_UP_LAST_VALUE", this.i);
        }
        c(i);
        this.i = i;
        PublicSettingManager.a().setInt("PHONE_UP_LAST_VALUE", this.i);
    }

    public void c() {
        try {
            if (TextUtils.isEmpty(h)) {
                this.m.z(FastLinkDataManager.f39314c);
            } else {
                this.o = new JsonReader(new FileReader(h));
                this.f40812a.setVisibility(8);
                this.f40813b.setVisibility(0);
                this.f40813b.setAnimation(this.o, null);
                this.f40813b.setProgress(0.0f);
                this.f40813b.playAnimation();
            }
        } catch (Throwable unused) {
            this.m.z(FastLinkDataManager.f39314c);
        }
    }

    public void c(int i) {
        FastlinkStat.a("0", String.valueOf(i));
        this.u = false;
        this.j.setText(i + "%");
        this.j.setAlpha(0.0f);
        if (QBOperationManager.a(22)) {
            PhoneUpShowManager.getInstance().a(true);
            try {
                if (TextUtils.isEmpty(e)) {
                    this.m.z(FastLinkDataManager.f39314c);
                } else {
                    this.f40812a.setVisibility(0);
                    this.f40813b.setVisibility(8);
                    this.o = new JsonReader(new FileReader(e));
                    this.f40812a.setAnimation(this.o, null);
                    this.f40812a.setProgress(0.0f);
                    this.f40812a.playAnimation();
                    QBTask.a(DateUtils.TEN_SECOND).a((Continuation<Void, TContinuationResult>) new Continuation<Void, Object>() {
                        @Override
                        public Object then(QBTask<Void> qBTask) throws Exception {
                            PhoneUpShowManager.getInstance().a(false);
                            return null;
                        }
                    });
                    PublicSettingManager.a().setLong("PHONE_UP_LAST_UPDATE_TIME", System.currentTimeMillis());
                }
            } catch (Throwable unused) {
                this.m.z(FastLinkDataManager.f39314c);
            }
        }
    }

    @Override
    public void onClick(View view) {
        EventCollector.getInstance().onViewClickedBefore(view);
        FastlinkStat.a("click:4:" + FastLinkDataManager.f39314c);
        ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams(this.r).b(1));
        EventCollector.getInstance().onViewClicked(view);
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        float f2;
        int action = motionEvent.getAction();
        if (action == 0) {
            f2 = 0.5f;
        } else {
            if (action != 1) {
                return false;
            }
            f2 = 1.0f;
        }
        setAlpha(f2);
        return false;
    }

    public void setUrl(String str) {
        this.r = str;
    }

    public void setValue(int i) {
        this.i = i;
        PublicSettingManager.a().setInt("PHONE_UP_LAST_VALUE", this.i);
    }

    @Override
    public void switchSkin() {
        super.switchSkin();
        h();
    }
}