QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 CameraTranslateResultView.java 源代码,内容仅作参考
package com.tencent.mtt.external.explorerone.newcamera.scan.translate;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.EasyRecyclerView;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.tencent.common.http.NetUtils;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.connect.common.Constants;
import com.tencent.luggage.wxa.gq.a;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
import com.tencent.mtt.base.skin.MttResources;
import com.tencent.mtt.base.utils.DeviceUtils;
import com.tencent.mtt.base.utils.MttFileUtils;
import com.tencent.mtt.base.utils.NotchUtil;
import com.tencent.mtt.browser.engine.clipboard.ClipboardManager;
import com.tencent.mtt.browser.memstat.facade.IMemoryUsageStatService;
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.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.businesscenter.facade.IHostFileServer;
import com.tencent.mtt.external.explorerone.camera.data.ARTranslateInfo;
import com.tencent.mtt.external.explorerone.camera.data.CameraPanelShareData;
import com.tencent.mtt.external.explorerone.camera.data.TranslateItemInfo;
import com.tencent.mtt.external.explorerone.camera.data.share.CameraShareBundleData;
import com.tencent.mtt.external.explorerone.camera.gdi.GdiPaint;
import com.tencent.mtt.external.explorerone.camera.utils.CameraPanelUIUtils;
import com.tencent.mtt.external.explorerone.camera.utils.CameraStatConst;
import com.tencent.mtt.external.explorerone.camera.utils.CameraViewUtils;
import com.tencent.mtt.external.explorerone.camera.utils.NewCameraDataReporter;
import com.tencent.mtt.external.explorerone.camera.utils.NewCameraDataReporterV3;
import com.tencent.mtt.external.explorerone.newcamera.scan.framework.base.ui.panel.ICameraPanelFreezeView;
import com.tencent.mtt.external.explorerone.newcamera.scan.framework.base.ui.panel.ICameraPanelResultView;
import com.tencent.mtt.external.explorerone.newcamera.scan.framework.base.ui.panel.ICameraResultViewNewListener;
import com.tencent.mtt.external.explorerone.newcamera.scan.translate.share.CameraTranslateShareData;
import com.tencent.mtt.external.explorerone.newcamera.scan.translate.ui.CameraTranslateHolderProducer;
import com.tencent.mtt.external.explorerone.newcamera.scan.translate.ui.TranslateSelectItemView;
import com.tencent.mtt.nxeasy.listview.base.IHoldersChangedListener;
import com.tencent.mtt.nxeasy.listview.base.RecyclerViewAdapter;
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.dialog.alert.MttLoadingDialog;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.mtt.zoomimage.TouchImageView;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.tencent.tar.deprecated.CameraUtils;
import java.io.File;
import java.util.ArrayList;
import qb.a.f;
public class CameraTranslateResultView extends QBFrameLayout implements View.OnClickListener, ICameraPanelResultView, IHoldersChangedListener {
private static final int k = MttResources.g(f.U);
private static final int l;
private static final int m;
private static final int n;
private float A;
private TouchImageView B;
private boolean C;
private boolean D;
private boolean E;
private Matrix F;
private float G;
private byte H;
private boolean I;
private Bitmap J;
private Bitmap K;
private Bitmap L;
private Bitmap M;
private Object N;
private ICameraResultViewNewListener O;
private ICameraPanelFreezeView P;
private TranslateSelectItemView Q;
private MttLoadingDialog R;
private CameraTranslateHolderProducer S;
int f53536a;
int f53537b;
Paint f53538c;
public QBImageView f53539d;
public Handler e;
int f;
int g;
private boolean h;
private int i;
private int j;
private QBTextView o;
private QBTextView p;
private QBImageView q;
private QBImageView r;
private QBImageView s;
private QBImageView t;
private QBImageView u;
private QBImageView v;
private EasyRecyclerView w;
private RecyclerViewAdapter x;
private ARTranslateInfo y;
private int z;
class AnonymousClass4 implements Runnable {
final boolean f53544a;
final File f53545b;
final CameraTranslateResultView f53546c;
@Override
public void run() {
if (!this.f53544a || this.f53545b == null) {
this.f53546c.E = false;
MttToaster.show(R.string.t2, 0);
} else {
MttToaster.show(R.string.u2, 0);
this.f53546c.E = true;
}
}
}
static {
l = (!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0;
m = MttResources.g(f.r);
n = MttResources.g(f.f);
}
public CameraTranslateResultView(Context context, ICameraPanelFreezeView iCameraPanelFreezeView) {
super(context);
this.h = false;
this.i = MttResources.c(R.color.ky);
this.j = MttResources.c(R.color.kz);
this.o = null;
this.p = null;
this.q = null;
this.r = null;
this.s = null;
this.t = null;
this.u = null;
this.v = null;
this.w = null;
this.y = null;
this.z = 0;
this.f53536a = 0;
this.f53537b = 0;
this.A = 0.0f;
this.f53538c = new Paint(1);
this.C = true;
this.D = false;
this.E = false;
this.H = (byte) 0;
this.I = false;
this.e = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message message) {
super.handleMessage(message);
if (message.what == 0 && (message.obj instanceof Bitmap)) {
CameraTranslateResultView.this.setZoomBitmap((Bitmap) message.obj);
}
}
};
this.N = new Object();
this.f = MttResources.c(R.color.gq);
this.g = MttResources.h(f.cD);
this.P = iCameraPanelFreezeView;
d();
GdiPaint.a(this.f);
GdiPaint.b(this.g);
}
public Bitmap a(Bitmap bitmap) {
if (bitmap == null) {
return null;
}
try {
if (bitmap.isRecycled()) {
return null;
}
int a2 = CameraViewUtils.a(0.128f);
int a3 = CameraViewUtils.a(0.026f);
int a4 = CameraViewUtils.a(0.052f);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int af = DeviceUtils.af() > width ? DeviceUtils.af() : width;
float f = af / width;
int i = (int) (height * f);
Bitmap createBitmap = Bitmap.createBitmap(af + 2, a2 + i + 2, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(createBitmap);
canvas.drawColor(-1);
Matrix matrix = new Matrix();
matrix.reset();
float f2 = 1;
matrix.postTranslate(f2, f2);
matrix.preScale(f, f);
canvas.drawBitmap(bitmap, matrix, null);
Bitmap p = MttResources.p(R.drawable.aad);
matrix.reset();
int a5 = CameraViewUtils.a(0.075f);
int b2 = (af - CameraViewUtils.b(0.075f)) - a5;
float height2 = a5 / p.getHeight();
int i2 = i + 1;
matrix.postTranslate(b2 + 1, a3 + i2);
matrix.preScale(height2, height2);
canvas.drawBitmap(p, matrix, null);
Bitmap p2 = MttResources.p(R.drawable.b6s);
float a6 = CameraViewUtils.a(0.024f) / p2.getHeight();
matrix.reset();
matrix.preScale(a6, a6);
matrix.postTranslate(CameraViewUtils.b(0.065f) + 1, i2 + a4);
canvas.drawBitmap(p2, matrix, null);
return createBitmap;
} catch (Exception unused) {
return null;
} catch (OutOfMemoryError unused2) {
((IMemoryUsageStatService) QBContext.getInstance().getService(IMemoryUsageStatService.class)).handleOOMError(0);
return null;
}
}
private void a(int i, boolean z) {
this.z = i;
if (i == 0) {
this.o.setContentDescription(MttResources.l(R.string.tq));
this.o.setText(MttResources.l(R.string.tq));
this.o.setSelected(false);
setBackgroundColor(-16777216);
EasyRecyclerView easyRecyclerView = this.w;
if (easyRecyclerView != null) {
easyRecyclerView.setVisibility(8);
}
this.u.setVisibility(8);
this.f53539d.setVisibility(8);
this.B.setVisibility(0);
this.s.setVisibility(0);
b(z);
return;
}
if (i != 1) {
return;
}
this.o.setContentDescription(MttResources.l(R.string.tp));
this.o.setText(MttResources.l(R.string.tp));
this.o.setSelected(true);
setBackgroundColor(MttResources.c(R.color.kx));
this.B.setVisibility(8);
this.s.setVisibility(8);
EasyRecyclerView easyRecyclerView2 = this.w;
if (easyRecyclerView2 != null) {
easyRecyclerView2.setVisibility(0);
}
this.u.setVisibility(0);
a();
a(this.y.f51477a);
postInvalidate();
}
private void d() {
this.f53539d = new QBImageView(getContext());
this.f53539d.setBackgroundNormalIds(0, R.color.kr);
addView(this.f53539d, new FrameLayout.LayoutParams(-1, -1));
this.f53539d.setVisibility(8);
this.B = new TouchImageView(getContext());
this.B.setId(8);
this.B.setOnClickListener(this);
addView(this.B, new FrameLayout.LayoutParams(-1, -1));
l();
QBFrameLayout qBFrameLayout = new QBFrameLayout(getContext());
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, k);
layoutParams.gravity = 48;
if (DeviceUtils.K() <= 18) {
layoutParams.topMargin = 0;
} else {
layoutParams.topMargin = l;
}
addView(qBFrameLayout, layoutParams);
this.q = new QBImageView(getContext());
this.q.setImageNormalPressIds(R.drawable.aap, R.color.kl, 0, R.color.k3);
this.q.setOnClickListener(this);
this.q.setId(2);
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2, 3);
this.q.setPadding(m, 0, n, 0);
layoutParams2.gravity = 16;
qBFrameLayout.addView(this.q, layoutParams2);
this.Q = new TranslateSelectItemView(getContext(), CameraUtils.CURRENT_L_LANGUAGE, CameraUtils.DEFAULT_R_LANGUAGE, R.drawable.aat);
this.Q.setGravity(17);
this.Q.setPadding(MttResources.s(13), 0, MttResources.s(13), 0);
this.Q.setBackgroundNormalIds(R.drawable.a_y, 0);
this.Q.setOnClickListener(this);
this.Q.setId(9);
FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(MttResources.s(89), MttResources.s(23), 21);
layoutParams3.rightMargin = MttResources.g(R.dimen.dp_188);
qBFrameLayout.addView(this.Q, layoutParams3);
this.s = new QBImageView(getContext());
this.s.setImageNormalPressIds(R.drawable.aa_, R.color.kl, 0, R.color.k3);
this.s.setOnClickListener(this);
this.s.setId(5);
FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(-2, -2);
layoutParams4.gravity = 21;
layoutParams4.rightMargin = MttResources.g(f.bm);
qBFrameLayout.addView(this.s, layoutParams4);
this.u = new QBImageView(getContext());
this.u.setImageNormalPressIds(R.drawable.a_b, R.color.kl, 0, R.color.k3);
this.u.setOnClickListener(this);
this.u.setId(6);
FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-2, -2);
layoutParams5.gravity = 21;
layoutParams5.rightMargin = MttResources.g(f.bm);
qBFrameLayout.addView(this.u, layoutParams5);
this.u.setVisibility(8);
this.t = new QBImageView(getContext());
this.t.setImageNormalPressIds(R.drawable.aaa, R.color.kl, 0, R.color.k3);
this.t.setOnClickListener(this);
this.t.setId(3);
FrameLayout.LayoutParams layoutParams6 = new FrameLayout.LayoutParams(-2, -2);
layoutParams6.rightMargin = MttResources.g(f.aw);
layoutParams6.gravity = 21;
qBFrameLayout.addView(this.t, layoutParams6);
this.r = new QBImageView(getContext());
this.r.setImageNormalPressIds(R.drawable.a_d, R.color.kl, 0, R.color.k3);
this.r.setOnClickListener(this);
this.r.setId(4);
FrameLayout.LayoutParams layoutParams7 = new FrameLayout.LayoutParams(-2, -2);
this.r.setPadding(n, 0, MttResources.g(f.r), 0);
layoutParams7.gravity = 21;
qBFrameLayout.addView(this.r, layoutParams7);
QBFrameLayout qBFrameLayout2 = new QBFrameLayout(getContext());
qBFrameLayout2.setBackgroundNormalIds(0, R.color.kr);
FrameLayout.LayoutParams layoutParams8 = new FrameLayout.LayoutParams(-1, MttResources.g(f.Y));
layoutParams8.gravity = 80;
addView(qBFrameLayout2, layoutParams8);
QBLinearLayout qBLinearLayout = new QBLinearLayout(getContext());
FrameLayout.LayoutParams layoutParams9 = new FrameLayout.LayoutParams(-2, -1);
layoutParams9.gravity = 1;
qBLinearLayout.setOrientation(0);
qBFrameLayout2.addView(qBLinearLayout, layoutParams9);
this.v = new QBImageView(getContext());
this.v.setImageNormalPressIds(R.drawable.aau, 0, 0, R.color.k3);
LinearLayout.LayoutParams layoutParams10 = new LinearLayout.LayoutParams(-2, -2);
layoutParams10.gravity = 16;
this.v.setId(7);
this.v.setOnClickListener(this);
qBLinearLayout.addView(this.v, layoutParams10);
this.p = new QBTextView(getContext().getApplicationContext());
this.p.setTextColorNormalPressDisableIds(R.color.ks, R.color.kt, 0, 127);
this.p.setText(MttResources.n(R.string.to));
this.p.setContentDescription(MttResources.n(R.string.to));
this.p.setTextSize(MttResources.f(f.cD));
this.p.setId(1);
this.p.setGravity(16);
this.p.setOnClickListener(this);
this.p.setEnabled(true);
this.p.setPadding(MttResources.g(f.r), 0, 0, 0);
FrameLayout.LayoutParams layoutParams11 = new FrameLayout.LayoutParams(-2, -1);
layoutParams11.gravity = 3;
qBFrameLayout2.addView(this.p, layoutParams11);
this.o = new QBTextView(getContext().getApplicationContext());
this.o.setTextColorNormalPressDisableIds(R.color.ks, R.color.kt, 0, 127);
this.o.setText(MttResources.l(R.string.tq));
this.o.setTextSize(MttResources.f(f.cD));
this.o.setId(0);
this.o.setGravity(16);
this.o.setOnClickListener(this);
this.o.setEnabled(true);
FrameLayout.LayoutParams layoutParams12 = new FrameLayout.LayoutParams(-2, -1);
layoutParams12.gravity = 5;
this.o.setPadding(0, 0, MttResources.g(f.r), 0);
qBFrameLayout2.addView(this.o, layoutParams12);
}
private String getListContent() {
ARTranslateInfo aRTranslateInfo = this.y;
int i = 0;
if (aRTranslateInfo == null || aRTranslateInfo.f51477a == null) {
MttToaster.show(MttResources.l(R.string.u4), 0);
return "";
}
ArrayList<TranslateItemInfo> arrayList = this.y.f51477a;
StringBuilder sb = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
while (true) {
if (i >= arrayList.size()) {
break;
}
TranslateItemInfo translateItemInfo = arrayList.get(i);
if (!TextUtils.isEmpty(translateItemInfo.f51640d) && !TextUtils.isEmpty(translateItemInfo.e)) {
if (i > 20) {
sb.append("...");
sb2.append("...");
break;
}
sb.append(translateItemInfo.f51640d);
sb2.append(translateItemInfo.e);
if (i < arrayList.size() - 1) {
sb.append("\r\n");
sb2.append("\r\n");
}
}
i++;
}
return sb.toString() + NetUtils.HTTP_END + sb2.toString();
}
private void l() {
this.S = new CameraTranslateHolderProducer();
this.S.a(this);
this.x = new RecyclerViewAdapter();
this.w = new EasyRecyclerView(getContext());
this.w.setAdapter(this.x);
this.w.setLayoutManager(new LinearLayoutManager(getContext()));
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
this.w.setLayoutParams(layoutParams);
this.w.setPadding(MttResources.g(f.E), 0, MttResources.g(f.E), 0);
layoutParams.topMargin = MttResources.g(f.t) + (DeviceUtils.K() <= 18 ? BaseSettings.a().m() : 0);
layoutParams.bottomMargin = MttResources.g(f.Y);
addView(this.w);
this.w.setVisibility(8);
}
private void m() {
this.D = false;
this.z = 0;
this.y = null;
this.B.setImageDrawable(null);
this.B.setVisibility(8);
setBackgroundColor(0);
c();
Bitmap bitmap = this.K;
if (bitmap != null) {
bitmap.recycle();
this.K = null;
}
}
private void n() {
if (this.E) {
MttToaster.show(R.string.u2, 0);
} else {
BrowserExecutorSupplier.forIoTasks().execute(new Runnable() {
@Override
public void run() {
try {
if (CameraTranslateResultView.this.J != null && !CameraTranslateResultView.this.J.isRecycled()) {
Bitmap a2 = CameraTranslateResultView.this.a(CameraTranslateResultView.this.J);
if (a2 != null && !a2.isRecycled()) {
((IHostFileServer) QBContext.getInstance().getService(IHostFileServer.class)).saveImage(new File(MttFileUtils.a(2), "qb_" + System.currentTimeMillis() + ".png"), a2, true);
return;
}
CameraTranslateResultView.this.E = false;
return;
}
CameraTranslateResultView.this.E = false;
} catch (Throwable unused) {
CameraTranslateResultView.this.E = false;
}
}
});
}
}
private void o() {
ClipboardManager.getInstance().setText(getListContent().toString());
MttToaster.show(MttResources.l(R.string.u5), 0);
CameraStatConst.b("ARTS134");
}
private void p() {
String str;
int i = this.z;
if (i == 1) {
ShareBundle shareBundle = new ShareBundle(2);
shareBundle.D = 22;
shareBundle.f45014b = MttResources.l(R.string.t6);
shareBundle.f45015c = getListContent();
shareBundle.f45016d = "https://res.imtt.qq.com/cam_intro/index.html?v=1499622941940";
IShare iShare = (IShare) QBContext.getInstance().getService(IShare.class);
iShare.addShareStateListener(new IShareStateListener() {
@Override
public void onShareFinished(int i2, int i3) {
if (i2 == 0) {
CameraStatConst.b("ARTS135_1");
}
}
@Override
public void onShareInfoUpdated() {
}
});
iShare.doShare(shareBundle);
str = "ARTS135";
} else {
if (i != 0) {
return;
}
CameraTranslateShareData cameraTranslateShareData = new CameraTranslateShareData();
cameraTranslateShareData.h = new CameraPanelShareData();
cameraTranslateShareData.h.l = new ArrayList<>();
CameraShareBundleData a2 = CameraShareBundleData.a(24);
a2.e = 1;
a2.f = "qb://camera/translateshare";
a2.g = 15;
a2.f51642b = a(this.L);
cameraTranslateShareData.h.l.add(a2);
ICameraResultViewNewListener iCameraResultViewNewListener = this.O;
if (iCameraResultViewNewListener != null) {
iCameraResultViewNewListener.a(100012, cameraTranslateShareData);
}
str = "ARTS130";
}
CameraStatConst.b(str);
}
public void setZoomBitmap(Bitmap bitmap) {
if (bitmap != null) {
this.J = bitmap;
setZoomDrawable(new BitmapDrawable(getResources(), bitmap));
}
}
private void setZoomDrawable(final Drawable drawable) {
this.e.post(new Runnable() {
@Override
public void run() {
TouchImageView touchImageView;
Drawable drawable2;
if (drawable != null) {
CameraTranslateResultView.this.B.setVisibility(0);
touchImageView = CameraTranslateResultView.this.B;
drawable2 = drawable;
} else {
touchImageView = CameraTranslateResultView.this.B;
drawable2 = null;
}
touchImageView.setImageDrawable(drawable2);
CameraTranslateResultView.this.B.invalidate();
}
});
}
public float a(byte b2) {
if (b2 == 1) {
return 90.0f;
}
return b2 == 2 ? -90.0f : 0.0f;
}
protected void a() {
CameraPanelUIUtils.a(this.f53539d, 0);
this.f53539d.setAlpha(200);
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.f53539d, a.ab, 0.0f, 1.0f);
ofFloat.setDuration(500L);
ofFloat.start();
}
public void a(byte b2, ARTranslateInfo aRTranslateInfo, float f) {
TranslateSelectItemView translateSelectItemView;
int i;
if (aRTranslateInfo == null) {
return;
}
this.G = f;
this.y = aRTranslateInfo;
this.H = b2;
if (TextUtils.equals(this.y.f51479c, CameraUtils.DEFAULT_R_LOCALE)) {
this.Q.a(CameraViewUtils.a(this.y.f51478b), CameraUtils.DEFAULT_R_LANGUAGE);
translateSelectItemView = this.Q;
i = 0;
} else {
this.Q.a(CameraViewUtils.a(this.y.f51479c), CameraUtils.DEFAULT_R_LANGUAGE);
translateSelectItemView = this.Q;
i = 180;
}
translateSelectItemView.a(i);
c();
NewCameraDataReporter.a("translate", "", "", "expose", "", this.y != null ? "1" : "0");
}
protected void a(ArrayList<TranslateItemInfo> arrayList) {
CameraTranslateHolderProducer cameraTranslateHolderProducer;
if (arrayList == null || arrayList.size() == 0 || (cameraTranslateHolderProducer = this.S) == null) {
return;
}
cameraTranslateHolderProducer.a(arrayList);
this.S.b();
}
@Override
public void a(boolean z) {
}
public void b() {
Activity a2 = ActivityHandler.b().a();
if (a2 != null) {
if (this.R == null) {
this.R = new MttLoadingDialog(a2);
this.R.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
if (i != 4 || keyEvent.getAction() != 1) {
return false;
}
CameraTranslateResultView.this.c();
return false;
}
});
this.R.show();
}
this.R.a("正在识别中...");
}
}
protected void b(boolean z) {
Bitmap copy;
if (!this.D || z) {
this.D = true;
Bitmap bitmap = this.M;
if (bitmap == null || bitmap.isRecycled() || (copy = this.M.copy(Bitmap.Config.ARGB_8888, true)) == null || copy.isRecycled()) {
return;
}
if (this.F == null) {
this.F = new Matrix();
}
this.F.reset();
this.A = a(this.H);
int width = copy.getWidth() / 2;
int height = copy.getHeight() / 2;
if (((int) this.A) != 0) {
this.F.postTranslate(-width, -height);
this.F.postRotate(-this.A);
this.F.postTranslate(height, width);
}
try {
Bitmap createBitmap = Bitmap.createBitmap(copy, 0, 0, copy.getWidth(), copy.getHeight(), this.F, true);
if (this.K == null) {
this.K = createBitmap.copy(Bitmap.Config.ARGB_8888, true);
}
Canvas canvas = new Canvas(createBitmap);
this.f53538c.reset();
this.f53538c.setColor(this.i);
canvas.drawRect(new Rect(0, 0, createBitmap.getWidth(), createBitmap.getHeight()), this.f53538c);
GdiPaint.a(this.j);
if (Math.abs(this.G) > 30.0f) {
this.G = 0.0f;
}
if (((int) this.G) != 0) {
this.F.reset();
this.F.preTranslate(-width, -height);
this.F.postRotate(this.G);
this.F.postTranslate(width, height);
canvas.setMatrix(this.F);
}
GdiPaint.a(canvas, createBitmap, this.f53538c, this.y.f51477a);
this.F.reset();
this.L = createBitmap;
if (((int) this.A) != 0) {
this.F.postTranslate(-height, -width);
this.F.postRotate(this.A);
this.F.postTranslate(width, height);
try {
this.L = Bitmap.createBitmap(createBitmap, 0, 0, createBitmap.getWidth(), createBitmap.getHeight(), this.F, true);
} catch (OutOfMemoryError unused) {
return;
}
}
this.I = false;
setZoomBitmap(this.L);
if (copy != null) {
copy.recycle();
}
} catch (OutOfMemoryError unused2) {
}
}
}
@Override
public void bB_() {
m();
}
public void c() {
MttLoadingDialog mttLoadingDialog = this.R;
if (mttLoadingDialog != null) {
mttLoadingDialog.dismiss();
this.R = null;
}
TranslateSelectItemView translateSelectItemView = this.Q;
if (translateSelectItemView != null) {
translateSelectItemView.setClickable(true);
}
}
@Override
public void cL_() {
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
if (CameraTranslateResultView.this.x == null || CameraTranslateResultView.this.S == null) {
return;
}
CameraTranslateResultView.this.x.a(CameraTranslateResultView.this.S.aq_());
CameraTranslateResultView.this.x.notifyDataSetChanged();
}
});
}
@Override
public void e() {
if (this.h) {
return;
}
this.h = true;
NewCameraDataReporter.a("translate", "", "", "expose", "", this.y != null ? "1" : "0");
}
@Override
public void f() {
if (this.h) {
this.h = false;
m();
}
}
@Override
public void g() {
f();
}
@Override
public View getView() {
return this;
}
public Bitmap getZoomImage() {
Drawable drawable = this.B.getDrawable();
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
}
return null;
}
@Override
public void h() {
ICameraPanelFreezeView iCameraPanelFreezeView = this.P;
if (iCameraPanelFreezeView != null) {
this.M = iCameraPanelFreezeView.getFreezeBlt();
QBImageView qBImageView = this.f53539d;
if (qBImageView != null) {
qBImageView.setAlpha(1.0f);
this.f53539d.setAlpha(0);
}
}
if (this.y != null) {
setVisibility(0);
this.B.setImageDrawable(null);
a(this.z, false);
}
}
@Override
public void i() {
}
@Override
public boolean k() {
return getVisibility() == 0;
}
@Override
public void onClick(View view) {
String str;
String str2;
Bitmap bitmap;
EventCollector.getInstance().onViewClickedBefore(view);
switch (view.getId()) {
case 0:
a(1 - this.z, false);
if (this.z == 0) {
CameraStatConst.b("ARTS137");
str = "4";
} else {
str = "3";
}
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
break;
case 2:
PageFrame s = WindowManager.a().s();
if (s != null) {
s.back(false);
}
CameraStatConst.b("ARTS142");
NewCameraDataReporterV3.d("click#translate_result#operation_type", "7");
case 1:
ICameraResultViewNewListener iCameraResultViewNewListener = this.O;
if (iCameraResultViewNewListener != null) {
iCameraResultViewNewListener.m();
}
CameraStatConst.b("ARTS136");
str = Constants.VIA_SHARE_TYPE_INFO;
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
break;
case 3:
p();
str = "1";
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
break;
case 4:
((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));
int i = this.z;
if (i != 1) {
str2 = i == 0 ? "ARTS131" : "ARTS131_1";
str = "2";
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
break;
}
CameraStatConst.b(str2);
str = "2";
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
case 5:
n();
CameraStatConst.b("ARTS129");
str = "0";
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
break;
case 6:
o();
str = "5";
NewCameraDataReporterV3.d("click#translate_result#operation_type", str);
break;
case 7:
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("qb://weapp/?package=fanyijun&title=%e7%bf%bb%e8%af%91%e5%90%9b&entry=75052&appid=173").f(132).b(1).c(4).a((Bundle) null));
CameraStatConst.b("ARTS143");
break;
case 8:
if (this.I) {
this.I = false;
bitmap = this.L;
} else {
this.I = true;
bitmap = this.K;
}
setZoomBitmap(bitmap);
break;
case 9:
this.Q.a();
this.Q.setClickable(false);
if (this.O != null) {
Bundle bundle = new Bundle();
if (this.Q.b()) {
bundle.putString("src", CameraUtils.DEFAULT_R_LOCALE);
bundle.putString("dst", CameraViewUtils.b(this.Q.getLanguage()));
} else {
bundle.putString("src", CameraViewUtils.b(this.Q.getLanguage()));
bundle.putString("dst", CameraUtils.DEFAULT_R_LOCALE);
}
this.O.a(100013, bundle);
b();
break;
}
break;
}
EventCollector.getInstance().onViewClicked(view);
}
public void setBindData(ARTranslateInfo aRTranslateInfo) {
MttLoadingDialog mttLoadingDialog;
if (aRTranslateInfo == null || (mttLoadingDialog = this.R) == null || !mttLoadingDialog.isShowing()) {
return;
}
this.Q.a(CameraUtils.CURRENT_L_LANGUAGE, CameraUtils.DEFAULT_R_LANGUAGE);
this.y = aRTranslateInfo;
a(this.z, true);
c();
NewCameraDataReporter.a("translate", "", "", "expose", "", this.y != null ? "1" : "0");
}
@Override
public void setICameraPanelViewListener(ICameraResultViewNewListener iCameraResultViewNewListener) {
this.O = iCameraResultViewNewListener;
}
}