blob: c0b3974232c8138a780b711c2ad4565339cbb5b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
package cgeo.geocaching.sensors;
import cgeo.geocaching.enumerations.LocationProviderType;
import cgeo.geocaching.geopoint.Geopoint;
import android.location.Location;
import android.location.LocationManager;
class GeoData extends Location implements IGeoData {
private final boolean gpsEnabled;
private final int satellitesVisible;
private final int satellitesFixed;
private final boolean pseudoLocation;
GeoData(final Location location, final boolean gpsEnabled, final int satellitesVisible, final int satellitesFixed, final boolean pseudoLocation) {
super(location);
this.gpsEnabled = gpsEnabled;
this.satellitesVisible = satellitesVisible;
this.satellitesFixed = satellitesFixed;
this.pseudoLocation = pseudoLocation;
}
@Override
public Location getLocation() {
return this;
}
private static LocationProviderType getLocationProviderType(final String provider) {
if (provider.equals(LocationManager.GPS_PROVIDER)) {
return LocationProviderType.GPS;
}
if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
return LocationProviderType.NETWORK;
}
return LocationProviderType.LAST;
}
@Override
public LocationProviderType getLocationProvider() {
return getLocationProviderType(getProvider());
}
@Override
public Geopoint getCoords() {
return new Geopoint(this);
}
@Override
public boolean getGpsEnabled() {
return gpsEnabled;
}
@Override
public int getSatellitesVisible() {
return satellitesVisible;
}
@Override
public int getSatellitesFixed() {
return satellitesFixed;
}
@Override
public boolean isPseudoLocation() {
return pseudoLocation;
}
}
|