diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-06-03 07:34:32 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-06-03 07:34:32 +0200 |
| commit | 133c78c84688c5cb6fe8ba5651e4815b6a0ff634 (patch) | |
| tree | 6681c2700da473a6d15b044a4de4d3b0e397903f /main/src/cgeo/geocaching/CacheDetailActivity.java | |
| parent | fbf4086d126aeb3fd34bd0563891cbaf7704eac5 (diff) | |
| download | cgeo-133c78c84688c5cb6fe8ba5651e4815b6a0ff634.zip cgeo-133c78c84688c5cb6fe8ba5651e4815b6a0ff634.tar.gz cgeo-133c78c84688c5cb6fe8ba5651e4815b6a0ff634.tar.bz2 | |
refactoring: have more physical units code in one place
Diffstat (limited to 'main/src/cgeo/geocaching/CacheDetailActivity.java')
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index bf80e5a..f897ffe 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -14,8 +14,7 @@ import cgeo.geocaching.enumerations.LoadFlags.SaveFlag; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.GeopointFormatter; -import cgeo.geocaching.geopoint.HumanDistance; -import cgeo.geocaching.geopoint.IConversion; +import cgeo.geocaching.geopoint.Units; import cgeo.geocaching.network.HtmlImage; import cgeo.geocaching.network.Parameters; import cgeo.geocaching.ui.CacheDetailsCreator; @@ -138,21 +137,13 @@ public class CacheDetailActivity extends AbstractActivity { final StringBuilder dist = new StringBuilder(); if (geo.getCoords() != null && cache != null && cache.getCoords() != null) { - dist.append(HumanDistance.getHumanDistance(geo.getCoords().distanceTo(cache.getCoords()))); + dist.append(Units.getDistanceFromKilometers(geo.getCoords().distanceTo(cache.getCoords()))); } if (cache != null && cache.getElevation() != null) { if (geo.getAltitude() != 0.0) { - final double diff = cache.getElevation() - geo.getAltitude(); - dist.append(diff >= 0 ? " ↗" : " ↘"); - // TODO: move code related to different units (from the whole project) into utils code - if (Settings.isUseMetricUnits()) { - dist.append(Math.abs((int) diff)); - dist.append(" m"); - } else { - dist.append(Math.abs((int) (diff * IConversion.METERS_TO_FEET))); - dist.append(" ft"); - } + final float diff = (float) (cache.getElevation() - geo.getAltitude()); + dist.append(' ').append(Units.getElevation(diff)); } } |
