diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2011-10-22 18:12:45 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2011-10-22 18:12:45 +0200 |
| commit | bafeafa02c41ac3b8440fde6ecbe35f4c2c8b391 (patch) | |
| tree | 383074c24575f8c893da06c75d6c6b1293d670bc | |
| parent | 2af071bce981c56fa0b58eef8c5883e78e93abf0 (diff) | |
| download | cgeo-bafeafa02c41ac3b8440fde6ecbe35f4c2c8b391.zip cgeo-bafeafa02c41ac3b8440fde6ecbe35f4c2c8b391.tar.gz cgeo-bafeafa02c41ac3b8440fde6ecbe35f4c2c8b391.tar.bz2 | |
refactoring: unify and improve when cache size shall not be shown
| -rw-r--r-- | main/src/cgeo/geocaching/cgCache.java | 9 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgCacheListAdapter.java | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index cdd0fc3..1479fec 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -577,4 +577,13 @@ public class cgCache implements ICache { } return nameForSorting; } + + public boolean isVirtual() { + return CacheType.VIRTUAL.id.equalsIgnoreCase(type) || CacheType.WEBCAM.id.equalsIgnoreCase(type) + || CacheType.EARTH.id.equalsIgnoreCase(type); + } + + public boolean showSize() { + return !((isEventCache() || isVirtual()) && size == CacheSize.NOT_CHOSEN); + } } diff --git a/main/src/cgeo/geocaching/cgCacheListAdapter.java b/main/src/cgeo/geocaching/cgCacheListAdapter.java index d562a15..bc82369 100644 --- a/main/src/cgeo/geocaching/cgCacheListAdapter.java +++ b/main/src/cgeo/geocaching/cgCacheListAdapter.java @@ -552,10 +552,13 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> { cacheInfo.append(cache.geocode); } if (cache.size != null) { - if (cacheInfo.length() > 0) { - cacheInfo.append(" | "); + // don't show "not chosen" for events and virtuals, that should be the normal case + if (cache.showSize()) { + if (cacheInfo.length() > 0) { + cacheInfo.append(" | "); + } + cacheInfo.append(res.getString(cache.size.stringId)); } - cacheInfo.append(res.getString(cache.size.stringId)); } if ((cache.difficulty != null && cache.difficulty > 0f) || (cache.terrain != null && cache.terrain > 0f) || (cache.rating != null && cache.rating > 0f)) { if (cacheInfo.length() > 0 && ((cache.difficulty != null && cache.difficulty > 0f) || (cache.terrain != null && cache.terrain > 0f))) { |
