diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-09-08 00:00:58 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-09-08 11:32:14 +0200 |
| commit | 39ec7accd759fd60706523b366977ba371efd168 (patch) | |
| tree | 401ba08d9ec58e49d02ce614e12db5cf7b2b57bd /src/cgeo/geocaching/cgDistanceView.java | |
| parent | 668472ec735f827a4741a971614596df02618689 (diff) | |
| download | cgeo-39ec7accd759fd60706523b366977ba371efd168.zip cgeo-39ec7accd759fd60706523b366977ba371efd168.tar.gz cgeo-39ec7accd759fd60706523b366977ba371efd168.tar.bz2 | |
Refactoring to use Geopoint for coordinates
This uses the new Geopoint immutable class discussed in #58. No more
independent longitude or latitude fields -- they are now treated
and defined as a consistent pair.
Diffstat (limited to 'src/cgeo/geocaching/cgDistanceView.java')
| -rw-r--r-- | src/cgeo/geocaching/cgDistanceView.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/cgeo/geocaching/cgDistanceView.java b/src/cgeo/geocaching/cgDistanceView.java index 9610e4f..ae9e7b7 100644 --- a/src/cgeo/geocaching/cgDistanceView.java +++ b/src/cgeo/geocaching/cgDistanceView.java @@ -3,11 +3,11 @@ package cgeo.geocaching; import android.content.Context; import android.util.AttributeSet; import android.widget.TextView; +import cgeo.geocaching.geopoint.Geopoint; public class cgDistanceView extends TextView { private cgBase base = null; - private Double cacheLat = null; - private Double cacheLon = null; + private Geopoint cacheCoords = null; public cgDistanceView(Context context) { super(context); @@ -21,18 +21,17 @@ public class cgDistanceView extends TextView { super(context, attrs, defStyle); } - public void setContent(cgBase baseIn, Double cacheLatIn, Double cacheLonIn) { + public void setContent(cgBase baseIn, final Geopoint cacheCoordsIn) { base = baseIn; - cacheLat = cacheLatIn; - cacheLon = cacheLonIn; + cacheCoords = cacheCoordsIn; } - public void update(Double latitude, Double longitude) { - if (cacheLat == null || cacheLon == null) return; - if (latitude == null || longitude == null) return; + public void update(final Geopoint coords) { + if (cacheCoords == null) return; + if (coords == null) return; if (base == null) return; - setText(base.getHumanDistance(cgBase.getDistance(latitude, longitude, cacheLat, cacheLon))); + setText(base.getHumanDistance(cgBase.getDistance(coords, cacheCoords))); } public void setDistance(Double distance) { |
