what-the-bank/sources/com/kofax/mobile/sdk/af/f.java

130 lines
3.5 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.kofax.mobile.sdk.af;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import com.kofax.mobile.sdk._internal.IBus;
import com.kofax.mobile.sdk._internal.impl.event.GPSEnabledEvent;
import com.kofax.mobile.sdk._internal.impl.event.LocationEvent;
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 class f implements LocationListener {
private static long UK = 5000;
private static float UL = 10.0f;
private boolean UD;
private final com.kofax.mobile.sdk.aj.a UJ;
private double UM;
private double UN;
private boolean UO = false;
private final IBus _bus;
@Override // android.location.LocationListener
public void onStatusChanged(String str, int i, Bundle bundle) {
}
@InterfaceC13391fZD
public f(com.kofax.mobile.sdk.aj.a aVar, IBus iBus) {
if (iBus == null) {
throw new IllegalArgumentException("bus cannot be null");
}
this._bus = iBus;
iBus.register(this);
if (aVar == null) {
throw new IllegalArgumentException("lm cannot be null");
}
this.UJ = aVar;
if (aVar.qU()) {
this.UD = aVar.aG("gps");
} else {
this.UD = false;
}
if (!this.UD || aVar == null) {
return;
}
boolean aG = aVar.aG("network");
Location lastKnownLocation = aVar.getLastKnownLocation("gps");
if (aG && lastKnownLocation == null) {
lastKnownLocation = aVar.getLastKnownLocation("network");
}
if (lastKnownLocation != null) {
this.UM = lastKnownLocation.getLatitude();
this.UN = lastKnownLocation.getLongitude();
}
}
@InterfaceC13006fNs
public void b(SurfaceChangedEvent surfaceChangedEvent) {
if (surfaceChangedEvent.hasSurface) {
rn();
} else {
rm();
}
}
@InterfaceC13004fNq
public LocationEvent rk() {
return new LocationEvent(this.UM, this.UN);
}
@InterfaceC13004fNq
public GPSEnabledEvent rl() {
return new GPSEnabledEvent(this.UD);
}
protected void v(boolean z) {
if (z && this.UJ.qU()) {
if (!this.UJ.aG("gps")) {
this.UD = false;
return;
} else {
this.UD = true;
rn();
return;
}
}
this.UD = false;
rm();
}
protected void rm() {
if (this.UO) {
this.UJ.removeUpdates(this);
this.UO = false;
}
}
protected void rn() {
if (this.UO || !this.UD) {
return;
}
this.UJ.requestLocationUpdates("gps", UK, UL, this);
this.UO = true;
}
@Override // android.location.LocationListener
public void onLocationChanged(Location location) {
this.UM = location.getLatitude();
this.UN = location.getLongitude();
this._bus.post(rk());
}
@Override // android.location.LocationListener
public void onProviderDisabled(String str) {
this.UD = false;
v(false);
this._bus.post(rl());
}
@Override // android.location.LocationListener
public void onProviderEnabled(String str) {
this.UD = true;
v(true);
this._bus.post(rl());
}
}