908 lines
30 KiB
Java
908 lines
30 KiB
Java
|
package com.kofax.mobile.sdk.k;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Rect;
|
||
|
import android.os.Build;
|
||
|
import android.os.Handler;
|
||
|
import android.os.Looper;
|
||
|
import android.os.SystemClock;
|
||
|
import android.os.Vibrator;
|
||
|
import android.view.View;
|
||
|
import com.kofax.kmc.ken.engines.data.BoundingTetragon;
|
||
|
import com.kofax.kmc.ken.engines.data.Image;
|
||
|
import com.kofax.kmc.kui.uicontrols.AboutToCaptureListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.AutoFocusResultEvent;
|
||
|
import com.kofax.kmc.kui.uicontrols.AutoFocusResultListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.ImageCapturedEvent;
|
||
|
import com.kofax.kmc.kui.uicontrols.ImageCapturedListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.JustCapturedListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.LevelnessEvent;
|
||
|
import com.kofax.kmc.kui.uicontrols.LevelnessListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.PageDetectionEvent;
|
||
|
import com.kofax.kmc.kui.uicontrols.PageDetectionListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.PreviewCallbackListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.PreviewFrameEvent;
|
||
|
import com.kofax.kmc.kui.uicontrols.StabilityDelayEvent;
|
||
|
import com.kofax.kmc.kui.uicontrols.StabilityDelayListener;
|
||
|
import com.kofax.kmc.kui.uicontrols.Utility;
|
||
|
import com.kofax.mobile.sdk._internal.IBus;
|
||
|
import com.kofax.mobile.sdk._internal.camera.ICameraDelegate;
|
||
|
import com.kofax.mobile.sdk._internal.capture.CaptureCriteria;
|
||
|
import com.kofax.mobile.sdk._internal.impl.event.aa;
|
||
|
import com.kofax.mobile.sdk._internal.impl.event.ae;
|
||
|
import com.kofax.mobile.sdk._internal.impl.event.ap;
|
||
|
import com.kofax.mobile.sdk._internal.view.IMessageListener;
|
||
|
import com.kofax.mobile.sdk._internal.view.IOverlayView;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.LinkedHashSet;
|
||
|
import java.util.List;
|
||
|
import java.util.Set;
|
||
|
import java.util.Timer;
|
||
|
import java.util.TimerTask;
|
||
|
import o.InterfaceC13391fZD;
|
||
|
import o.fZE;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class b implements View.OnClickListener, AutoFocusResultListener, ImageCapturedListener, LevelnessListener, PreviewCallbackListener, StabilityDelayListener, ICameraDelegate, com.kofax.mobile.sdk._internal.capture.a {
|
||
|
private static final int EZ = 3;
|
||
|
private static final int Fr = 50;
|
||
|
private boolean Fb;
|
||
|
private Timer Fc;
|
||
|
private int Fd;
|
||
|
private boolean Fe;
|
||
|
private boolean Ff;
|
||
|
private com.kofax.mobile.sdk._internal.capture.c Fk;
|
||
|
private com.kofax.mobile.sdk._internal.camera.f Fl;
|
||
|
private IOverlayView Fm;
|
||
|
private com.kofax.mobile.sdk._internal.capture.d Fo;
|
||
|
|
||
|
@InterfaceC13391fZD
|
||
|
protected com.kofax.mobile.sdk._internal.impl.view.a Ft;
|
||
|
|
||
|
@InterfaceC13391fZD
|
||
|
protected com.kofax.mobile.sdk._internal.capture.e Fu;
|
||
|
private IBus _bus;
|
||
|
private boolean _continuousCapture;
|
||
|
private boolean _sdkCaptureRequested;
|
||
|
private Vibrator _vibrator;
|
||
|
private boolean mB;
|
||
|
private ImageCapturedEvent mL;
|
||
|
private boolean ml;
|
||
|
private CaptureCriteria Fa = new CaptureCriteria();
|
||
|
private final Handler _uiHandler = new Handler(Looper.getMainLooper());
|
||
|
private Set<AboutToCaptureListener> Fg = new LinkedHashSet();
|
||
|
private Set<JustCapturedListener> Fh = new LinkedHashSet();
|
||
|
private Set<ImageCapturedListener> _imageCapturedListeners = new LinkedHashSet();
|
||
|
private final Set<PageDetectionListener> Fi = new LinkedHashSet();
|
||
|
private boolean _vibrationEnabled = true;
|
||
|
private boolean Fj = false;
|
||
|
private final l Fn = new l(this);
|
||
|
private int lU = -1;
|
||
|
private int lV = -1;
|
||
|
private k Fp = new k();
|
||
|
private g Fq = new g();
|
||
|
private final a Fs = new a();
|
||
|
private final Object _lock = new Object();
|
||
|
|
||
|
@InterfaceC13391fZD
|
||
|
public b(Context context, IBus iBus) {
|
||
|
this._bus = null;
|
||
|
this._vibrator = (Vibrator) context.getSystemService("vibrator");
|
||
|
this._bus = iBus;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void a(com.kofax.mobile.sdk._internal.capture.c cVar, com.kofax.mobile.sdk._internal.camera.f fVar, IOverlayView iOverlayView) {
|
||
|
p pVar = new p(cVar);
|
||
|
this.Fk = pVar;
|
||
|
pVar.a(this);
|
||
|
this.Fm = iOverlayView;
|
||
|
this.Fl = fVar;
|
||
|
fVar.getViewGroup().addView(this.Fm.getView());
|
||
|
this.Fl.setCameraDelegate(this);
|
||
|
addCameraEventListeners();
|
||
|
br();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void br() {
|
||
|
o bt = this.Fk.bt();
|
||
|
IOverlayView iOverlayView = this.Fm;
|
||
|
if (iOverlayView != null) {
|
||
|
iOverlayView.setOverlayAspectRatio(bt.lB());
|
||
|
this.Fm.setCenter(bt.getCenterPoint());
|
||
|
this.Fm.setPaddingPercent(bt.lC());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void addCameraEventListeners() {
|
||
|
this.Fl.addStabilityDelayListener(this);
|
||
|
this.Fl.addLevelnessListener(this);
|
||
|
this.Fl.addOnAutoFocusResultListener(this);
|
||
|
this.Fl.addOnImageCapturedListener(this);
|
||
|
this.Fn.b(this.Fl);
|
||
|
}
|
||
|
|
||
|
private void removeCameraEventListeners() {
|
||
|
com.kofax.mobile.sdk._internal.camera.f fVar = this.Fl;
|
||
|
if (fVar != null) {
|
||
|
fVar.removeStabilityDelayListener(this);
|
||
|
this.Fl.removeLevelnessListener(this);
|
||
|
this.Fl.removeOnAutoFocusResultListener(this);
|
||
|
this.Fl.removeOnImageCapturedListener(this);
|
||
|
this.Fn.stopListening();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.kui.uicontrols.PreviewCallbackListener
|
||
|
public void onPreviewFrame(PreviewFrameEvent previewFrameEvent) {
|
||
|
com.kofax.mobile.sdk._internal.capture.d e;
|
||
|
this.Fu.d(previewFrameEvent.getWidth(), previewFrameEvent.getHeight());
|
||
|
if (this._sdkCaptureRequested) {
|
||
|
kS();
|
||
|
return;
|
||
|
}
|
||
|
if (this.Fb && this.Fc == null) {
|
||
|
kX();
|
||
|
}
|
||
|
if (isPageDetectionEnabled()) {
|
||
|
e = this.Fk.a(previewFrameEvent);
|
||
|
} else {
|
||
|
e = com.kofax.mobile.sdk.l.m.e(previewFrameEvent);
|
||
|
}
|
||
|
this.Fo = e;
|
||
|
b(previewFrameEvent);
|
||
|
this.Fq.a(this.Fo.getEdgesGuidance());
|
||
|
this.Fu.a(this.Fo.bA().bs(), this.Fo.bA().getWidth(), this.Fo.bA().getHeight());
|
||
|
kS();
|
||
|
}
|
||
|
|
||
|
private void b(PreviewFrameEvent previewFrameEvent) {
|
||
|
com.kofax.mobile.sdk._internal.capture.d dVar = this.Fo;
|
||
|
if (dVar != null && (dVar.bz() || !isPageDetectionEnabled())) {
|
||
|
this.Fd = 0;
|
||
|
a(previewFrameEvent, this.Fo.bA().bs());
|
||
|
this._bus.post(new ap(null, this.Fo.bA().bs()));
|
||
|
} else {
|
||
|
int i = this.Fd + 1;
|
||
|
this.Fd = i;
|
||
|
if (i >= 3) {
|
||
|
this._bus.post(new ap());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public final void addOnImageCapturedListener(ImageCapturedListener imageCapturedListener) {
|
||
|
if (imageCapturedListener != null) {
|
||
|
this._imageCapturedListeners.add(imageCapturedListener);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public final void removeOnImageCapturedListener(ImageCapturedListener imageCapturedListener) {
|
||
|
this._imageCapturedListeners.remove(imageCapturedListener);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void addPageDetectionListener(PageDetectionListener pageDetectionListener) {
|
||
|
if (pageDetectionListener != null) {
|
||
|
this.Fi.add(pageDetectionListener);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void removePageDetectionListener(PageDetectionListener pageDetectionListener) {
|
||
|
this.Fi.remove(pageDetectionListener);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void addAboutToCaptureListener(AboutToCaptureListener aboutToCaptureListener) {
|
||
|
if (aboutToCaptureListener != null) {
|
||
|
this.Fg.add(aboutToCaptureListener);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void removeAboutToCaptureListener(AboutToCaptureListener aboutToCaptureListener) {
|
||
|
this.Fg.remove(aboutToCaptureListener);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void addJustCapturedListener(JustCapturedListener justCapturedListener) {
|
||
|
if (justCapturedListener != null) {
|
||
|
this.Fh.add(justCapturedListener);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void removeJustCapturedListener(JustCapturedListener justCapturedListener) {
|
||
|
this.Fh.remove(justCapturedListener);
|
||
|
}
|
||
|
|
||
|
private void a(PreviewFrameEvent previewFrameEvent, BoundingTetragon boundingTetragon) {
|
||
|
if (this.Fi.isEmpty() || boundingTetragon == null) {
|
||
|
return;
|
||
|
}
|
||
|
a(this.Fi, new PageDetectionEvent(this, new C0063b(previewFrameEvent), boundingTetragon));
|
||
|
}
|
||
|
|
||
|
private static void a(Collection<PageDetectionListener> collection, PageDetectionEvent pageDetectionEvent) {
|
||
|
Iterator<PageDetectionListener> it = collection.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().pageDetected(pageDetectionEvent);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.kui.uicontrols.AutoFocusResultListener
|
||
|
public void onAutoFocus(AutoFocusResultEvent autoFocusResultEvent) {
|
||
|
this.mB = autoFocusResultEvent.getSuccess();
|
||
|
this.Fu.m(kN());
|
||
|
kS();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.kui.uicontrols.LevelnessListener
|
||
|
public void onLevelness(LevelnessEvent levelnessEvent) {
|
||
|
this.lU = Math.abs(levelnessEvent.getPitch());
|
||
|
this.lV = Math.abs(levelnessEvent.getRoll());
|
||
|
this.Fu.a(kK(), this.lU, this.lV, this.Fa.getRollThreshold(), this.Fa.getPitchThreshold());
|
||
|
kS();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.kui.uicontrols.StabilityDelayListener
|
||
|
public void onStabilityDelay(StabilityDelayEvent stabilityDelayEvent) {
|
||
|
synchronized (this._lock) {
|
||
|
this.Fp.l(this.Fa.getStabilityThreshold(), stabilityDelayEvent.getStability());
|
||
|
}
|
||
|
boolean kJ = kJ();
|
||
|
this._bus.post(new com.kofax.mobile.sdk._internal.impl.event.p(kJ));
|
||
|
this.Fu.a(kJ, this.Fp.lw(), this.Fa.getStabilityThreshold());
|
||
|
kS();
|
||
|
}
|
||
|
|
||
|
private boolean kJ() {
|
||
|
if (this.Fa.isStabilityThresholdEnabled()) {
|
||
|
return this.Fp.kJ();
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
private boolean kK() {
|
||
|
return kL() && kM();
|
||
|
}
|
||
|
|
||
|
private boolean kL() {
|
||
|
return !this.Fa.isPitchThresholdEnabled() || this.Fa.getPitchThreshold() == 45 || this.Fa.getPitchThreshold() >= this.lU;
|
||
|
}
|
||
|
|
||
|
private boolean kM() {
|
||
|
return !this.Fa.isRollThresholdEnabled() || this.Fa.getRollThreshold() == 45 || this.Fa.getRollThreshold() >= this.lV;
|
||
|
}
|
||
|
|
||
|
private boolean kN() {
|
||
|
if (this.Fa.isFocusEnabled()) {
|
||
|
return this.mB;
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
private boolean kO() {
|
||
|
com.kofax.mobile.sdk._internal.capture.d dVar = this.Fo;
|
||
|
return dVar != null && (dVar.l(isOrientationEnabled()) || !isPageDetectionEnabled());
|
||
|
}
|
||
|
|
||
|
private boolean isPageDetectionEnabled() {
|
||
|
return this.Fa.isPageDetectionEnabled();
|
||
|
}
|
||
|
|
||
|
private boolean isOrientationEnabled() {
|
||
|
return this.Fa.isOrientationEnabled();
|
||
|
}
|
||
|
|
||
|
private boolean kP() {
|
||
|
return this.Fa.isOrientationEnabled() && this.Fo.by();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setCaptureCriteria(CaptureCriteria captureCriteria) {
|
||
|
if (captureCriteria == null) {
|
||
|
throw new IllegalArgumentException("criteria is null");
|
||
|
}
|
||
|
this.Fa = captureCriteria;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void d(boolean z) {
|
||
|
kZ();
|
||
|
this.Ff = false;
|
||
|
this._sdkCaptureRequested = false;
|
||
|
kW();
|
||
|
synchronized (this._lock) {
|
||
|
this._continuousCapture = z;
|
||
|
this.ml = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.camera.ICameraDelegate
|
||
|
public void forceTakePicture(boolean z) {
|
||
|
synchronized (this._lock) {
|
||
|
if (!this._sdkCaptureRequested && this.mL == null) {
|
||
|
this._sdkCaptureRequested = true;
|
||
|
this.Fl.forceTakePictureForCaptureExperience("com.kofax.kmc.kui.uicontrols.", z);
|
||
|
}
|
||
|
}
|
||
|
kS();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void kQ() {
|
||
|
if (this.Fm == null) {
|
||
|
return;
|
||
|
}
|
||
|
synchronized (this._lock) {
|
||
|
com.kofax.mobile.sdk._internal.capture.d dVar = this.Fo;
|
||
|
this.Fm.showFitWithinFrameMessage(((dVar != null && dVar.bz()) || this.Fb || this.mL != null || this.Fm.isMessageDisplayed() || this._sdkCaptureRequested) ? false : true);
|
||
|
this.Fm.showEdgesGuidance(this.Fq.getEdgesGuidance());
|
||
|
ImageCapturedEvent imageCapturedEvent = this.mL;
|
||
|
if (imageCapturedEvent != null) {
|
||
|
this.Fm.startCapturedMessage(new c(this, imageCapturedEvent));
|
||
|
} else if (!this._sdkCaptureRequested || this.Fb) {
|
||
|
if (this.Fo != null && !this.Fb) {
|
||
|
if (!kK()) {
|
||
|
this.Fm.startHoldParallelMessage();
|
||
|
} else if (this.Fo.bx()) {
|
||
|
this.Fm.startRotateMessage();
|
||
|
} else if (kP()) {
|
||
|
this.Fm.startRotateMessage();
|
||
|
} else if (this.Fo.bw()) {
|
||
|
this.Fm.startZoomOutMessage();
|
||
|
} else if (this.Fo.bu()) {
|
||
|
this.Fm.startCenterMessage();
|
||
|
} else if (this.Fo.bv()) {
|
||
|
this.Fm.startZoomInMessage();
|
||
|
} else if (this.ml && kO() && ((kJ() || kN()) && !this.Ff)) {
|
||
|
this.Fm.startSteadyMessage(this.Fs);
|
||
|
} else {
|
||
|
this.Fm.stopMessages();
|
||
|
}
|
||
|
} else {
|
||
|
this.Fm.stopMessages();
|
||
|
}
|
||
|
} else if (this.Fe && (Build.MODEL.equalsIgnoreCase(Utility.NEXUS_5X) || Utility.IS_SAMSUNG_S5_MINI)) {
|
||
|
if (this.Fm.isMessageDisplayed()) {
|
||
|
this.Fm.stopMessages();
|
||
|
} else {
|
||
|
this.Fm.showProgressBar();
|
||
|
}
|
||
|
} else {
|
||
|
this.Fm.startSteadyMessage(this.Fs);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void kR() {
|
||
|
if (this.Fm == null) {
|
||
|
return;
|
||
|
}
|
||
|
synchronized (this._lock) {
|
||
|
this.Fu.a(k(this.Fm.getView().getWidth(), this.Fm.getView().getHeight()));
|
||
|
this.Fu.a(this.Fm, isDiagnosticsViewEnabled() && !isAnimationTutorEnable());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void kS() {
|
||
|
kW();
|
||
|
synchronized (this._lock) {
|
||
|
if (this.ml && !this._sdkCaptureRequested && !this.Ff && !this.Fb && kN() && kJ() && kK() && kO() && this.Fs.isStarted()) {
|
||
|
this._sdkCaptureRequested = true;
|
||
|
this.Ff = true;
|
||
|
this.ml = this._continuousCapture;
|
||
|
kW();
|
||
|
kT();
|
||
|
if (this.Fa.isRefocusBeforeCaptureEnabled()) {
|
||
|
c(new Runnable(this) { // from class: com.kofax.mobile.sdk.k.b.1
|
||
|
final b Fv;
|
||
|
|
||
|
{
|
||
|
this.Fv = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.Fv.kV();
|
||
|
}
|
||
|
});
|
||
|
} else {
|
||
|
kV();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void kT() {
|
||
|
this._uiHandler.post(new Runnable(this) { // from class: com.kofax.mobile.sdk.k.b.2
|
||
|
final b Fv;
|
||
|
|
||
|
{
|
||
|
this.Fv = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.Fv.kU();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void kU() {
|
||
|
Iterator<AboutToCaptureListener> it = this.Fg.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().imageIsAboutToCapture();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: com.kofax.mobile.sdk.k.b$3, reason: invalid class name */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class AnonymousClass3 implements Runnable {
|
||
|
final b Fv;
|
||
|
final Runnable Fw;
|
||
|
|
||
|
AnonymousClass3(b bVar, Runnable runnable) {
|
||
|
this.Fv = bVar;
|
||
|
this.Fw = runnable;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.Fv._bus.post(new ae(new com.kofax.mobile.sdk._internal.camera.k(this, this) { // from class: com.kofax.mobile.sdk.k.b.3.1
|
||
|
final Runnable Fx;
|
||
|
final AnonymousClass3 Fy;
|
||
|
|
||
|
{
|
||
|
this.Fy = this;
|
||
|
this.Fx = this;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.camera.k
|
||
|
public void k(boolean z) {
|
||
|
if (z) {
|
||
|
this.Fy.Fv._bus.post(new aa(true));
|
||
|
this.Fy.Fw.run();
|
||
|
} else {
|
||
|
this.Fy.Fv._uiHandler.post(this.Fx);
|
||
|
}
|
||
|
}
|
||
|
}));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void c(Runnable runnable) {
|
||
|
this._uiHandler.post(new AnonymousClass3(this, runnable));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void kV() {
|
||
|
this.Fs.a(this.Fa.getHoldSteadyDelay(), this._uiHandler, new Runnable(this) { // from class: com.kofax.mobile.sdk.k.b.4
|
||
|
final b Fv;
|
||
|
|
||
|
{
|
||
|
this.Fv = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.Fv.Fl.takePictureForCaptureExperience("com.kofax.kmc.kui.uicontrols.");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
private void kW() {
|
||
|
this._uiHandler.post(new Runnable(this) { // from class: com.kofax.mobile.sdk.k.b.5
|
||
|
final b Fv;
|
||
|
|
||
|
{
|
||
|
this.Fv = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.Fv.kQ();
|
||
|
this.Fv.kR();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.camera.ICameraDelegate
|
||
|
public void onPictureTaken() {
|
||
|
this.Fe = true;
|
||
|
kS();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class c implements IMessageListener {
|
||
|
private ImageCapturedEvent FB;
|
||
|
final b Fv;
|
||
|
|
||
|
public c(b bVar, ImageCapturedEvent imageCapturedEvent) {
|
||
|
this.Fv = bVar;
|
||
|
this.FB = imageCapturedEvent;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.view.IMessageListener
|
||
|
public void onStart() {
|
||
|
synchronized (this.Fv._lock) {
|
||
|
this.Fv.Fm.displayImageCapturedEvent(this.FB);
|
||
|
this.Fv.Fm.hideProgressBar();
|
||
|
this.Fv._uiHandler.post(new Runnable(this) { // from class: com.kofax.mobile.sdk.k.b.c.1
|
||
|
final c FC;
|
||
|
|
||
|
{
|
||
|
this.FC = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.FC.Fv.a(this.FC.FB);
|
||
|
this.FC.Fv.invokeImageCapturedListeners(this.FC.FB);
|
||
|
this.FC.FB = null;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.view.IMessageListener
|
||
|
public void onStop() {
|
||
|
synchronized (this.Fv._lock) {
|
||
|
this.Fv.kZ();
|
||
|
this.Fv.Fm.clear();
|
||
|
if (this.Fv.Ff) {
|
||
|
this.Fv._uiHandler.postDelayed(new Runnable(this) { // from class: com.kofax.mobile.sdk.k.b.c.2
|
||
|
final c FC;
|
||
|
|
||
|
{
|
||
|
this.FC = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.FC.Fv.Ff = false;
|
||
|
}
|
||
|
}, 1000L);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void a(ImageCapturedEvent imageCapturedEvent) {
|
||
|
Bitmap imageBitmap = imageCapturedEvent.getImage().getImageBitmap();
|
||
|
imageCapturedEvent.getImage().setTargetFrame(k(imageBitmap.getWidth(), imageBitmap.getHeight()));
|
||
|
}
|
||
|
|
||
|
private Rect k(int i, int i2) {
|
||
|
Rect rE = this.Ft.rE();
|
||
|
double width = i / this.Fm.getView().getWidth();
|
||
|
double height = i2 / this.Fm.getView().getHeight();
|
||
|
Rect rect = new Rect((int) (rE.left * width), (int) (rE.top * height), (int) (rE.right * width), (int) (rE.bottom * height));
|
||
|
int i3 = rect.left;
|
||
|
int i4 = rect.left;
|
||
|
int width2 = rect.width();
|
||
|
int i5 = rect.top;
|
||
|
int i6 = rect.top;
|
||
|
int height2 = rect.height();
|
||
|
com.kofax.mobile.sdk._internal.capture.c cVar = this.Fk;
|
||
|
double sqrt = Math.sqrt(cVar == null ? 1.0d : cVar.getMaxFillFraction()) - 1.0d;
|
||
|
int width3 = ((int) (rect.width() * 0.5d * sqrt)) + 50;
|
||
|
int height3 = ((int) (rect.height() * 0.5d * sqrt)) + 50;
|
||
|
return new Rect(Math.max(0, i3 - width3), Math.max(0, i5 - height3), Math.min(i, i4 + width2 + width3), Math.min(i2, i6 + height2 + height3));
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public void invokeImageCapturedListeners(ImageCapturedEvent imageCapturedEvent) {
|
||
|
Iterator<ImageCapturedListener> it = this._imageCapturedListeners.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().onImageCaptured(imageCapturedEvent);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void enableAnimationTutor(boolean z) {
|
||
|
this.Fb = z;
|
||
|
this.Fm.setInstructionOverlay(z);
|
||
|
if (z) {
|
||
|
this.Fm.getView().setOnClickListener(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View.OnClickListener
|
||
|
public void onClick(View view) {
|
||
|
this.Fm.setInstructionOverlay(false);
|
||
|
this.Fm.getView().setOnClickListener(null);
|
||
|
this.Fb = false;
|
||
|
}
|
||
|
|
||
|
protected void kX() {
|
||
|
kY();
|
||
|
Timer timer = new Timer("Animation Tutor Timer");
|
||
|
this.Fc = timer;
|
||
|
timer.schedule(new TimerTask(this) { // from class: com.kofax.mobile.sdk.k.b.6
|
||
|
final b Fv;
|
||
|
|
||
|
{
|
||
|
this.Fv = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.TimerTask, java.lang.Runnable
|
||
|
public void run() {
|
||
|
this.Fv.Fm.setInstructionOverlay(false);
|
||
|
this.Fv.Fb = false;
|
||
|
}
|
||
|
}, 6000L);
|
||
|
}
|
||
|
|
||
|
protected void kY() {
|
||
|
Timer timer = this.Fc;
|
||
|
if (timer != null) {
|
||
|
timer.cancel();
|
||
|
this.Fc.purge();
|
||
|
this.Fc = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.kmc.kui.uicontrols.ImageCapturedListener
|
||
|
public final void onImageCaptured(ImageCapturedEvent imageCapturedEvent) {
|
||
|
kZ();
|
||
|
synchronized (this._lock) {
|
||
|
B(imageCapturedEvent.getImage());
|
||
|
this._sdkCaptureRequested = false;
|
||
|
this.Fe = false;
|
||
|
if (this._vibrationEnabled) {
|
||
|
try {
|
||
|
this._vibrator.vibrate(500L);
|
||
|
} catch (Exception unused) {
|
||
|
}
|
||
|
}
|
||
|
kY();
|
||
|
if (this._continuousCapture) {
|
||
|
kX();
|
||
|
}
|
||
|
this.mL = imageCapturedEvent;
|
||
|
kS();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void B(Image image) {
|
||
|
Iterator<JustCapturedListener> it = this.Fh.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
it.next().imageJustCaptured(image);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected void removeAllViews() {
|
||
|
com.kofax.mobile.sdk._internal.camera.f fVar = this.Fl;
|
||
|
if (fVar != null) {
|
||
|
fVar.getViewGroup().removeView(this.Fm.getView());
|
||
|
Bitmap documentSampleImage = this.Fm.getDocumentSampleImage();
|
||
|
if (documentSampleImage != null) {
|
||
|
documentSampleImage.recycle();
|
||
|
}
|
||
|
this.Fm.setDocumentSampleImage(null);
|
||
|
Timer timer = this.Fc;
|
||
|
if (timer != null) {
|
||
|
timer.purge();
|
||
|
this.Fc.cancel();
|
||
|
this.Fc = null;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void destroy() {
|
||
|
this.Fg.clear();
|
||
|
this.Fh.clear();
|
||
|
this.Fi.clear();
|
||
|
removeCameraEventListeners();
|
||
|
com.kofax.mobile.sdk._internal.capture.c cVar = this.Fk;
|
||
|
if (cVar != null) {
|
||
|
cVar.doCleanUp();
|
||
|
this.Fk = null;
|
||
|
}
|
||
|
removeAllViews();
|
||
|
kZ();
|
||
|
}
|
||
|
|
||
|
protected void kZ() {
|
||
|
synchronized (this._lock) {
|
||
|
this.mB = false;
|
||
|
this.Fo = null;
|
||
|
this.lU = -1;
|
||
|
this.lV = -1;
|
||
|
la();
|
||
|
this.Fs.reset();
|
||
|
this.mL = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void la() {
|
||
|
this.Fp = new k();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.camera.ICameraDelegate
|
||
|
public void onDetachFromWindow() {
|
||
|
synchronized (this._lock) {
|
||
|
this.Fm.clear();
|
||
|
kZ();
|
||
|
this.Ff = false;
|
||
|
this._sdkCaptureRequested = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public static class a implements IMessageListener {
|
||
|
private volatile long Fz;
|
||
|
|
||
|
private static long e(double d) {
|
||
|
return (long) (d * 1000.0d);
|
||
|
}
|
||
|
|
||
|
private a() {
|
||
|
this.Fz = -1L;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.view.IMessageListener
|
||
|
public void onStart() {
|
||
|
this.Fz = now();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.view.IMessageListener
|
||
|
public void onStop() {
|
||
|
reset();
|
||
|
}
|
||
|
|
||
|
void a(double d, Handler handler, Runnable runnable) {
|
||
|
long now = now();
|
||
|
if (this.Fz != -1 && now - this.Fz >= e(d)) {
|
||
|
runnable.run();
|
||
|
} else {
|
||
|
handler.postDelayed(runnable, (e(d) + this.Fz) - now);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static long now() {
|
||
|
return SystemClock.elapsedRealtime();
|
||
|
}
|
||
|
|
||
|
void reset() {
|
||
|
this.Fz = -1L;
|
||
|
}
|
||
|
|
||
|
boolean isStarted() {
|
||
|
return this.Fz > 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* renamed from: com.kofax.mobile.sdk.k.b$b, reason: collision with other inner class name */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public static class C0063b implements fZE<Bitmap> {
|
||
|
private final PreviewFrameEvent FA;
|
||
|
|
||
|
public C0063b(PreviewFrameEvent previewFrameEvent) {
|
||
|
this.FA = previewFrameEvent;
|
||
|
}
|
||
|
|
||
|
@Override // o.fZE
|
||
|
/* renamed from: aE, reason: merged with bridge method [inline-methods] */
|
||
|
public Bitmap get() {
|
||
|
return this.FA.getBitmap();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public int getGuidanceFrameColor() {
|
||
|
return this.Fm.getGuidanceFrameColor();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setGuidanceFrameThickness(int i) {
|
||
|
this.Fm.setGuidanceFrameThickness(i);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public int getGuidanceFrameThickness() {
|
||
|
return this.Fm.getGuidanceFrameThickness();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.camera.ICameraDelegate
|
||
|
public void onFocusAreasRequest(List<Rect> list, int i, int i2) {
|
||
|
this.Fu.b(list, i, i2);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public Bitmap getDocumentSampleImage() {
|
||
|
return this.Fm.getDocumentSampleImage();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setDocumentSampleImage(Bitmap bitmap) {
|
||
|
this.Fm.setDocumentSampleImage(bitmap);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public boolean hasDocumentSampleImage() {
|
||
|
return this.Fm.hasDocumentSampleImage();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setUserInstructionMessage(String str) {
|
||
|
this.Fm.setUserInstructionMessage(str);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setCenterMessage(String str) {
|
||
|
this.Fm.setCenterMessage(str);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setUserInstructionMessageTextSize(int i) {
|
||
|
this.Fm.setUserInstructionMessageTextSize(i);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setOuterOverlayFrameColor(int i) {
|
||
|
this.Fm.setOuterOverlayFrameColor(i);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public int getOuterOverlayFrameColor() {
|
||
|
return this.Fm.getOuterOverlayFrameColor();
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setGuidanceFrameColor(int i) {
|
||
|
this.Fm.setGuidanceFrameColor(i);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setSteadyGuidanceFrameColor(int i) {
|
||
|
this.Fm.setSteadyGuidanceFrameColor(i);
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void stopCapture() {
|
||
|
this.ml = false;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public final void setVibrationEnabled(boolean z) {
|
||
|
this._vibrationEnabled = z;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public void setDiagnosticsViewEnabled(boolean z) {
|
||
|
this.Fj = z;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public boolean isVibrationEnabled() {
|
||
|
return this._vibrationEnabled;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public boolean isDiagnosticsViewEnabled() {
|
||
|
return this.Fj;
|
||
|
}
|
||
|
|
||
|
@Override // com.kofax.mobile.sdk._internal.capture.a
|
||
|
public boolean isAnimationTutorEnable() {
|
||
|
return this.Fb;
|
||
|
}
|
||
|
}
|