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

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


package com.tencent.mtt.external.explorerone.camera.page;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.utils.NotchUtil;
import com.tencent.mtt.base.webview.QBWebView;
import com.tencent.mtt.base.webview.common.QBWebSettings;
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.UrlParams;
import com.tencent.mtt.browser.window.WindowManager;
import com.tencent.mtt.businesscenter.facade.IFrameworkDelegate;
import com.tencent.mtt.external.explorerone.camera.CameraExplorerContainer;
import com.tencent.mtt.external.explorerone.camera.CameraNativePageBase;
import com.tencent.mtt.external.explorerone.camera.data.CameraTranslateQuciData;
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.common.QBTextView;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import qb.a.e;
import qb.a.f;

public class CameraTranslateWordPage extends CameraNativePageBase implements View.OnClickListener {
    private static final int n = MttResources.g(f.U);
    private static final int o = MttResources.g(f.v);
    private static final int p = MttResources.g(f.f);
    private Paint h;
    private QBImageView i;
    private QBImageView j;
    private QBImageView k;
    private QBTextView l;
    private QBWebView m;
    private CameraTranslateQuciData q;

    public CameraTranslateWordPage(Context context, CameraExplorerContainer cameraExplorerContainer, CameraTranslateQuciData cameraTranslateQuciData) {
        super(context, cameraExplorerContainer);
        this.i = null;
        this.j = null;
        this.k = null;
        this.l = null;
        this.m = null;
        this.q = cameraTranslateQuciData;
        a();
    }

    private void a() {
        setBackgroundNormalIds(0, R.color.white);
        this.h = new Paint();
        QBFrameLayout qBFrameLayout = new QBFrameLayout(getContext()) {
            @Override
            public void dispatchDraw(Canvas canvas) {
                super.dispatchDraw(canvas);
                CameraTranslateWordPage.this.h.setColor(MttResources.c(R.color.jm));
                CameraTranslateWordPage.this.h.setStrokeWidth(1);
                canvas.drawLine(0.0f, getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, CameraTranslateWordPage.this.h);
            }
        };
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, n);
        layoutParams.gravity = 48;
        layoutParams.topMargin = (!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0;
        addView(qBFrameLayout, layoutParams);
        this.i = new QBImageView(getContext());
        this.i.setImageNormalPressIds(R.drawable.a_7, R.color.jr, 0, e.ag);
        this.i.setOnClickListener(this);
        this.i.setId(1);
        FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2, 3);
        this.i.setPadding(o, 0, p, 0);
        layoutParams2.gravity = 16;
        qBFrameLayout.addView(this.i, layoutParams2);
        this.l = new QBTextView(getContext().getApplicationContext());
        this.l.setTextColor(MttResources.c(R.color.jr));
        this.l.setTextSize(MttResources.h(f.da));
        this.l.setGravity(17);
        this.l.setText(MttResources.l(R.string.u_));
        this.l.setSingleLine(true);
        this.l.setEllipsize(TextUtils.TruncateAt.END);
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams3.gravity = 17;
        qBFrameLayout.addView(this.l, layoutParams3);
        this.k = new QBImageView(getContext());
        this.k.setImageNormalPressIds(R.drawable.aac, R.color.kn, 0, R.color.k3);
        this.k.setOnClickListener(this);
        this.k.setId(2);
        FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(-2, -2);
        layoutParams4.rightMargin = MttResources.g(f.aj);
        layoutParams4.gravity = 21;
        qBFrameLayout.addView(this.k, layoutParams4);
        this.j = new QBImageView(getContext());
        this.j.setImageNormalPressIds(R.drawable.a_e, R.color.kn, 0, R.color.k3);
        this.j.setOnClickListener(this);
        this.j.setId(3);
        FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-2, -2);
        this.j.setPadding(p, 0, MttResources.g(f.r), 0);
        layoutParams5.gravity = 21;
        qBFrameLayout.addView(this.j, layoutParams5);
        this.m = new QBWebView(getContext());
        this.m.addDefaultJavaScriptInterface();
        QBWebView qBWebView = this.m;
        qBWebView.mCanHorizontalScroll = false;
        qBWebView.setWebCoreNightModeEnabled(false);
        if (this.m.getSettingsExtension() != null) {
            this.m.getSettingsExtension().c(true);
        }
        QBWebView qBWebView2 = this.m;
        if (qBWebView2 != null) {
            qBWebView2.setVerticalScrollBarEnabled(false);
            qBWebView2.setHorizontalScrollBarEnabled(false);
            qBWebView2.setBackgroundColor(0);
        }
        this.m.setVerticalScrollBarEnabled(false);
        this.m.setHorizontalScrollBarEnabled(false);
        this.m.getQBSettings().m(true);
        this.m.getQBSettings().n(false);
        this.m.setWebViewType(6);
        this.m.setBackgroundColor(0);
        QBWebSettings qBSettings = this.m.getQBSettings();
        if (qBSettings != null) {
            qBSettings.a(true);
            qBSettings.o(true);
        }
        FrameLayout.LayoutParams layoutParams6 = new FrameLayout.LayoutParams(-1, -1);
        layoutParams6.topMargin = n + ((!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0);
        addView(this.m, layoutParams6);
        this.m.loadUrl(this.q.f);
    }

    @Override
    public void active() {
        super.active();
        this.m.active();
    }

    @Override
    public void back(boolean z) {
        this.m.goBack();
    }

    @Override
    public boolean canGoBack() {
        QBWebView qBWebView = this.m;
        if (qBWebView == null || !qBWebView.canGoBack()) {
            return super.canGoBack();
        }
        return true;
    }

    @Override
    public void deactive() {
        super.deactive();
        this.m.deactive();
    }

    @Override
    public void destroy() {
        super.destroy();
        this.m.destroy();
    }

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

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

    @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) {
        EventCollector.getInstance().onViewClickedBefore(view);
        if (view != null) {
            int id = view.getId();
            if (id == 1) {
                PageFrame s = WindowManager.a().s();
                if (s != null) {
                    s.back(false);
                }
            } else if (id == 2) {
                ShareBundle shareBundle = new ShareBundle(0);
                shareBundle.f45014b = this.q.f51634b;
                shareBundle.f45015c = this.q.e;
                shareBundle.f45016d = this.q.f;
                ((IShare) QBContext.getInstance().getService(IShare.class)).doShare(shareBundle);
            } else if (id == 3) {
                ((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("https://bbs.mb.qq.com/mobilefb/fbTree?serviceId=69&levelinfos=45dfe293-9d4a-46d6-8b47-7a5b07046b74&tname=%E6%89%AB%E4%B8%80%E6%89%AB").f(132).b(1).c(4).a((Bundle) null));
            }
        }
        EventCollector.getInstance().onViewClicked(view);
    }

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