what-the-bank/sources/com/journeyapps/barcodescanner/BarcodeView.java

252 lines
8.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.journeyapps.barcodescanner;
import android.content.Context;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.util.AttributeSet;
import java.util.HashMap;
import java.util.List;
import o.C12047eqo;
import o.C13143fRz;
import o.C14337frM;
import o.C17083tlK;
import o.C17725zIe;
import o.CGg;
import o.InterfaceC14590fwA;
import o.InterfaceC15330gnf;
import o.NNY;
import o.RunnableC16385nqX;
import o.qCz;
import o.sBE;
/* loaded from: classes3.dex */
public class BarcodeView extends CameraPreview {
HBt b;
InterfaceC15330gnf d;
NNY e;
private Handler f;
private final Handler.Callback g;
private InterfaceC14590fwA i;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public enum HBt {
NONE,
SINGLE,
CONTINUOUS
}
public BarcodeView(Context context) {
super(context);
this.b = HBt.NONE;
this.d = null;
Handler.Callback callback = new Handler.Callback(this) { // from class: com.journeyapps.barcodescanner.BarcodeView.4
private BarcodeView a;
{
this.a = this;
}
@Override // android.os.Handler.Callback
public final boolean handleMessage(Message message) {
if (message.what == C17083tlK.LWm.zxing_decode_succeeded) {
C17725zIe c17725zIe = (C17725zIe) message.obj;
if (c17725zIe != null && this.a.d != null && this.a.b != HBt.NONE) {
this.a.d.c(c17725zIe);
if (this.a.b == HBt.SINGLE) {
BarcodeView barcodeView = this.a;
barcodeView.b = HBt.NONE;
barcodeView.d = null;
NNY nny = barcodeView.e;
if (nny != null) {
nny.e();
barcodeView.e = null;
}
}
}
return true;
}
if (message.what == C17083tlK.LWm.zxing_decode_failed) {
return true;
}
if (message.what != C17083tlK.LWm.zxing_possible_result_points) {
return false;
}
List<qCz> list = (List) message.obj;
if (this.a.d != null && this.a.b != HBt.NONE) {
this.a.d.e(list);
}
return true;
}
};
this.g = callback;
this.i = new C13143fRz();
this.f = new Handler(callback);
}
public BarcodeView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.b = HBt.NONE;
this.d = null;
Handler.Callback callback = new Handler.Callback(this) { // from class: com.journeyapps.barcodescanner.BarcodeView.4
private BarcodeView a;
{
this.a = this;
}
@Override // android.os.Handler.Callback
public final boolean handleMessage(Message message) {
if (message.what == C17083tlK.LWm.zxing_decode_succeeded) {
C17725zIe c17725zIe = (C17725zIe) message.obj;
if (c17725zIe != null && this.a.d != null && this.a.b != HBt.NONE) {
this.a.d.c(c17725zIe);
if (this.a.b == HBt.SINGLE) {
BarcodeView barcodeView = this.a;
barcodeView.b = HBt.NONE;
barcodeView.d = null;
NNY nny = barcodeView.e;
if (nny != null) {
nny.e();
barcodeView.e = null;
}
}
}
return true;
}
if (message.what == C17083tlK.LWm.zxing_decode_failed) {
return true;
}
if (message.what != C17083tlK.LWm.zxing_possible_result_points) {
return false;
}
List<qCz> list = (List) message.obj;
if (this.a.d != null && this.a.b != HBt.NONE) {
this.a.d.e(list);
}
return true;
}
};
this.g = callback;
this.i = new C13143fRz();
this.f = new Handler(callback);
}
public BarcodeView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.b = HBt.NONE;
this.d = null;
Handler.Callback callback = new Handler.Callback(this) { // from class: com.journeyapps.barcodescanner.BarcodeView.4
private BarcodeView a;
{
this.a = this;
}
@Override // android.os.Handler.Callback
public final boolean handleMessage(Message message) {
if (message.what == C17083tlK.LWm.zxing_decode_succeeded) {
C17725zIe c17725zIe = (C17725zIe) message.obj;
if (c17725zIe != null && this.a.d != null && this.a.b != HBt.NONE) {
this.a.d.c(c17725zIe);
if (this.a.b == HBt.SINGLE) {
BarcodeView barcodeView = this.a;
barcodeView.b = HBt.NONE;
barcodeView.d = null;
NNY nny = barcodeView.e;
if (nny != null) {
nny.e();
barcodeView.e = null;
}
}
}
return true;
}
if (message.what == C17083tlK.LWm.zxing_decode_failed) {
return true;
}
if (message.what != C17083tlK.LWm.zxing_possible_result_points) {
return false;
}
List<qCz> list = (List) message.obj;
if (this.a.d != null && this.a.b != HBt.NONE) {
this.a.d.e(list);
}
return true;
}
};
this.g = callback;
this.i = new C13143fRz();
this.f = new Handler(callback);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void d() {
NNY nny = this.e;
if (nny != null) {
nny.e();
this.e = null;
}
if (this.b == HBt.NONE || !g()) {
return;
}
NNY nny2 = new NNY(this.a, f(), this.f);
this.e = nny2;
nny2.b = Oo_();
NNY nny3 = this.e;
if (Looper.getMainLooper() == Looper.myLooper()) {
HandlerThread handlerThread = new HandlerThread(NNY.a);
nny3.f8284o = handlerThread;
handlerThread.start();
nny3.j = new Handler(nny3.f8284o.getLooper(), nny3.c);
nny3.i = true;
C12047eqo c12047eqo = nny3.d;
c12047eqo.i.post(new RunnableC16385nqX(c12047eqo, nny3.f));
return;
}
throw new IllegalStateException("Must be called from the main thread.");
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.journeyapps.barcodescanner.CameraPreview
public final void c() {
super.c();
d();
}
@Override // com.journeyapps.barcodescanner.CameraPreview
public final void e() {
NNY nny = this.e;
if (nny != null) {
nny.e();
this.e = null;
}
super.e();
}
private sBE f() {
if (this.i == null) {
this.i = new C13143fRz();
}
C14337frM c14337frM = new C14337frM();
HashMap hashMap = new HashMap();
hashMap.put(CGg.NEED_RESULT_POINT_CALLBACK, c14337frM);
sBE e = this.i.e(hashMap);
c14337frM.e = e;
return e;
}
public void setDecoderFactory(InterfaceC14590fwA interfaceC14590fwA) {
if (Looper.getMainLooper() != Looper.myLooper()) {
throw new IllegalStateException("Must be called from the main thread.");
}
this.i = interfaceC14590fwA;
NNY nny = this.e;
if (nny != null) {
nny.g = f();
}
}
}