110 lines
2.9 KiB
Java
110 lines
2.9 KiB
Java
package com.kofax.mobile.sdk.af;
|
|
|
|
import android.content.Context;
|
|
import android.location.Location;
|
|
import android.location.LocationListener;
|
|
import android.location.LocationManager;
|
|
import android.os.Bundle;
|
|
import android.provider.Settings;
|
|
|
|
/* loaded from: classes3.dex */
|
|
class h implements LocationListener {
|
|
private static long UK = 5000;
|
|
private static float UL = 10.0f;
|
|
boolean UD;
|
|
double UM;
|
|
double UN;
|
|
private boolean UO;
|
|
LocationManager UQ;
|
|
private Context V;
|
|
|
|
@Override // android.location.LocationListener
|
|
public void onStatusChanged(String str, int i, Bundle bundle) {
|
|
}
|
|
|
|
h(Context context, LocationManager locationManager) {
|
|
Location lastKnownLocation;
|
|
this.UO = false;
|
|
this.V = context;
|
|
this.UQ = locationManager;
|
|
if (qU()) {
|
|
this.UD = Settings.Secure.isLocationProviderEnabled(context.getContentResolver(), "gps");
|
|
} else {
|
|
this.UD = false;
|
|
}
|
|
if (this.UD) {
|
|
this.UQ.requestLocationUpdates("gps", UK, UL, this);
|
|
LocationManager locationManager2 = this.UQ;
|
|
if (locationManager2 != null && (lastKnownLocation = locationManager2.getLastKnownLocation("gps")) != null) {
|
|
this.UM = lastKnownLocation.getLatitude();
|
|
this.UN = lastKnownLocation.getLongitude();
|
|
}
|
|
this.UO = true;
|
|
}
|
|
}
|
|
|
|
public void v(boolean z) {
|
|
if (z && qU()) {
|
|
if (!Settings.Secure.isLocationProviderEnabled(this.V.getContentResolver(), "gps")) {
|
|
this.UD = false;
|
|
return;
|
|
} else {
|
|
this.UD = true;
|
|
rr();
|
|
return;
|
|
}
|
|
}
|
|
this.UD = false;
|
|
rq();
|
|
}
|
|
|
|
public void rq() {
|
|
if (this.UO) {
|
|
this.UQ.removeUpdates(this);
|
|
this.UO = false;
|
|
}
|
|
}
|
|
|
|
public void rr() {
|
|
if (this.UO) {
|
|
return;
|
|
}
|
|
this.UQ.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();
|
|
}
|
|
|
|
@Override // android.location.LocationListener
|
|
public void onProviderDisabled(String str) {
|
|
this.UD = false;
|
|
rq();
|
|
}
|
|
|
|
@Override // android.location.LocationListener
|
|
public void onProviderEnabled(String str) {
|
|
this.UD = true;
|
|
rr();
|
|
}
|
|
|
|
private boolean qU() {
|
|
return this.V.getPackageManager().checkPermission("android.permission.ACCESS_FINE_LOCATION", this.V.getPackageName()) == 0;
|
|
}
|
|
|
|
public boolean rp() {
|
|
return this.UD;
|
|
}
|
|
|
|
public double getLongitude() {
|
|
return this.UN;
|
|
}
|
|
|
|
public double getLatitude() {
|
|
return this.UM;
|
|
}
|
|
}
|