what-the-bank/sources/com/kofax/mobile/sdk/am/b.java

167 lines
4.6 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.mobile.sdk.am;
import android.graphics.Bitmap;
import com.kofax.android.abc.document.Document;
import com.kofax.android.abc.quickextractor.MrzExtractor;
import com.kofax.android.abc.vrs.VrsImage;
import com.kofax.mobile.commonextractionengine.recognition.TextRecognizer;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import o.C15178gjQ;
/* loaded from: classes3.dex */
public class b implements com.kofax.mobile.sdk.am.a {
private final Deque<a<?>> Yp = new ArrayDeque();
public <T extends com.kofax.mobile.sdk.am.a> T a(T t) {
return (T) a((a) new a<T>(this, t, t) { // from class: com.kofax.mobile.sdk.am.b.1
final com.kofax.mobile.sdk.am.a Yq;
final b Yr;
{
this.Yr = this;
this.Yq = t;
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
this.Yq.dispose();
}
});
}
public TextRecognizer a(TextRecognizer textRecognizer) {
return (TextRecognizer) a((a) new a<TextRecognizer>(this, textRecognizer, textRecognizer) { // from class: com.kofax.mobile.sdk.am.b.2
final TextRecognizer RY;
final b Yr;
{
this.Yr = this;
this.RY = textRecognizer;
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
this.RY.dispose();
}
});
}
public VrsImage a(VrsImage vrsImage) {
return (VrsImage) a((a) new a<VrsImage>(this, vrsImage, vrsImage) { // from class: com.kofax.mobile.sdk.am.b.3
final VrsImage RZ;
final b Yr;
{
this.Yr = this;
this.RZ = vrsImage;
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
this.RZ.dispose();
}
});
}
public MrzExtractor a(MrzExtractor mrzExtractor) {
return (MrzExtractor) a((a) new a<MrzExtractor>(this, mrzExtractor, mrzExtractor) { // from class: com.kofax.mobile.sdk.am.b.4
final b Yr;
final MrzExtractor Ys;
{
this.Yr = this;
this.Ys = mrzExtractor;
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
this.Ys.dispose();
}
});
}
public Document f(Document document) {
return (Document) a((a) new a<Document>(this, document, document) { // from class: com.kofax.mobile.sdk.am.b.5
final Document Sb;
final b Yr;
{
this.Yr = this;
this.Sb = document;
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
this.Sb.dispose();
}
});
}
public Bitmap o(Bitmap bitmap) {
return (Bitmap) a((a) new a<Bitmap>(this, bitmap, bitmap) { // from class: com.kofax.mobile.sdk.am.b.6
final b Yr;
final Bitmap val$bitmap;
{
this.Yr = this;
this.val$bitmap = bitmap;
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
this.val$bitmap.recycle();
}
});
}
public <T> T f(T t) {
if (t == null) {
return null;
}
Iterator<a<?>> it = this.Yp.iterator();
while (it.hasNext()) {
if (((a) it.next()).object == t) {
it.remove();
return t;
}
}
throw new IllegalArgumentException(String.format("%s was not registered", t));
}
@Override // com.kofax.mobile.sdk.am.a
public void dispose() {
Throwable th = null;
while (!this.Yp.isEmpty()) {
try {
this.Yp.pop().dispose();
} catch (Throwable th2) {
if (th == null) {
th = th2;
}
}
}
if (th != null) {
C15178gjQ.e(th);
}
}
private <T> T a(a<T> aVar) {
if (((a) aVar).object != null) {
this.Yp.push(aVar);
}
return (T) ((a) aVar).object;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static abstract class a<T> implements com.kofax.mobile.sdk.am.a {
private final T object;
a(T t) {
this.object = t;
}
}
}