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

89 lines
2.3 KiB
Java

package com.kofax.mobile.sdk._internal.impl;
import android.content.Context;
import android.view.Display;
import android.view.OrientationEventListener;
import android.view.WindowManager;
import com.kofax.mobile.sdk._internal.IBus;
import com.kofax.mobile.sdk._internal.impl.event.SurfaceChangedEvent;
import o.InterfaceC13004fNq;
import o.InterfaceC13006fNs;
import o.InterfaceC13391fZD;
@com.kofax.mobile.sdk._internal.dagger.a
/* loaded from: classes3.dex */
public final class m extends OrientationEventListener {
private final IBus _bus;
private final Display wp;
private boolean wq;
private com.kofax.mobile.sdk._internal.impl.event.v wr;
@InterfaceC13391fZD
public m(Context context, WindowManager windowManager, IBus iBus) {
super(context);
this.wr = null;
this.wp = windowManager.getDefaultDisplay();
this._bus = iBus;
iBus.register(this);
}
@Override // android.view.OrientationEventListener
public final void onOrientationChanged(int i) {
synchronized (this) {
if (this.wq) {
if (hR()) {
this._bus.post(this.wr);
}
}
}
}
@InterfaceC13004fNq
public final com.kofax.mobile.sdk._internal.impl.event.v hQ() {
com.kofax.mobile.sdk._internal.impl.event.v vVar;
synchronized (this) {
start();
hR();
vVar = this.wr;
}
return vVar;
}
@InterfaceC13006fNs
public final void onSurfaceChanged(SurfaceChangedEvent surfaceChangedEvent) {
synchronized (this) {
if (surfaceChangedEvent.hasSurface) {
start();
} else {
stop();
}
}
}
private void start() {
if (this.wq) {
return;
}
enable();
this.wq = true;
}
private void stop() {
if (this.wq) {
disable();
this.wq = false;
this.wr = null;
}
}
private boolean hR() {
int rotation = this.wp.getRotation();
com.kofax.mobile.sdk._internal.impl.event.v vVar = this.wr;
if (vVar != null && rotation == vVar.rotation) {
return false;
}
this.wr = new com.kofax.mobile.sdk._internal.impl.event.v(rotation);
return true;
}
}