aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2012-04-27 12:37:43 +0200
committerSamuel Tardieu <sam@rfc1149.net>2012-04-27 12:37:43 +0200
commit16fad207ba63733a572a3e0aad171a677f85a44d (patch)
treebbe01baaebb8305d5c6a11dfac3f1f3f9d758d35 /main/src
parentd89efa23659dae79735292c2336d7f3fb103a918 (diff)
downloadcgeo-16fad207ba63733a572a3e0aad171a677f85a44d.zip
cgeo-16fad207ba63733a572a3e0aad171a677f85a44d.tar.gz
cgeo-16fad207ba63733a572a3e0aad171a677f85a44d.tar.bz2
Remove Now from methods of IGeoData
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java8
-rw-r--r--main/src/cgeo/geocaching/GeoDataProvider.java12
-rw-r--r--main/src/cgeo/geocaching/IGeoData.java10
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java2
-rw-r--r--main/src/cgeo/geocaching/cgeo.java28
-rw-r--r--main/src/cgeo/geocaching/cgeoadvsearch.java12
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java20
-rw-r--r--main/src/cgeo/geocaching/cgeocoords.java12
-rw-r--r--main/src/cgeo/geocaching/cgeonavigate.java28
-rw-r--r--main/src/cgeo/geocaching/cgeopoint.java10
-rw-r--r--main/src/cgeo/geocaching/cgeopopup.java4
-rw-r--r--main/src/cgeo/geocaching/cgeowaypointadd.java10
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCBase.java5
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java10
-rw-r--r--main/src/cgeo/geocaching/ui/AddressListAdapter.java2
15 files changed, 86 insertions, 87 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index e71ddd4..8f7cf6a 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -702,13 +702,13 @@ public class CacheDetailActivity extends AbstractActivity {
try {
StringBuilder dist = new StringBuilder();
- if (geo.getCoordsNow() != null && cache != null && cache.getCoords() != null) {
- dist.append(HumanDistance.getHumanDistance(geo.getCoordsNow().distanceTo(cache.getCoords())));
+ if (geo.getCoords() != null && cache != null && cache.getCoords() != null) {
+ dist.append(HumanDistance.getHumanDistance(geo.getCoords().distanceTo(cache.getCoords())));
}
if (cache != null && cache.getElevation() != null) {
- if (geo.getAltitudeNow() != null) {
- double diff = (cache.getElevation() - geo.getAltitudeNow());
+ if (geo.getAltitude() != 0.0) {
+ double diff = cache.getElevation() - geo.getAltitude();
if (diff >= 0) {
dist.append(" ↗");
} else if (diff < 0) {
diff --git a/main/src/cgeo/geocaching/GeoDataProvider.java b/main/src/cgeo/geocaching/GeoDataProvider.java
index 97a9bd9..1d05945 100644
--- a/main/src/cgeo/geocaching/GeoDataProvider.java
+++ b/main/src/cgeo/geocaching/GeoDataProvider.java
@@ -82,17 +82,17 @@ class GeoDataProvider extends MemorySubject<IGeoData> {
}
@Override
- public Geopoint getCoordsNow() {
+ public Geopoint getCoords() {
return new Geopoint(location);
}
@Override
- public Double getAltitudeNow() {
+ public double getAltitude() {
return location.getAltitude();
}
@Override
- public float getBearingNow() {
+ public float getBearing() {
return location.getBearing();
}
@@ -102,12 +102,12 @@ class GeoDataProvider extends MemorySubject<IGeoData> {
}
@Override
- public float getSpeedNow() {
+ public float getSpeed() {
return location.getSpeed();
}
@Override
- public float getAccuracyNow() {
+ public float getAccuracy() {
return location.getAccuracy();
}
@@ -325,7 +325,7 @@ class GeoDataProvider extends MemorySubject<IGeoData> {
current.location = locationData.location;
notifyObservers(current.makeImmutable());
- Go4Cache.signalCoordinates(current.getCoordsNow());
+ Go4Cache.signalCoordinates(current.getCoords());
}
}
diff --git a/main/src/cgeo/geocaching/IGeoData.java b/main/src/cgeo/geocaching/IGeoData.java
index 7758a97..9696b27 100644
--- a/main/src/cgeo/geocaching/IGeoData.java
+++ b/main/src/cgeo/geocaching/IGeoData.java
@@ -9,11 +9,11 @@ public interface IGeoData {
public Location getLocation();
public LocationProviderType getLocationProvider();
- public Geopoint getCoordsNow();
- public Double getAltitudeNow();
- public float getBearingNow();
- public float getSpeedNow();
- public float getAccuracyNow();
+ public Geopoint getCoords();
+ public double getAltitude();
+ public float getBearing();
+ public float getSpeed();
+ public float getAccuracy();
public boolean getGpsEnabled();
public int getSatellitesVisible();
public int getSatellitesFixed();
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java
index e5001da..fb72157 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java
@@ -51,7 +51,7 @@ class GoogleNavigationApp extends AbstractNavigationApp {
}
private static boolean navigateToCoordinates(IGeoData geo, Activity activity, final Geopoint coords) {
- final Geopoint coordsNow = geo == null ? null : geo.getCoordsNow();
+ final Geopoint coordsNow = geo == null ? null : geo.getCoords();
// Google Navigation
if (Settings.isUseGoogleNavigation()) {
diff --git a/main/src/cgeo/geocaching/cgeo.java b/main/src/cgeo/geocaching/cgeo.java
index 63200d6..26585ce 100644
--- a/main/src/cgeo/geocaching/cgeo.java
+++ b/main/src/cgeo/geocaching/cgeo.java
@@ -115,7 +115,7 @@ public class cgeo extends AbstractActivity {
addText.append(address.getAdminArea());
}
- addCoords = app.currentGeo().getCoordsNow();
+ addCoords = app.currentGeo().getCoords();
TextView navLocation = (TextView) findViewById(R.id.nav_location);
navLocation.setText(addText.toString());
@@ -565,7 +565,7 @@ public class cgeo extends AbstractActivity {
final TextView navAccuracy = (TextView) findViewById(R.id.nav_accuracy);
final TextView navLocation = (TextView) findViewById(R.id.nav_location);
try {
- if (geo.getCoordsNow() != null) {
+ if (geo.getCoords() != null) {
if (!nearestView.isClickable()) {
nearestView.setFocusable(true);
nearestView.setClickable(true);
@@ -579,12 +579,12 @@ public class cgeo extends AbstractActivity {
navType.setText(res.getString(geo.getLocationProvider().resourceId));
- if (geo.getAccuracyNow() >= 0) {
- int speed = Math.round(geo.getSpeedNow()) * 60 * 60 / 1000;
+ if (geo.getAccuracy() >= 0) {
+ int speed = Math.round(geo.getSpeed()) * 60 * 60 / 1000;
if (Settings.isUseMetricUnits()) {
- navAccuracy.setText("±" + Math.round(geo.getAccuracyNow()) + " m" + Formatter.SEPARATOR + speed + " km/h");
+ navAccuracy.setText("±" + Math.round(geo.getAccuracy()) + " m" + Formatter.SEPARATOR + speed + " km/h");
} else {
- navAccuracy.setText("±" + Math.round(geo.getAccuracyNow() * IConversion.METERS_TO_FEET) + " ft" + Formatter.SEPARATOR + speed / IConversion.MILES_TO_KILOMETER + " mph");
+ navAccuracy.setText("±" + Math.round(geo.getAccuracy() * IConversion.METERS_TO_FEET) + " ft" + Formatter.SEPARATOR + speed / IConversion.MILES_TO_KILOMETER + " mph");
}
} else {
navAccuracy.setText(null);
@@ -594,15 +594,15 @@ public class cgeo extends AbstractActivity {
if (addCoords == null) {
navLocation.setText(res.getString(R.string.loc_no_addr));
}
- if (addCoords == null || (geo.getCoordsNow().distanceTo(addCoords) > 0.5 && !addressObtaining)) {
+ if (addCoords == null || (geo.getCoords().distanceTo(addCoords) > 0.5 && !addressObtaining)) {
(new ObtainAddressThread()).start();
}
} else {
- if (geo.getAltitudeNow() != null) {
- final String humanAlt = HumanDistance.getHumanDistance(geo.getAltitudeNow().floatValue() / 1000);
- navLocation.setText(geo.getCoordsNow() + " | " + humanAlt);
+ if (geo.getAltitude() != 0.0) {
+ final String humanAlt = HumanDistance.getHumanDistance((float) geo.getAltitude() / 1000);
+ navLocation.setText(geo.getCoords() + " | " + humanAlt);
} else {
- navLocation.setText(geo.getCoordsNow().toString());
+ navLocation.setText(geo.getCoords().toString());
}
}
} else {
@@ -636,12 +636,12 @@ public class cgeo extends AbstractActivity {
* unused here but needed since this method is referenced from XML layout
*/
public void cgeoFindNearest(View v) {
- if (app.currentGeo().getCoordsNow() == null) {
+ if (app.currentGeo().getCoords() == null) {
return;
}
findViewById(R.id.nearest).setPressed(true);
- cgeocaches.startActivityNearest(this, app.currentGeo().getCoordsNow());
+ cgeocaches.startActivityNearest(this, app.currentGeo().getCoords());
}
/**
@@ -810,7 +810,7 @@ public class cgeo extends AbstractActivity {
try {
final Geocoder geocoder = new Geocoder(cgeo.this, Locale.getDefault());
- final Geopoint coords = app.currentGeo().getCoordsNow();
+ final Geopoint coords = app.currentGeo().getCoords();
addresses = geocoder.getFromLocation(coords.getLatitude(), coords.getLongitude(), 1);
} catch (Exception e) {
Log.i("Failed to obtain address");
diff --git a/main/src/cgeo/geocaching/cgeoadvsearch.java b/main/src/cgeo/geocaching/cgeoadvsearch.java
index 9d3f2a8..4fac391 100644
--- a/main/src/cgeo/geocaching/cgeoadvsearch.java
+++ b/main/src/cgeo/geocaching/cgeoadvsearch.java
@@ -221,12 +221,12 @@ public class cgeoadvsearch extends AbstractActivity implements IObserver<IGeoDat
lonEdit = (EditText) findViewById(R.id.longitude);
}
- if (geo.getCoordsNow() != null) {
+ if (geo.getCoords() != null) {
if (latEdit != null) {
- latEdit.setHint(geo.getCoordsNow().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW));
+ latEdit.setHint(geo.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW));
}
if (lonEdit != null) {
- lonEdit.setHint(geo.getCoordsNow().format(GeopointFormatter.Format.LON_DECMINUTE_RAW));
+ lonEdit.setHint(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE_RAW));
}
}
} catch (Exception e) {
@@ -266,9 +266,9 @@ public class cgeoadvsearch extends AbstractActivity implements IObserver<IGeoDat
if (StringUtils.isEmpty(latText) || StringUtils.isEmpty(lonText)) {
final IGeoData geo = app.currentGeo();
- if (geo.getCoordsNow() != null) {
- latView.setText(geo.getCoordsNow().format(GeopointFormatter.Format.LAT_DECMINUTE));
- lonView.setText(geo.getCoordsNow().format(GeopointFormatter.Format.LON_DECMINUTE));
+ if (geo.getCoords() != null) {
+ latView.setText(geo.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE));
+ lonView.setText(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE));
}
} else {
try {
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index e2056b0..917db29 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -209,7 +209,7 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
return;
}
- final Geopoint coordsNow = app.currentGeo().getCoordsNow();
+ final Geopoint coordsNow = app.currentGeo().getCoords();
if (coordsNow != null) {
adapter.setActualCoordinates(coordsNow);
adapter.setActualHeading(northHeading);
@@ -277,7 +277,7 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
return;
}
- final Geopoint coordsNow = app.currentGeo().getCoordsNow();
+ final Geopoint coordsNow = app.currentGeo().getCoords();
if (coordsNow != null) {
adapter.setActualCoordinates(coordsNow);
adapter.setActualHeading(northHeading);
@@ -336,7 +336,7 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
}
}
- final Geopoint coordsNow = app.currentGeo().getCoordsNow();
+ final Geopoint coordsNow = app.currentGeo().getCoords();
if (coordsNow != null) {
adapter.setActualCoordinates(coordsNow);
adapter.setActualHeading(northHeading);
@@ -652,7 +652,7 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
if (adapter != null) {
adapter.setSelectMode(false, true);
- final Geopoint coordsNow = app.currentGeo().getCoordsNow();
+ final Geopoint coordsNow = app.currentGeo().getCoords();
if (coordsNow != null) {
adapter.setActualCoordinates(coordsNow);
adapter.setActualHeading(northHeading);
@@ -1203,7 +1203,7 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
}
adapter.reFilter();
- adapter.setActualCoordinates(app.currentGeo().getCoordsNow());
+ adapter.setActualCoordinates(app.currentGeo().getCoords());
if (dir != null) {
adapter.setActualHeading(dir.directionNow);
@@ -1424,13 +1424,13 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
}
try {
- if (cacheList != null && geo.getCoordsNow() != null) {
- adapter.setActualCoordinates(geo.getCoordsNow());
+ if (cacheList != null && geo.getCoords() != null) {
+ adapter.setActualCoordinates(geo.getCoords());
}
- if (!Settings.isUseCompass() || geo.getSpeedNow() > 5) { // use GPS when speed is higher than 18 km/h
+ if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h
if (!Settings.isUseCompass()) {
- adapter.setActualHeading(geo.getBearingNow());
+ adapter.setActualHeading(geo.getBearing());
}
if (northHeading != null) {
adapter.setActualHeading(northHeading);
@@ -1453,7 +1453,7 @@ public class cgeocaches extends AbstractListActivity implements IObserver<IGeoDa
}
northHeading = dir.directionNow;
- if (northHeading != null && adapter != null && (app.currentGeo().getSpeedNow() <= 5)) { // use compass when speed is lower than 18 km/h) {
+ if (northHeading != null && adapter != null && (app.currentGeo().getSpeed() <= 5)) { // use compass when speed is lower than 18 km/h) {
adapter.setActualHeading(northHeading);
}
}
diff --git a/main/src/cgeo/geocaching/cgeocoords.java b/main/src/cgeo/geocaching/cgeocoords.java
index d6c923f..0ad2e81 100644
--- a/main/src/cgeo/geocaching/cgeocoords.java
+++ b/main/src/cgeo/geocaching/cgeocoords.java
@@ -54,8 +54,8 @@ public class cgeocoords extends Dialog {
if (gp != null) {
this.gp = gp;
- } else if (geo != null && geo.getCoordsNow() != null) {
- this.gp = geo.getCoordsNow();
+ } else if (geo != null && geo.getCoords() != null) {
+ this.gp = geo.getCoords();
} else {
this.gp = new Geopoint(0.0, 0.0);
}
@@ -413,8 +413,8 @@ public class cgeocoords extends Dialog {
// Start new format with an acceptable value: either the current one
// entered by the user, else our current coordinates, else (0,0).
if (!calc(false)) {
- if (geo != null && geo.getCoordsNow() != null) {
- gp = geo.getCoordsNow();
+ if (geo != null && geo.getCoords() != null) {
+ gp = geo.getCoords();
} else {
gp = new Geopoint(0.0, 0.0);
}
@@ -436,12 +436,12 @@ public class cgeocoords extends Dialog {
@Override
public void onClick(View v) {
- if (geo == null || geo.getCoordsNow() == null) {
+ if (geo == null || geo.getCoords() == null) {
context.showToast(context.getResources().getString(R.string.err_point_unknown_position));
return;
}
- gp = geo.getCoordsNow();
+ gp = geo.getCoords();
updateGUI();
}
}
diff --git a/main/src/cgeo/geocaching/cgeonavigate.java b/main/src/cgeo/geocaching/cgeonavigate.java
index 6c7e22b..89c2820 100644
--- a/main/src/cgeo/geocaching/cgeonavigate.java
+++ b/main/src/cgeo/geocaching/cgeonavigate.java
@@ -262,7 +262,7 @@ public class cgeonavigate extends AbstractActivity implements IObserver<IGeoData
}
private void updateDistanceInfo(final IGeoData geo) {
- if (geo.getCoordsNow() == null || dstCoords == null) {
+ if (geo.getCoords() == null || dstCoords == null) {
return;
}
@@ -273,8 +273,8 @@ public class cgeonavigate extends AbstractActivity implements IObserver<IGeoData
headingView = (TextView) findViewById(R.id.heading);
}
- cacheHeading = geo.getCoordsNow().bearingTo(dstCoords);
- distanceView.setText(HumanDistance.getHumanDistance(geo.getCoordsNow().distanceTo(dstCoords)));
+ cacheHeading = geo.getCoords().bearingTo(dstCoords);
+ distanceView.setText(HumanDistance.getHumanDistance(geo.getCoords().distanceTo(dstCoords)));
headingView.setText(Math.round(cacheHeading) + "°");
}
@@ -288,7 +288,7 @@ public class cgeonavigate extends AbstractActivity implements IObserver<IGeoData
navLocation = (TextView) findViewById(R.id.nav_location);
}
- if (geo.getCoordsNow() != null) {
+ if (geo.getCoords() != null) {
String satellites = null;
if (geo.getSatellitesFixed() > 0) {
satellites = res.getString(R.string.loc_sat) + ": " + geo.getSatellitesFixed() + "/" + geo.getSatellitesVisible();
@@ -300,21 +300,21 @@ public class cgeonavigate extends AbstractActivity implements IObserver<IGeoData
navSatellites.setText(satellites);
navType.setText(res.getString(geo.getLocationProvider().resourceId));
- if (geo.getAccuracyNow() >= 0) {
+ if (geo.getAccuracy() >= 0) {
if (Settings.isUseMetricUnits()) {
- navAccuracy.setText("±" + Math.round(geo.getAccuracyNow()) + " m");
+ navAccuracy.setText("±" + Math.round(geo.getAccuracy()) + " m");
} else {
- navAccuracy.setText("±" + Math.round(geo.getAccuracyNow() * IConversion.METERS_TO_FEET) + " ft");
+ navAccuracy.setText("±" + Math.round(geo.getAccuracy() * IConversion.METERS_TO_FEET) + " ft");
}
} else {
navAccuracy.setText(null);
}
- if (geo.getAltitudeNow() != null) {
- final String humanAlt = HumanDistance.getHumanDistance(geo.getAltitudeNow().floatValue() / 1000);
- navLocation.setText(geo.getCoordsNow() + " | " + humanAlt);
+ if (geo.getAltitude() != 0.0f) {
+ final String humanAlt = HumanDistance.getHumanDistance((float) geo.getAltitude() / 1000);
+ navLocation.setText(geo.getCoords() + " | " + humanAlt);
} else {
- navLocation.setText(geo.getCoordsNow().toString());
+ navLocation.setText(geo.getCoords().toString());
}
updateDistanceInfo(geo);
@@ -324,8 +324,8 @@ public class cgeonavigate extends AbstractActivity implements IObserver<IGeoData
navLocation.setText(res.getString(R.string.loc_trying));
}
- if (!Settings.isUseCompass() || geo.getSpeedNow() > 5) { // use GPS when speed is higher than 18 km/h
- northHeading = geo.getBearingNow();
+ if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h
+ northHeading = geo.getBearing();
}
} catch (Exception e) {
Log.w("Failed to LocationUpdater location.");
@@ -340,7 +340,7 @@ public class cgeonavigate extends AbstractActivity implements IObserver<IGeoData
return;
}
- if (app.currentGeo().getSpeedNow() <= 5) { // use compass when speed is lower than 18 km/h
+ if (app.currentGeo().getSpeed() <= 5) { // use compass when speed is lower than 18 km/h
northHeading = dir.directionNow;
}
}
diff --git a/main/src/cgeo/geocaching/cgeopoint.java b/main/src/cgeo/geocaching/cgeopoint.java
index dc43e4a..805b2cc 100644
--- a/main/src/cgeo/geocaching/cgeopoint.java
+++ b/main/src/cgeo/geocaching/cgeopoint.java
@@ -471,8 +471,8 @@ public class cgeopoint extends AbstractActivity implements IObserver<IGeoData> {
@Override
public void update(final IGeoData geo) {
try {
- latButton.setHint(geo.getCoordsNow().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW));
- lonButton.setHint(geo.getCoordsNow().format(GeopointFormatter.Format.LON_DECMINUTE_RAW));
+ latButton.setHint(geo.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW));
+ lonButton.setHint(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE_RAW));
} catch (final Exception e) {
Log.w("Failed to update location.");
}
@@ -481,7 +481,7 @@ public class cgeopoint extends AbstractActivity implements IObserver<IGeoData> {
private class currentListener implements View.OnClickListener {
public void onClick(View arg0) {
- final Geopoint coords = app.currentGeo().getCoordsNow();
+ final Geopoint coords = app.currentGeo().getCoords();
if (coords == null) {
showToast(res.getString(R.string.err_point_unknown_position));
return;
@@ -518,12 +518,12 @@ public class cgeopoint extends AbstractActivity implements IObserver<IGeoData> {
return null;
}
} else {
- if (app.currentGeo().getCoordsNow() == null) {
+ if (app.currentGeo().getCoords() == null) {
showToast(res.getString(R.string.err_point_curr_position_unavailable));
return null;
}
- coords = app.currentGeo().getCoordsNow();
+ coords = app.currentGeo().getCoords();
}
if (StringUtils.isNotBlank(bearingText) && StringUtils.isNotBlank(distanceText)) {
diff --git a/main/src/cgeo/geocaching/cgeopopup.java b/main/src/cgeo/geocaching/cgeopopup.java
index 12af445..d2ff14f 100644
--- a/main/src/cgeo/geocaching/cgeopopup.java
+++ b/main/src/cgeo/geocaching/cgeopopup.java
@@ -501,8 +501,8 @@ public class cgeopopup extends AbstractActivity {
@Override
protected void updateLocation(final IGeoData geo) {
try {
- if (geo.getCoordsNow() != null && cache != null && cache.getCoords() != null) {
- cacheDistance.setText(HumanDistance.getHumanDistance(geo.getCoordsNow().distanceTo(cache.getCoords())));
+ if (geo.getCoords() != null && cache != null && cache.getCoords() != null) {
+ cacheDistance.setText(HumanDistance.getHumanDistance(geo.getCoords().distanceTo(cache.getCoords())));
cacheDistance.bringToFront();
}
} catch (Exception e) {
diff --git a/main/src/cgeo/geocaching/cgeowaypointadd.java b/main/src/cgeo/geocaching/cgeowaypointadd.java
index 7db53d2..ada098b 100644
--- a/main/src/cgeo/geocaching/cgeowaypointadd.java
+++ b/main/src/cgeo/geocaching/cgeowaypointadd.java
@@ -233,15 +233,15 @@ public class cgeowaypointadd extends AbstractActivity implements IObserver<IGeoD
@Override
public void update(final IGeoData geo) {
Log.d("cgeowaypointadd.updateLocation called");
- if (geo.getCoordsNow() == null) {
+ if (geo.getCoords() == null) {
return;
}
try {
Button bLat = (Button) findViewById(R.id.buttonLatitude);
Button bLon = (Button) findViewById(R.id.buttonLongitude);
- bLat.setHint(geo.getCoordsNow().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW));
- bLon.setHint(geo.getCoordsNow().format(GeopointFormatter.Format.LON_DECMINUTE_RAW));
+ bLat.setHint(geo.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE_RAW));
+ bLon.setHint(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE_RAW));
} catch (Exception e) {
Log.w("Failed to update location.");
}
@@ -358,11 +358,11 @@ public class cgeowaypointadd extends AbstractActivity implements IObserver<IGeoD
}
} else {
final IGeoData geo = app.currentGeo();
- if (geo.getCoordsNow() == null) {
+ if (geo.getCoords() == null) {
showToast(res.getString(R.string.err_point_curr_position_unavailable));
return;
} else {
- coords = geo.getCoordsNow();
+ coords = geo.getCoords();
}
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCBase.java b/main/src/cgeo/geocaching/connector/gc/GCBase.java
index e7b22ff..6ff7cdf 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCBase.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCBase.java
@@ -4,7 +4,6 @@ import cgeo.geocaching.ICoordinates;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgeo;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
@@ -69,7 +68,7 @@ public class GCBase {
public static SearchResult searchByViewport(final Viewport viewport, final String[] tokens) {
Strategy strategy = Settings.getLiveMapStrategy();
if (strategy == Strategy.AUTO) {
- float speedNow = cgeoapplication.getInstance().currentGeo().getSpeedNow();
+ float speedNow = cgeoapplication.getInstance().currentGeo().getSpeed();
strategy = speedNow >= 8 ? Strategy.FAST : Strategy.DETAILED; // 8 m/s = 30 km/h
}
// return searchByViewport(viewport, tokens, strategy);
@@ -78,7 +77,7 @@ public class GCBase {
{
SearchResult result = searchByViewport(viewport, tokens, strategy);
String text = Formatter.SEPARATOR + strategy.getL10n() + Formatter.SEPARATOR;
- int speed = (int) cgeoapplication.getInstance().currentGeo().getSpeedNow();
+ int speed = (int) cgeoapplication.getInstance().currentGeo().getSpeed();
if (Settings.isUseMetricUnits()) {
text += speed + " km/h";
} else {
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 7a3d1a0..4b01540 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -871,7 +871,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// Set center of map to my location if appropriate.
private void myLocationInMiddle(final IGeoData geo) {
if (followMyLocation) {
- centerMap(geo.getCoordsNow());
+ centerMap(geo.getCoords());
}
}
@@ -891,7 +891,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
overlayPosition.setCoordinates(geo.getLocation());
}
- if (geo.getCoordsNow() != null) {
+ if (geo.getCoords() != null) {
if (followMyLocation) {
myLocationInMiddle(geo);
} else {
@@ -899,8 +899,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
}
- if (!Settings.isUseCompass() || geo.getSpeedNow() > 5) { // use GPS when speed is higher than 18 km/h
- overlayPosition.setHeading(geo.getBearingNow());
+ if (!Settings.isUseCompass() || geo.getSpeed() > 5) { // use GPS when speed is higher than 18 km/h
+ overlayPosition.setHeading(geo.getBearing());
repaintRequired = true;
}
@@ -923,7 +923,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
return;
}
- if (overlayPosition != null && mapView != null && (app.currentGeo().getSpeedNow() <= 5)) { // use compass when speed is lower than 18 km/h
+ if (overlayPosition != null && mapView != null && (app.currentGeo().getSpeed() <= 5)) { // use compass when speed is lower than 18 km/h
overlayPosition.setHeading(dir.directionNow);
mapView.repaintRequired(overlayPosition);
}
diff --git a/main/src/cgeo/geocaching/ui/AddressListAdapter.java b/main/src/cgeo/geocaching/ui/AddressListAdapter.java
index fa3728c..327b71d 100644
--- a/main/src/cgeo/geocaching/ui/AddressListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/AddressListAdapter.java
@@ -27,7 +27,7 @@ public class AddressListAdapter extends ArrayAdapter<Address> {
public AddressListAdapter(final Context context) {
super(context, 0);
inflater = ((Activity) context).getLayoutInflater();
- location = cgeoapplication.getInstance().currentGeo().getCoordsNow();
+ location = cgeoapplication.getInstance().currentGeo().getCoords();
}
@Override