QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685
以下内容为反编译后的 CameraOcrRecoResultView.java 源代码,内容仅作参考
package com.tencent.mtt.external.explorerone.newcamera.scan.ocr;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import com.tencent.beacon.event.open.EventResult;
import com.tencent.common.task.QBTask;
import com.tencent.common.threadpool.BrowserExecutorSupplier;
import com.tencent.mtt.ContextHolder;
import com.tencent.mtt.R;
import com.tencent.mtt.account.base.IAccount;
import com.tencent.mtt.account.base.UserLoginListener;
import com.tencent.mtt.base.functionwindow.ActivityHandler;
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.engine.clipboard.ClipboardManager;
import com.tencent.mtt.browser.share.export.socialshare.qqshare.QQShareActivity;
import com.tencent.mtt.browser.share.facade.IShare;
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.ar.facade.ICameraImageFetcherCallback;
import com.tencent.mtt.external.explorerone.camera.CameraViewConst;
import com.tencent.mtt.external.explorerone.camera.ar.inhost.ARManager;
import com.tencent.mtt.external.explorerone.camera.ar.inhost.utils.CameraImageFetcher;
import com.tencent.mtt.external.explorerone.camera.data.CameraOCRData;
import com.tencent.mtt.external.explorerone.camera.manager.CameraFileDataManager;
import com.tencent.mtt.external.explorerone.camera.utils.CameraPanelUIUtils;
import com.tencent.mtt.external.explorerone.newcamera.camera.utils.CameraUtils;
import com.tencent.mtt.external.explorerone.newcamera.scan.framework.base.ui.panel.CameraPanelConst;
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.ocr.tab.CameraPopupOcrCropTab;
import com.tencent.mtt.external.explorerone.newcamera.scan.ocr.tab.ICameraOcrTabItemView;
import com.tencent.mtt.external.explorerone.newcamera.scan.ocr.ui.CameraOcrCompareView;
import com.tencent.mtt.external.explorerone.newcamera.scan.ocr.ui.CameraOcrInputView;
import com.tencent.mtt.qbcontext.core.QBContext;
import com.tencent.mtt.sdkcontext.SDKContext;
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.common.QBViewResourceManager;
import com.tencent.mtt.view.dialog.alert.MttLoadingDialog;
import com.tencent.mtt.view.dialog.popmenu.QBPopupMenu;
import com.tencent.mtt.view.edittext.base.EditTextViewBaseNew;
import com.tencent.mtt.view.edittext.ui.MttEditTextViewNew;
import com.tencent.mtt.view.layout.QBFrameLayout;
import com.tencent.mtt.view.layout.QBLinearLayout;
import com.tencent.mtt.view.toast.MttToaster;
import com.tencent.qqlive.module.videoreport.collect.EventCollector;
import com.xiaomi.mipush.sdk.Constants;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Callable;
import org.apache.a;
import qb.a.e;
import qb.a.f;
public class CameraOcrRecoResultView extends QBFrameLayout implements View.OnClickListener, ICameraPanelResultView, CameraPopupOcrCropTab.ITabSelectListener, CameraOcrCompareView.ICompareListener, CameraOcrInputView.OcrInputListener {
private static final int p = MttResources.h(f.T);
private QBFrameLayout f53245a;
private QBTextView f53246b;
private CameraOcrResultView f53247c;
private QBFrameLayout f53248d;
private QBImageView e;
private QBTextView f;
private QBLinearLayout g;
private QBImageView h;
private CameraOcrInputView i;
private MttLoadingDialog j;
private QBImageView k;
private CameraOcrCompareView l;
private CameraPopupOcrCropTab m;
private ScrollView n;
private MttEditTextViewNew o;
private CameraOCRData q;
private QBPopupMenu r;
private boolean s;
private a t;
static class AnonymousClass13 {
static final int[] f53256a = new int[ICameraOcrTabItemView.SwitchOcrTabMethod.values().length];
static {
try {
f53256a[ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_DEFAULT.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f53256a[ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_RESULT_SAVE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f53256a[ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_RESULT_COMPARE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f53256a[ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_RESULT_COPY.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
public CameraOcrRecoResultView(Context context) {
super(context);
this.t = new a();
l();
}
public CameraOcrRecoResultView(Context context, CameraOcrResultView cameraOcrResultView) {
super(context);
this.t = new a();
this.f53247c = cameraOcrResultView;
l();
}
private void b(final String str) {
if (TextUtils.isEmpty(str)) {
MttToaster.show(MttResources.l(R.string.u3), 0);
} else {
QBTask.c(new Callable<Void>() {
@Override
public Void call() {
ClipboardManager.getInstance().setText(str);
CameraOcrRecoResultView.this.post(new Runnable() {
@Override
public void run() {
MttToaster.show(MttResources.l(R.string.u5), 0);
}
});
return null;
}
});
}
}
private void l() {
setBackgroundNormalIds(0, R.color.white);
this.f53248d = new QBFrameLayout(getContext());
int m = (!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? CameraPanelConst.e + BaseSettings.a().m() : CameraPanelConst.e;
if (DeviceUtils.K() <= 18) {
m = CameraPanelConst.e;
} else {
this.f53248d.setPadding(0, (!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0, 0, 0);
}
addView(this.f53248d, new FrameLayout.LayoutParams(-1, m, 49));
int i = (CameraPanelConst.e - CameraPanelConst.g) / 2;
this.e = new QBImageView(getContext());
this.e.setContentDescription("返回");
this.e.setImageNormalPressIds(R.drawable.a_7, R.color.jr, 0, e.ag);
this.e.setOnClickListener(this);
this.e.setId(8);
this.e.setPadding(CameraPanelConst.f, i, CameraPanelConst.f, i);
this.f53248d.addView(this.e, new FrameLayout.LayoutParams(CameraPanelConst.g + (CameraPanelConst.f * 2), CameraPanelConst.e, 19));
this.g = new QBLinearLayout(getContext());
this.g.setOrientation(0);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
layoutParams.gravity = 17;
this.f53248d.addView(this.g, layoutParams);
this.f = new QBTextView(getContext().getApplicationContext());
this.f.setSingleLine(true);
this.f.setMaxWidth(CameraPanelUIUtils.a(0.52f));
this.f.setEllipsize(TextUtils.TruncateAt.END);
this.f.setTextColor(MttResources.c(R.color.jr));
this.f.setTextSize(MttResources.h(f.cF));
this.f.setLineSpacing(CameraViewConst.f51202c, 1.0f);
this.f.setGravity(1);
this.f.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
if (CameraOcrRecoResultView.this.q != null && CameraOcrRecoResultView.this.q.f) {
CameraOcrRecoResultView.this.v();
}
EventCollector.getInstance().onViewClicked(view);
}
});
this.g.addView(this.f, new LinearLayout.LayoutParams(-2, -2));
this.h = new QBImageView(getContext());
this.h.setImageNormalPressIds(R.drawable.ayt, R.color.kn, 0, R.color.k3);
this.h.setOnClickListener(this);
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
layoutParams2.leftMargin = MttResources.s(4);
this.h.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
if (CameraOcrRecoResultView.this.q != null && CameraOcrRecoResultView.this.q.f) {
CameraOcrRecoResultView.this.v();
}
EventCollector.getInstance().onViewClicked(view);
}
});
this.g.addView(this.h, layoutParams2);
this.g.setVisibility(8);
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(1);
this.k.setPadding(CameraPanelConst.f, i, CameraPanelConst.f, i);
FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-2, -2);
layoutParams3.gravity = 5;
this.f53248d.addView(this.k, layoutParams3);
this.i = new CameraOcrInputView(getContext());
this.i.setListener(this);
FrameLayout.LayoutParams layoutParams4 = new FrameLayout.LayoutParams(-2, -1);
layoutParams4.gravity = 19;
layoutParams4.leftMargin = CameraPanelUIUtils.a(0.149f);
this.f53248d.addView(this.i, layoutParams4);
this.i.setVisibility(8);
this.n = new ScrollView(getContext());
FrameLayout.LayoutParams layoutParams5 = new FrameLayout.LayoutParams(-1, -1);
layoutParams5.topMargin = m;
layoutParams5.bottomMargin = MttResources.g(R.dimen.k_);
addView(this.n, layoutParams5);
QBLinearLayout qBLinearLayout = new QBLinearLayout(getContext());
qBLinearLayout.setOrientation(1);
qBLinearLayout.setGravity(1);
ViewGroup.MarginLayoutParams marginLayoutParams = new ViewGroup.MarginLayoutParams(-1, -2);
marginLayoutParams.bottomMargin = MttResources.s(10);
this.n.addView(qBLinearLayout, marginLayoutParams);
this.o = new MttEditTextViewNew(getContext()) {
@Override
public boolean canPaste() {
return false;
}
@Override
public void showContextMenu(int i2, int i3) {
super.showContextMenu(i2, MttResources.h(f.I));
}
};
this.o.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
CameraOcrRecoResultView.this.o.setCursorVisible(true);
CameraOcrRecoResultView.this.o.doActive();
EventCollector.getInstance().onViewClicked(view);
}
});
this.o.setPadding(MttResources.s(16), 0, MttResources.s(16), 0);
this.o.setTextColor(MttResources.c(R.color.k1));
this.o.setTextSize(MttResources.h(f.cD));
this.o.setLineSpacing(CameraViewConst.f51202c, 1.0f);
this.o.setGravity(17);
this.o.setEditorActionListener(new EditTextViewBaseNew.OnEditorActionListener() {
@Override
public boolean onEditorAction(EditTextViewBaseNew editTextViewBaseNew, int i2, KeyEvent keyEvent) {
String obj = CameraOcrRecoResultView.this.o.getText().toString();
if (CameraOcrRecoResultView.this.q == null) {
return true;
}
CameraOcrRecoResultView.this.q.f51517d = obj;
return true;
}
});
this.o.addTextChangedListener(new TextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
String obj = editable.toString();
if (CameraOcrRecoResultView.this.q != null) {
CameraOcrRecoResultView.this.q.f51517d = obj;
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) {
}
});
LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(-1, -2);
layoutParams6.gravity = 1;
qBLinearLayout.addView(this.o, layoutParams6);
QBLinearLayout qBLinearLayout2 = new QBLinearLayout(getContext());
qBLinearLayout2.setGravity(16);
qBLinearLayout2.setOrientation(0);
LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams(-2, -2);
layoutParams7.topMargin = MttResources.s(49);
layoutParams7.gravity = 1;
qBLinearLayout.addView(qBLinearLayout2, layoutParams7);
QBImageView qBImageView = new QBImageView(getContext());
qBImageView.setImageNormalIds(R.drawable.f30745bin);
LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams(-2, -2);
layoutParams8.gravity = 16;
qBLinearLayout2.addView(qBImageView, layoutParams8);
QBTextView qBTextView = new QBTextView(getContext().getApplicationContext());
qBTextView.setTextColorNormalIds(R.color.ke);
qBTextView.setText(MttResources.n(R.string.rk));
qBTextView.setTextSize(MttResources.f(f.cA));
FrameLayout.LayoutParams layoutParams9 = new FrameLayout.LayoutParams(-2, -2);
layoutParams9.gravity = 16;
qBLinearLayout2.addView(qBTextView, layoutParams9);
u();
this.f53245a = new QBFrameLayout(getContext());
this.f53245a.setBackgroundNormalIds(QBViewResourceManager.D, e.W);
FrameLayout.LayoutParams layoutParams10 = new FrameLayout.LayoutParams(-1, MttResources.g(R.dimen.k_));
layoutParams10.gravity = 80;
addView(this.f53245a, layoutParams10);
CameraPopupOcrCropTab.CameraOcrCropMenuBuilder cameraOcrCropMenuBuilder = new CameraPopupOcrCropTab.CameraOcrCropMenuBuilder(getContext());
cameraOcrCropMenuBuilder.a(CameraPopupOcrCropTab.f53330b);
cameraOcrCropMenuBuilder.a(CameraPanelUIUtils.a(0.539f));
this.m = cameraOcrCropMenuBuilder.a();
this.m.setOnTabItemSelectedListener(this);
this.f53245a.addView(this.m, new FrameLayout.LayoutParams(-1, CameraPopupOcrCropTab.f53331c, 19));
this.f53246b = new QBTextView(getContext().getApplicationContext());
this.f53246b.setOnClickListener(this);
this.f53246b.setPadding(MttResources.s(15), MttResources.s(5), MttResources.s(15), MttResources.s(5));
this.f53246b.setBackgroundDrawable(MttResources.i(R.drawable.h3));
this.f53246b.setText(MttResources.l(R.string.rp));
this.f53246b.setTextColorNormalIds(R.color.white);
this.f53246b.setId(0);
this.f53246b.setTextSize(MttResources.h(f.cZ));
FrameLayout.LayoutParams layoutParams11 = new FrameLayout.LayoutParams(-2, -2);
layoutParams11.gravity = 21;
layoutParams11.rightMargin = MttResources.s(16);
this.f53245a.addView(this.f53246b, layoutParams11);
}
private void m() {
new CameraImageFetcher("https://res.imtt.qq.com/res_mtt/camera/camera_ocr_preloading_bg.png", new ICameraImageFetcherCallback() {
@Override
public void a(final boolean z, final Bitmap bitmap, String str, int i, int i2) {
BrowserExecutorSupplier.forMainThreadTasks().execute(new Runnable() {
@Override
public void run() {
if (CameraOcrRecoResultView.this.s || !z || bitmap == null) {
return;
}
CameraOcrRecoResultView.this.o.setBackgroundDrawable(new BitmapDrawable(CameraOcrRecoResultView.this.getResources(), bitmap));
}
});
}
}).a();
}
private void n() {
QBPopupMenu qBPopupMenu = this.r;
if (qBPopupMenu != null) {
qBPopupMenu.dismiss();
}
String obj = this.o.getText().toString();
String charSequence = this.f.getText().toString();
if (TextUtils.isEmpty(charSequence)) {
MttToaster.show("标题不能为空", 0);
return;
}
String str = charSequence + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis());
File f = CameraFileDataManager.a().f();
if (CameraFileDataManager.a().a(f, str + ".txt", obj)) {
CameraFileDataManager.a().a("BZOCR021", f.getAbsolutePath(), f.getName());
}
}
private void o() {
QBPopupMenu qBPopupMenu = this.r;
if (qBPopupMenu != null) {
qBPopupMenu.dismiss();
}
final String charSequence = this.f.getText().toString();
if (TextUtils.isEmpty(charSequence)) {
MttToaster.show("标题不能为空", 0);
} else {
a(MttResources.l(R.string.ri));
BrowserExecutorSupplier.backgroundTaskExecutor().execute(new Runnable() {
@Override
public void run() {
String str = charSequence + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis());
int lineHeight = CameraOcrRecoResultView.this.o.getLineHeight() * 30;
int lineCount = CameraOcrRecoResultView.this.o.getLineCount();
final File f = CameraFileDataManager.a().f();
final boolean a2 = CameraFileDataManager.a().a(f, str + ".pdf", CameraOcrRecoResultView.this.o, lineCount, lineHeight);
CameraOcrRecoResultView.this.post(new Runnable() {
@Override
public void run() {
CameraOcrRecoResultView.this.c();
if (a2) {
CameraFileDataManager.a().a("BZOCR021", f.getAbsolutePath(), f.getName());
}
}
});
}
});
}
}
private void p() {
QBPopupMenu qBPopupMenu = this.r;
if (qBPopupMenu != null) {
qBPopupMenu.dismiss();
}
File f = CameraFileDataManager.a().f();
String obj = this.o.getText().toString();
String charSequence = this.f.getText().toString();
String str = f + File.separator + (TextUtils.isEmpty(charSequence) ? MttResources.l(R.string.ro) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis()) : charSequence + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis())) + ".doc";
this.t.a(2, false, MttResources.l(R.string.rj), str, obj);
String[] strArr = new String[1];
for (int i = 0; i < strArr.length; i++) {
strArr[i] = str;
}
if (QBContext.getInstance().getService(IShare.class) != null) {
((IShare) QBContext.getInstance().getService(IShare.class)).sendFilesUsingLocalApps(getContext(), strArr, null);
}
StatManager.b().c("BZOCR015");
}
private void q() {
QBPopupMenu qBPopupMenu = this.r;
if (qBPopupMenu != null) {
qBPopupMenu.dismiss();
}
String obj = this.o.getText().toString();
String charSequence = this.f.getText().toString();
String str = TextUtils.isEmpty(charSequence) ? MttResources.l(R.string.ro) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis()) : charSequence + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis());
File f = CameraFileDataManager.a().f();
String str2 = str + ".txt";
if (CameraFileDataManager.a().a(f, str2, obj)) {
String[] strArr = new String[1];
for (int i = 0; i < strArr.length; i++) {
strArr[i] = f + File.separator + str2;
}
if (QBContext.getInstance().getService(IShare.class) != null) {
((IShare) QBContext.getInstance().getService(IShare.class)).sendFilesUsingLocalApps(getContext(), strArr, null);
}
}
StatManager.b().c("BZOCR014");
}
private void r() {
QBPopupMenu qBPopupMenu = this.r;
if (qBPopupMenu != null) {
qBPopupMenu.dismiss();
}
a(MttResources.l(R.string.rj));
BrowserExecutorSupplier.backgroundTaskExecutor().execute(new Runnable() {
@Override
public void run() {
String charSequence = CameraOcrRecoResultView.this.f.getText().toString();
String str = TextUtils.isEmpty(charSequence) ? MttResources.l(R.string.ro) + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis()) : charSequence + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis());
int lineHeight = CameraOcrRecoResultView.this.o.getLineHeight() * 30;
int lineCount = CameraOcrRecoResultView.this.o.getLineCount();
File f = CameraFileDataManager.a().f();
try {
if (!f.exists()) {
f.createNewFile();
}
} catch (IOException unused) {
}
String str2 = str + ".pdf";
final boolean a2 = CameraFileDataManager.a().a(f, str2, CameraOcrRecoResultView.this.o, lineCount, lineHeight);
final String[] strArr = new String[1];
for (int i = 0; i < strArr.length; i++) {
strArr[i] = f + File.separator + str2;
}
CameraOcrRecoResultView.this.post(new Runnable() {
@Override
public void run() {
CameraOcrRecoResultView.this.c();
if (!a2 || QBContext.getInstance().getService(IShare.class) == null) {
return;
}
((IShare) QBContext.getInstance().getService(IShare.class)).sendFilesUsingLocalApps(CameraOcrRecoResultView.this.getContext(), strArr, null);
}
});
}
});
StatManager.b().c("BZOCR013");
}
private void s() {
int af = DeviceUtils.af() - MttResources.s(4);
int m = p + ((!BaseSettings.a().l() || NotchUtil.a(ContextHolder.getAppContext())) ? BaseSettings.a().m() : 0);
this.r = new QBPopupMenu(getContext());
this.r.a(new Point(af, m));
this.r.d(200);
this.r.b(2, MttResources.l(R.string.rz), this);
this.r.b(3, MttResources.l(R.string.s0), this);
this.r.b(4, MttResources.l(R.string.f30782rx), this);
this.r.show();
}
private void t() {
CameraOcrResultView cameraOcrResultView = this.f53247c;
if (cameraOcrResultView != null) {
cameraOcrResultView.a(0);
bB_();
} else {
((IFrameworkDelegate) QBContext.getInstance().getService(IFrameworkDelegate.class)).doLoad(new UrlParams("qb://camera?switchtype=6").b(1).c(0).a((Bundle) null));
}
StatManager.b().c("BZOCR020");
}
private void u() {
this.l = new CameraOcrCompareView(getContext());
this.l.setCompareListener(this);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, CameraOcrCompareView.f53344a);
layoutParams.gravity = 80;
addView(this.l, layoutParams);
this.l.setTranslationY(CameraOcrCompareView.f53344a);
}
public void v() {
if (!((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo().isLogined()) {
Bundle bundle = new Bundle();
bundle.putInt(QQShareActivity.KEY_FROM_WHERE, 28);
((IAccount) SDKContext.getInstance().getService(IAccount.class)).callUserLogin(ActivityHandler.b().a(), bundle, new UserLoginListener() {
@Override
public void onLoginFailed(int i, String str) {
MttToaster.show("必须登录才能编译内容哟~", 0);
}
@Override
public void onLoginSuccess() {
if (((IAccount) SDKContext.getInstance().getService(IAccount.class)).getCurrentUserInfo().isLogined()) {
CameraOcrRecoResultView.this.postDelayed(new Runnable() {
@Override
public void run() {
CameraPanelUIUtils.a(CameraOcrRecoResultView.this.g, 8);
CameraPanelUIUtils.a(CameraOcrRecoResultView.this.k, 8);
CameraOcrRecoResultView.this.i.a(CameraOcrRecoResultView.this.q != null ? CameraOcrRecoResultView.this.q.f51516c : "");
StatManager.b().c("BZOCR016");
}
}, 50L);
}
}
});
} else {
CameraPanelUIUtils.a(this.g, 8);
CameraPanelUIUtils.a(this.k, 8);
CameraOcrInputView cameraOcrInputView = this.i;
CameraOCRData cameraOCRData = this.q;
cameraOcrInputView.a(cameraOCRData != null ? cameraOCRData.f51516c : "");
StatManager.b().c("BZOCR016");
}
}
@Override
public void a() {
this.m.c(ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_RESULT_COMPARE);
}
@Override
public void a(ICameraOcrTabItemView iCameraOcrTabItemView) {
StatManager b2;
String str;
ViewGroup.MarginLayoutParams marginLayoutParams;
int g;
int i = AnonymousClass13.f53256a[iCameraOcrTabItemView.getSwitchMethod().ordinal()];
if (i != 1) {
if (i == 2) {
int s = MttResources.s(4);
int b3 = CameraPanelUIUtils.b() - ((p * 4) + MttResources.g(R.dimen.k_));
this.r = new QBPopupMenu(getContext());
this.r.a(new Point(s, b3));
this.r.d(200);
this.r.b(5, MttResources.l(R.string.rt), this);
this.r.b(6, MttResources.l(R.string.ru), this);
this.r.b(7, MttResources.l(R.string.rr), this);
this.r.show();
this.m.c(ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_RESULT_COMPARE);
b2 = StatManager.b();
str = "BZOCR017";
} else if (i == 3) {
boolean a2 = ((CameraPopupOcrCropTab.CameraOcrTabItemView) iCameraOcrTabItemView.getView()).a();
this.l.a(a2, true);
if (a2) {
marginLayoutParams = (ViewGroup.MarginLayoutParams) this.n.getLayoutParams();
g = CameraOcrCompareView.f53344a;
} else {
marginLayoutParams = (ViewGroup.MarginLayoutParams) this.n.getLayoutParams();
g = MttResources.g(R.dimen.k_);
}
marginLayoutParams.bottomMargin = g;
this.n.setLayoutParams(marginLayoutParams);
b2 = StatManager.b();
str = "BZOCR018";
} else {
if (i != 4) {
return;
}
CameraOCRData cameraOCRData = this.q;
b(cameraOCRData != null ? cameraOCRData.f51517d : "");
this.m.c(ICameraOcrTabItemView.SwitchOcrTabMethod.OCR_TYPE_RESULT_COMPARE);
b2 = StatManager.b();
str = "BZOCR019";
}
b2.c(str);
}
}
public void a(String str) {
Activity a2 = ActivityHandler.b().a();
if (a2 != null) {
if (this.j == null) {
this.j = new MttLoadingDialog(a2);
this.j.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
if (i != 4 || keyEvent.getAction() != 1) {
return false;
}
CameraOcrRecoResultView.this.c();
return false;
}
});
this.j.show();
}
this.j.a(str);
}
}
@Override
public void a(boolean z) {
}
public void b() {
a("正在识别中...");
m();
}
@Override
public void bB_() {
CameraOCRData cameraOCRData = this.q;
if (cameraOCRData != null && !TextUtils.isEmpty(cameraOCRData.f51516c)) {
ARManager.a().b(this.q.e, this.q.f51516c);
}
this.i.a();
this.o.hideInputMethod();
this.o.setCursorVisible(false);
this.l.a(false, true);
CameraPanelUIUtils.a(this.i, 8);
CameraPanelUIUtils.a(this.k, 0);
CameraOCRData cameraOCRData2 = this.q;
if (cameraOCRData2 != null && cameraOCRData2.f) {
this.o.setText("");
CameraPanelUIUtils.a(this.g, 8);
}
this.m.a();
this.t.a();
this.s = false;
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.n.getLayoutParams();
marginLayoutParams.bottomMargin = MttResources.g(R.dimen.k_);
this.n.setLayoutParams(marginLayoutParams);
c();
}
public void c() {
MttLoadingDialog mttLoadingDialog = this.j;
if (mttLoadingDialog != null) {
mttLoadingDialog.dismiss();
this.j = null;
}
}
@Override
public void d() {
this.i.a();
CameraPanelUIUtils.a(this.g, 0);
CameraPanelUIUtils.a(this.k, 0);
QBTextView qBTextView = this.f;
CameraOCRData cameraOCRData = this.q;
qBTextView.setText(cameraOCRData != null ? cameraOCRData.f51516c : "");
}
@Override
public void e() {
}
@Override
public void f() {
}
@Override
public void g() {
}
public CameraOcrCompareView getCompareView() {
return this.l;
}
@Override
public View getView() {
return null;
}
@Override
public void h() {
}
@Override
public void i() {
}
@Override
public boolean k() {
return false;
}
@Override
public void onClick(View view) {
EventCollector.getInstance().onViewClickedBefore(view);
switch (view.getId()) {
case 0:
t();
break;
case 1:
s();
break;
case 2:
r();
break;
case 3:
q();
break;
case 4:
p();
break;
case 5:
o();
break;
case 6:
n();
break;
case 7:
QBPopupMenu qBPopupMenu = this.r;
if (qBPopupMenu != null) {
qBPopupMenu.dismiss();
}
File f = CameraFileDataManager.a().f();
String obj = this.o.getText().toString();
String charSequence = this.f.getText().toString();
if (!TextUtils.isEmpty(charSequence)) {
this.t.a(2, true, MttResources.l(R.string.ri), f + File.separator + (charSequence + Constants.ACCEPT_TIME_SEPARATOR_SERVER + CameraUtils.a(System.currentTimeMillis())) + ".doc", obj);
break;
} else {
MttToaster.show("标题不能为空", 0);
break;
}
case 8:
PageFrame s = WindowManager.a().s();
if (s != null) {
s.back(false);
}
bB_();
break;
}
EventCollector.getInstance().onViewClicked(view);
}
@Override
public void setICameraPanelViewListener(ICameraResultViewNewListener iCameraResultViewNewListener) {
}
public void setOcrRecoData(CameraOCRData cameraOCRData) {
if (cameraOCRData == null) {
return;
}
CameraPanelUIUtils.a(this.g, 0);
CameraPanelUIUtils.a(this.h, cameraOCRData.f ? 0 : 8);
CameraPanelUIUtils.a(this.k, 0);
this.q = cameraOCRData;
this.s = true;
this.o.setBackgroundDrawable(null);
this.o.setText(cameraOCRData.f51517d);
if (cameraOCRData.f && !TextUtils.isEmpty(cameraOCRData.f51516c) && cameraOCRData.f51516c.length() > 200) {
cameraOCRData.f51516c = cameraOCRData.f51516c.substring(0, EventResult.ERROR_CODE_OTHER);
}
this.f.setText(cameraOCRData.f51516c);
this.i.setOcrData(this.q);
c();
}
}