what-the-bank/sources/com/kofax/mobile/sdk/_internal/impl/o.java

174 lines
4.3 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.mobile.sdk._internal.impl;
import android.graphics.Bitmap;
import com.kofax.mobile.sdk._internal.IBus;
import com.kofax.mobile.sdk._internal.impl.event.ImageCapturedBusEvent;
import com.kofax.mobile.sdk._internal.impl.event.PreviewImageReadyBusEvent;
import com.kofax.mobile.sdk._internal.impl.event.UseVideoChangedEvent;
import com.kofax.mobile.sdk._internal.impl.event.ae;
import com.kofax.mobile.sdk._internal.impl.event.ap;
import com.kofax.mobile.sdk._internal.impl.event.aq;
import com.kofax.mobile.sdk._internal.impl.event.ba;
import o.InterfaceC13006fNs;
import o.InterfaceC13391fZD;
/* loaded from: classes3.dex */
public class o {
private final IBus _bus;
private boolean wA;
private boolean wv;
private boolean ww;
private PreviewImageReadyBusEvent wx;
private Bitmap wy;
private boolean wz;
@InterfaceC13391fZD
public o(IBus iBus) {
this._bus = iBus;
iBus.register(this);
}
@InterfaceC13006fNs
public void a(ba baVar) {
this.wz = true;
hU();
}
@InterfaceC13006fNs
public void a(ap apVar) {
if (hT()) {
hU();
if (apVar.state == null || !apVar.state.wo) {
this.wy = apVar.Jd;
}
hV();
}
}
@InterfaceC13006fNs
public void a(PreviewImageReadyBusEvent previewImageReadyBusEvent) {
if (hT()) {
hU();
if (previewImageReadyBusEvent.state == null || !previewImageReadyBusEvent.state.wo) {
this.wx = previewImageReadyBusEvent;
}
hV();
}
}
@InterfaceC13006fNs
public void a(com.kofax.mobile.sdk._internal.impl.event.ad adVar) {
synchronized (this) {
if (adVar.IM) {
this._bus.post(new ae(new com.kofax.mobile.sdk._internal.camera.k(this) { // from class: com.kofax.mobile.sdk._internal.impl.o.1
final o wB;
{
this.wB = this;
}
@Override // com.kofax.mobile.sdk._internal.camera.k
public void k(boolean z) {
synchronized (this) {
this.wB.wA = true;
this.wB.wv = true;
}
}
}));
} else {
this.wv = true;
hV();
}
}
}
@InterfaceC13006fNs
public void a(UseVideoChangedEvent useVideoChangedEvent) {
this.ww = useVideoChangedEvent.useVideo;
hV();
}
@InterfaceC13006fNs
public void a(ImageCapturedBusEvent imageCapturedBusEvent) {
hU();
}
@InterfaceC13006fNs
public void a(com.kofax.mobile.sdk._internal.impl.event.r rVar) {
hU();
}
private void hV() {
synchronized (this) {
if (this.wv) {
captureImage();
}
}
}
private void captureImage() {
synchronized (this) {
if (this.ww) {
hX();
} else {
hW();
}
}
}
private void hW() {
this._bus.post(new com.kofax.mobile.sdk._internal.impl.event.o());
reset();
}
private void hX() {
Bitmap hY = hY();
if (hY != null) {
h(hY);
}
}
private void reset() {
hU();
this.wv = false;
this.wA = false;
}
private void h(Bitmap bitmap) {
this._bus.post(new ImageCapturedBusEvent(bitmap));
reset();
}
private Bitmap hY() {
Bitmap bitmap;
if (this.wy != null) {
this._bus.post(new aq());
bitmap = this.wy;
} else if (this.wx != null) {
this._bus.post(new aq());
bitmap = this.wx.getBitmap(true);
} else {
bitmap = null;
}
if (bitmap == null || bitmap.isRecycled()) {
hU();
return null;
}
return Bitmap.createBitmap(bitmap);
}
@InterfaceC13006fNs
public void a(com.kofax.mobile.sdk._internal.impl.event.aa aaVar) {
this.wz = false;
}
private void hU() {
this.wx = null;
this.wy = null;
}
private boolean hT() {
return (this.ww && !this.wz) || this.wA;
}
}