aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-10-19 22:22:22 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-10-19 22:22:22 +0200
commitddaa662b5f2d7bf6cbe8dae5b8854097ce4f1cce (patch)
tree25f850a66e417a1340af7efa25f490483310525e
parentf8464a5954ded9e985cd137eeb2e32322943a633 (diff)
downloadcgeo-ddaa662b5f2d7bf6cbe8dae5b8854097ce4f1cce.zip
cgeo-ddaa662b5f2d7bf6cbe8dae5b8854097ce4f1cce.tar.gz
cgeo-ddaa662b5f2d7bf6cbe8dae5b8854097ce4f1cce.tar.bz2
new: strike through past event caches in lists
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListAdapter.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
index 017eb51..56cc60a 100644
--- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
@@ -18,6 +18,7 @@ import cgeo.geocaching.sorting.EventDateComparator;
import cgeo.geocaching.sorting.InverseComparator;
import cgeo.geocaching.sorting.VisitComparator;
import cgeo.geocaching.utils.AngleUtils;
+import cgeo.geocaching.utils.DateUtils;
import cgeo.geocaching.utils.Log;
import org.apache.commons.collections4.CollectionUtils;
@@ -399,7 +400,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
}
Spannable spannable = null;
- if (cache.isDisabled() || cache.isArchived()) { // strike
+ if (cache.isDisabled() || cache.isArchived() || isPastEvent(cache)) { // strike
spannable = Spannable.Factory.getInstance().newSpannable(cache.getName());
spannable.setSpan(new StrikethroughSpan(), 0, spannable.toString().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
@@ -488,6 +489,10 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
return v;
}
+ private static boolean isPastEvent(final Geocache cache) {
+ return cache.isEventCache() && DateUtils.daysSince(cache.getHiddenDate().getTime()) > 0;
+ }
+
private static Drawable getCacheIcon(Geocache cache) {
int hashCode = getIconHashCode(cache.getType(), cache.hasUserModifiedCoords() || cache.hasFinalDefined());
final Drawable drawable = gcIconDrawables.get(hashCode);