diff options
Diffstat (limited to 'main/src/cgeo/geocaching/ui/CacheDetailsCreator.java')
| -rw-r--r-- | main/src/cgeo/geocaching/ui/CacheDetailsCreator.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java index 9059a6b..5db562e 100644 --- a/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java +++ b/main/src/cgeo/geocaching/ui/CacheDetailsCreator.java @@ -1,16 +1,18 @@ package cgeo.geocaching.ui; +import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.Geocache; import cgeo.geocaching.R; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Units; import org.apache.commons.lang3.StringUtils; +import org.eclipse.jdt.annotation.NonNull; import android.app.Activity; import android.content.res.Resources; +import android.text.format.DateUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -134,7 +136,7 @@ public final class CacheDetailsCreator { public void addDistance(final Geocache cache, final TextView cacheDistanceView) { Float distance = null; if (cache.getCoords() != null) { - final Geopoint currentCoords = cgeoapplication.getInstance().currentGeo().getCoords(); + final Geopoint currentCoords = CgeoApplication.getInstance().currentGeo().getCoords(); if (currentCoords != null) { distance = currentCoords.distanceTo(cache); } @@ -159,7 +161,7 @@ public final class CacheDetailsCreator { public void addDistance(final Waypoint wpt, final TextView waypointDistanceView) { Float distance = null; if (wpt.getCoords() != null) { - final Geopoint currentCoords = cgeoapplication.getInstance().currentGeo().getCoords(); + final Geopoint currentCoords = CgeoApplication.getInstance().currentGeo().getCoords(); if (currentCoords != null) { distance = currentCoords.distanceTo(wpt); } @@ -175,4 +177,14 @@ public final class CacheDetailsCreator { } add(R.string.cache_distance, text); } + + public void addEventDate(@NonNull Geocache cache) { + if (cache.isEventCache() && cache.getHiddenDate() != null) { + final long time = cache.getHiddenDate().getTime(); + if (time > 0) { + final String dateString = DateUtils.formatDateTime(CgeoApplication.getInstance().getBaseContext(), time, DateUtils.FORMAT_SHOW_WEEKDAY) + ", " + Formatter.formatFullDate(time); + add(R.string.cache_event, dateString); + } + } + } } |
