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

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


package com.tencent.mtt.external.explorerone.newcamera.ar.page;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.view.View;
import android.widget.FrameLayout;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.animation.QBViewPropertyAnimator;
import com.tencent.mtt.animator.ViewPropertyAnimatorBase;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.stat.StatManager;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.NotchUtil;
import com.tencent.mtt.browser.share.facade.IShare;
import com.tencent.mtt.browser.share.facade.ShareBundle;
import com.tencent.mtt.browser.window.IPage;
import com.tencent.mtt.browser.window.IWebView;
import com.tencent.mtt.browser.window.PageFrame;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.external.explorerone.camera.CameraExplorerContainer;
import com.tencent.mtt.external.explorerone.camera.CameraNativePageBase;
import com.tencent.mtt.external.explorerone.camera.data.ARMarkerInfo;
import com.tencent.mtt.external.explorerone.camera.utils.ARMathUtils;
import com.tencent.mtt.external.explorerone.camera.utils.CameraViewUtils;
import com.tencent.mtt.external.explorerone.facade.IExploreCameraService;
import com.tencent.mtt.external.explorerone.newcamera.ar.ui.CameraMarkerBaseGLView;
import com.tencent.mtt.external.explorerone.newcamera.ar.ui.CameraMarkerGuideView;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.setting.BaseSettings;
import com.tencent.mtt.view.common.QBImageView;
import com.tencent.mtt.view.dialog.popmenu.QBPopupMenu;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import qb.a.e;
import qb.a.f;
import qb.a.g;

public class CameraMarkerPage extends CameraNativePageBase implements View.OnClickListener {
    private static final int o = MttResources.h(f.u);
    private static final int p = MttResources.h(f.m);
    private static int q = MttResources.h(f.T);
    private CameraMarkerBaseGLView h;
    private QBImageView i;
    private CameraMarkerGuideView j;
    private ARMarkerInfo k;
    private QBImageView l;
    private QBImageView m;
    private QBPopupMenu n;

    public CameraMarkerPage(Context context, CameraExplorerContainer cameraExplorerContainer, ARMarkerInfo aRMarkerInfo) {
        super(context, cameraExplorerContainer);
        this.j = null;
        this.k = aRMarkerInfo;
        d();
        StatManager.b().c("BWAR6_1");
    }

    private void d() {
        this.h = new CameraMarkerBaseGLView(getContext(), this.k, this);
        addView(this.h, new FrameLayout.LayoutParams(-1, -1));
        b(true);
        b();
        this.l = new QBImageView(getContext());
        this.l.setId(1003);
        this.l.setImageNormalPressIds(R.drawable.aap, 0, 0, R.color.k3);
        this.l.setOnClickListener(this);
        QBImageView qBImageView = this.l;
        int i = o;
        int i2 = p;
        qBImageView.setPadding(i, i2, i, i2);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2, 51);
        layoutParams.topMargin = (!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0;
        addView(this.l, layoutParams);
        this.m = new QBImageView(getContext());
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams2.gravity = 53;
        layoutParams2.topMargin = (!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0;
        this.m.setPadding(MttResources.h(f.r), MttResources.h(f.j), MttResources.h(f.r), 0);
        this.m.setImageNormalPressIds(g.aZ, R.color.km, 0, e.ag);
        this.m.setOnClickListener(this);
        this.m.setId(1004);
        addView(this.m, layoutParams2);
    }

    protected void a() {
        if (this.j == null) {
            this.j = new CameraMarkerGuideView(getContext());
            this.j.a(this.h, this.k);
            FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(CameraMarkerGuideView.f52206a, CameraMarkerGuideView.f52206a);
            ARMathUtils.XY c2 = this.k.c();
            int i = (int) (c2.f51754a - (CameraMarkerGuideView.f52206a / 2));
            int i2 = (int) (c2.f51755b - (CameraMarkerGuideView.f52206a / 2));
            if (i < 0) {
                i = 0;
            }
            layoutParams.leftMargin = i;
            if (i2 < 0) {
                i2 = 0;
            }
            layoutParams.topMargin = i2;
            addView(this.j, layoutParams);
        }
    }

    public void a(boolean z) {
        CameraViewUtils.a(this.m, z ? 0 : 8);
    }

    @Override
    public void active() {
        super.active();
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.l();
        }
    }

    protected void b() {
        a();
        ViewPropertyAnimatorBase a2 = QBViewPropertyAnimator.a(this.j);
        a2.d();
        a2.a(400L);
        a2.b();
    }

    public void b(boolean z) {
        if (z) {
            if (this.i == null) {
                this.i = new QBImageView(getContext());
                addView(this.i, new FrameLayout.LayoutParams(-1, -1));
            }
            Bitmap bitmap = this.k.l;
            if (bitmap == null || bitmap.isRecycled()) {
                return;
            }
            this.i.setImageBitmap(bitmap);
            return;
        }
        CameraViewUtils.a(this.i, 8);
        CameraViewUtils.a(this.j, 8);
        QBImageView qBImageView = this.i;
        if (qBImageView != null && qBImageView.getParent() == this) {
            this.i.setImageDrawable(null);
            removeView(this.i);
            this.i = null;
        }
        c();
    }

    @Override
    public void back(boolean z) {
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.a(z);
        } else {
            super.back(z);
        }
    }

    protected void c() {
        CameraMarkerGuideView cameraMarkerGuideView = this.j;
        if (cameraMarkerGuideView != null) {
            if (cameraMarkerGuideView.getParent() == this) {
                removeView(this.j);
            }
            this.j = null;
        }
    }

    @Override
    public boolean canGoBack() {
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        return cameraMarkerBaseGLView != null ? cameraMarkerBaseGLView.a() : super.canGoBack();
    }

    @Override
    public void deactive() {
        super.deactive();
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.m();
        }
    }

    @Override
    public void destroy() {
        super.destroy();
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.p();
        }
    }

    @Override
    public boolean edgeBackforward() {
        return false;
    }

    @Override
    public IPage.INSTANT_TYPE getInstType() {
        return IPage.INSTANT_TYPE.SIGLE_TYPE_IN_GLOBAL;
    }

    @Override
    public String getPageTitle() {
        return MttResources.l(R.string.t6);
    }

    @Override
    public IPage.POP_TYPE getPopType() {
        return IPage.POP_TYPE.ONLY_SELF;
    }

    @Override
    public boolean isForcePortalScreen() {
        return true;
    }

    @Override
    public boolean isNeedBackAnim() {
        return false;
    }

    @Override
    public void onClick(View view) {
        StatManager b2;
        String str;
        EventCollector.getInstance().onViewClickedBefore(view);
        switch (view.getId()) {
            case 1000:
                this.n.dismiss();
                ShareBundle shareBundle = new ShareBundle(0);
                shareBundle.f45014b = MttResources.l(R.string.qy);
                shareBundle.f45015c = MttResources.l(R.string.qz);
                shareBundle.f45016d = "https://res.imtt.qq.com/webar/dist/html/share.html";
                shareBundle.e = "https://res.imtt.qq.com/camera/qige_share.png";
                IShare iShare = (IShare) QBContext.getInstance().getService(IShare.class);
                if (iShare != null) {
                    iShare.doShare(shareBundle);
                }
                b2 = StatManager.b();
                str = "BWAR6_4";
                break;
            case 1001:
                this.n.dismiss();
                this.h.h();
                b2 = StatManager.b();
                str = "BWAR6_5";
                break;
            case 1002:
                this.n.dismiss();
                if (!this.k.d().mFromMore) {
                    ((IExploreCameraService) QBContext.getInstance().getService(IExploreCameraService.class)).startARExplore(2, IExploreCameraService.SwitchMethod.EXPLORE_TYPE_SLAM, null);
                }
                b2 = StatManager.b();
                str = "BWAR6_6";
                break;
            case 1003:
                PageFrame s = WindowManager.a().s();
                if (s != null) {
                    s.back(false);
                }
                b2 = StatManager.b();
                str = "BWAR6_2";
                break;
            case 1004:
                this.n = new QBPopupMenu(getContext());
                this.n.a(new Point(DeviceUtils.af() - MttResources.s(4), q + ((!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0)));
                this.n.d(200);
                this.n.b(1000, MttResources.l(R.string.r4), this);
                this.n.b(1001, MttResources.l(R.string.r3), this);
                this.n.b(1002, MttResources.l(R.string.r5), this);
                this.n.show();
                b2 = StatManager.b();
                str = "BWAR6_3";
                break;
        }
        b2.c(str);
        EventCollector.getInstance().onViewClicked(view);
    }

    @Override
    public void onStart() {
        super.onStart();
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.n();
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.o();
        }
    }

    @Override
    public void preActive() {
        super.preActive();
        CameraMarkerBaseGLView cameraMarkerBaseGLView = this.h;
        if (cameraMarkerBaseGLView != null) {
            cameraMarkerBaseGLView.k();
        }
    }

    @Override
    public IWebView.STATUS_BAR statusBarType() {
        return IWebView.STATUS_BAR.NO_SHOW_LIGHT;
    }
}