aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-10-16 08:39:57 +0200
committerBananeweizen <bananeweizen@gmx.de>2011-10-16 08:39:57 +0200
commitbdf2f092c306274527f0f0f5aed4196a92dd0ca6 (patch)
tree761ee524c08c331b52e571adf4ffa06fc1d8565e /main/src
parent9715ae30450e02fcf731a06888ad832c1734e544 (diff)
downloadcgeo-bdf2f092c306274527f0f0f5aed4196a92dd0ca6.zip
cgeo-bdf2f092c306274527f0f0f5aed4196a92dd0ca6.tar.gz
cgeo-bdf2f092c306274527f0f0f5aed4196a92dd0ca6.tar.bz2
support cache type "unknown", fixes #518
* refactored many places to reference the cache type enum * special icon for "unknown" still missing
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/StaticMapsProvider.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java3
-rw-r--r--main/src/cgeo/geocaching/cgBase.java56
-rw-r--r--main/src/cgeo/geocaching/cgCache.java8
-rw-r--r--main/src/cgeo/geocaching/cgCacheListAdapter.java3
-rw-r--r--main/src/cgeo/geocaching/cgCoord.java3
-rw-r--r--main/src/cgeo/geocaching/cgeo.java7
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java31
-rw-r--r--main/src/cgeo/geocaching/cgeodetail.java5
-rw-r--r--main/src/cgeo/geocaching/cgeopopup.java5
-rw-r--r--main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java11
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java3
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java3
-rw-r--r--main/src/cgeo/geocaching/files/LocParser.java3
-rw-r--r--main/src/cgeo/geocaching/filter/cgFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/cgFilterByType.java14
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java5
17 files changed, 92 insertions, 72 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java
index 91fa719..96d7222 100644
--- a/main/src/cgeo/geocaching/StaticMapsProvider.java
+++ b/main/src/cgeo/geocaching/StaticMapsProvider.java
@@ -105,7 +105,7 @@ public class StaticMapsProvider {
}
private static String getMarkerUrl(final cgCache cache) {
- String type = "mystery";
+ String type;
if (cache.found) {
type = cache.type + "_found";
} else if (cache.disabled) {
diff --git a/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java b/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java
index b12a6d1..d006571 100644
--- a/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.apps.cache;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
+import cgeo.geocaching.enumerations.CacheType;
import android.content.res.Resources;
@@ -12,6 +13,6 @@ class WhereYouGoApp extends AbstractGeneralApp implements GeneralApp {
@Override
public boolean isEnabled(cgCache cache) {
- return cache != null && cache.type != null && cache.type.equalsIgnoreCase("wherigo");
+ return cache != null && cache.type != null && cache.type.equalsIgnoreCase(CacheType.WHERIGO.id);
}
}
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java
index 52336ad..0935c0d 100644
--- a/main/src/cgeo/geocaching/cgBase.java
+++ b/main/src/cgeo/geocaching/cgBase.java
@@ -964,29 +964,31 @@ public class cgBase {
cacheToAdd.disabled = !oneCache.getBoolean("ia");
int ctid = oneCache.getInt("ctid");
if (ctid == 2) {
- cacheToAdd.type = "traditional";
+ cacheToAdd.type = CacheType.TRADITIONAL.id;
} else if (ctid == 3) {
- cacheToAdd.type = "multi";
+ cacheToAdd.type = CacheType.MULTI.id;
} else if (ctid == 4) {
- cacheToAdd.type = "virtual";
+ cacheToAdd.type = CacheType.VIRTUAL.id;
} else if (ctid == 5) {
- cacheToAdd.type = "letterbox";
+ cacheToAdd.type = CacheType.LETTERBOX.id;
} else if (ctid == 6) {
- cacheToAdd.type = "event";
+ cacheToAdd.type = CacheType.EVENT.id;
} else if (ctid == 8) {
- cacheToAdd.type = "mystery";
+ cacheToAdd.type = CacheType.MYSTERY.id;
} else if (ctid == 11) {
- cacheToAdd.type = "webcam";
+ cacheToAdd.type = CacheType.WEBCAM.id;
} else if (ctid == 13) {
- cacheToAdd.type = "cito";
+ cacheToAdd.type = CacheType.CITO.id;
} else if (ctid == 137) {
- cacheToAdd.type = "earth";
+ cacheToAdd.type = CacheType.EARTH.id;
} else if (ctid == 453) {
- cacheToAdd.type = "mega";
+ cacheToAdd.type = CacheType.MEGA_EVENT.id;
} else if (ctid == 1858) {
- cacheToAdd.type = "wherigo";
+ cacheToAdd.type = CacheType.WHERIGO.id;
} else if (ctid == 3653) {
- cacheToAdd.type = "lost";
+ cacheToAdd.type = CacheType.LOSTANDFOUND.id;
+ } else {
+ cacheToAdd.type = CacheType.UNKNOWN.id;
}
caches.cacheList.add(cacheToAdd);
@@ -3168,13 +3170,13 @@ public class cgBase {
iconTxt = type;
}
} else {
- iconTxt = "traditional";
+ iconTxt = CacheType.TRADITIONAL.id;
}
if (gcIcons.containsKey(iconTxt)) {
icon = gcIcons.get(iconTxt);
} else {
- icon = gcIcons.get("traditional");
+ icon = gcIcons.get(CacheType.TRADITIONAL.id);
}
return icon;
@@ -3197,20 +3199,20 @@ public class cgBase {
gcIcons.put("type_mystery", R.drawable.type_mystery);
gcIcons.put("type_gchq", R.drawable.type_hq);
// default markers
- gcIcons.put("ape", R.drawable.marker_cache_ape);
- gcIcons.put("cito", R.drawable.marker_cache_cito);
- gcIcons.put("earth", R.drawable.marker_cache_earth);
- gcIcons.put("event", R.drawable.marker_cache_event);
- gcIcons.put("letterbox", R.drawable.marker_cache_letterbox);
+ gcIcons.put(CacheType.PROJECT_APE.id, R.drawable.marker_cache_ape);
+ gcIcons.put(CacheType.CITO.id, R.drawable.marker_cache_cito);
+ gcIcons.put(CacheType.EARTH.id, R.drawable.marker_cache_earth);
+ gcIcons.put(CacheType.EVENT.id, R.drawable.marker_cache_event);
+ gcIcons.put(CacheType.LETTERBOX.id, R.drawable.marker_cache_letterbox);
gcIcons.put("locationless", R.drawable.marker_cache_locationless);
- gcIcons.put("mega", R.drawable.marker_cache_mega);
- gcIcons.put("multi", R.drawable.marker_cache_multi);
- gcIcons.put("traditional", R.drawable.marker_cache_traditional);
- gcIcons.put("virtual", R.drawable.marker_cache_virtual);
- gcIcons.put("webcam", R.drawable.marker_cache_webcam);
- gcIcons.put("wherigo", R.drawable.marker_cache_wherigo);
- gcIcons.put("mystery", R.drawable.marker_cache_mystery);
- gcIcons.put("gchq", R.drawable.marker_cache_gchq);
+ gcIcons.put(CacheType.MEGA_EVENT.id, R.drawable.marker_cache_mega);
+ gcIcons.put(CacheType.MULTI.id, R.drawable.marker_cache_multi);
+ gcIcons.put(CacheType.TRADITIONAL.id, R.drawable.marker_cache_traditional);
+ gcIcons.put(CacheType.VIRTUAL.id, R.drawable.marker_cache_virtual);
+ gcIcons.put(CacheType.WEBCAM.id, R.drawable.marker_cache_webcam);
+ gcIcons.put(CacheType.WHERIGO.id, R.drawable.marker_cache_wherigo);
+ gcIcons.put(CacheType.MYSTERY.id, R.drawable.marker_cache_mystery);
+ gcIcons.put(CacheType.GCHQ.id, R.drawable.marker_cache_gchq);
// own cache markers
gcIcons.put("ape-own", R.drawable.marker_cache_ape_own);
gcIcons.put("cito-own", R.drawable.marker_cache_cito_own);
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index 3f18628..8874eae 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.activity.IAbstractActivity;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
import org.apache.commons.collections.CollectionUtils;
@@ -262,7 +263,8 @@ public class cgCache implements ICache {
}
public boolean isEventCache() {
- return "event".equalsIgnoreCase(type) || "mega".equalsIgnoreCase(type) || "cito".equalsIgnoreCase(type);
+ return CacheType.EVENT.id.equalsIgnoreCase(type) || CacheType.MEGA_EVENT.id.equalsIgnoreCase(type)
+ || CacheType.CITO.id.equalsIgnoreCase(type) || CacheType.LOSTANDFOUND.id.equalsIgnoreCase(type);
}
public boolean logVisit(IAbstractActivity fromActivity) {
@@ -309,7 +311,7 @@ public class cgCache implements ICache {
public List<Integer> getPossibleLogTypes() {
boolean isOwner = owner != null && owner.equalsIgnoreCase(Settings.getUsername());
List<Integer> types = new ArrayList<Integer>();
- if ("event".equals(type) || "mega".equals(type) || "cito".equals(type) || "lostfound".equals(type)) {
+ if (isEventCache()) {
types.add(cgBase.LOG_WILL_ATTEND);
types.add(cgBase.LOG_NOTE);
types.add(cgBase.LOG_ATTENDED);
@@ -317,7 +319,7 @@ public class cgCache implements ICache {
if (isOwner) {
types.add(cgBase.LOG_ANNOUNCEMENT);
}
- } else if ("webcam".equals(type)) {
+ } else if (CacheType.WEBCAM.id.equals(type)) {
types.add(cgBase.LOG_WEBCAM_PHOTO_TAKEN);
types.add(cgBase.LOG_DIDNT_FIND_IT);
types.add(cgBase.LOG_NOTE);
diff --git a/main/src/cgeo/geocaching/cgCacheListAdapter.java b/main/src/cgeo/geocaching/cgCacheListAdapter.java
index b941d33..d562a15 100644
--- a/main/src/cgeo/geocaching/cgCacheListAdapter.java
+++ b/main/src/cgeo/geocaching/cgCacheListAdapter.java
@@ -1,5 +1,6 @@
package cgeo.geocaching;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.filter.cgFilter;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.sorting.CacheComparator;
@@ -437,7 +438,7 @@ public class cgCacheListAdapter extends ArrayAdapter<cgCache> {
if (gcIconDrawables.containsKey(cache.type)) { // cache icon
holder.text.setCompoundDrawablesWithIntrinsicBounds(gcIconDrawables.get(cache.type), null, null, null);
} else { // unknown cache type, "mystery" icon
- holder.text.setCompoundDrawablesWithIntrinsicBounds(gcIconDrawables.get("mystery"), null, null, null);
+ holder.text.setCompoundDrawablesWithIntrinsicBounds(gcIconDrawables.get(CacheType.MYSTERY.id), null, null, null);
}
if (holder.inventory.getChildCount() > 0) {
diff --git a/main/src/cgeo/geocaching/cgCoord.java b/main/src/cgeo/geocaching/cgCoord.java
index ff8765a..60f6b63 100644
--- a/main/src/cgeo/geocaching/cgCoord.java
+++ b/main/src/cgeo/geocaching/cgCoord.java
@@ -1,6 +1,7 @@
package cgeo.geocaching;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
public class cgCoord {
@@ -8,7 +9,7 @@ public class cgCoord {
public Integer id = null;
public String geocode = "";
public String type = "cache";
- public String typeSpec = "traditional";
+ public String typeSpec = CacheType.TRADITIONAL.id;
public String name = "";
public boolean found = false;
public boolean disabled = false;
diff --git a/main/src/cgeo/geocaching/cgeo.java b/main/src/cgeo/geocaching/cgeo.java
index df81866..3e61d51 100644
--- a/main/src/cgeo/geocaching/cgeo.java
+++ b/main/src/cgeo/geocaching/cgeo.java
@@ -2,6 +2,7 @@ package cgeo.geocaching;
import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.activity.ActivityMixin;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.maps.CGeoMap;
@@ -348,9 +349,9 @@ public class cgeo extends AbstractActivity {
// then add all other cache types sorted alphabetically
Map<String, String> allTypes = new HashMap<String, String>(cgBase.cacheTypesInv);
- allTypes.remove("traditional");
- allTypes.remove("multi");
- allTypes.remove("mystery");
+ allTypes.remove(CacheType.TRADITIONAL.id);
+ allTypes.remove(CacheType.MULTI.id);
+ allTypes.remove(CacheType.MYSTERY.id);
List<String> sorted = new ArrayList<String>(allTypes.values());
Collections.sort(sorted);
for (String choice : sorted) {
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index bc58fdd..e0250cf 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -7,6 +7,7 @@ import cgeo.geocaching.apps.cache.navi.NavigationAppFactory;
import cgeo.geocaching.apps.cachelist.CacheListAppFactory;
import cgeo.geocaching.enumerations.CacheListType;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.filter.cgFilter;
import cgeo.geocaching.filter.cgFilterBySize;
@@ -1254,35 +1255,35 @@ public class cgeocaches extends AbstractListActivity {
} else if (id == MENU_FILTER_SIZE_NOT_CHOSEN) {
return setFilter(new cgFilterBySize(CacheSize.NOT_CHOSEN));
} else if (id == MENU_FILTER_TYPE_TRADITIONAL) {
- return setFilter(new cgFilterByType("traditional"));
+ return setFilter(new cgFilterByType(CacheType.TRADITIONAL));
} else if (id == MENU_FILTER_TYPE_MULTI) {
- return setFilter(new cgFilterByType("multi"));
+ return setFilter(new cgFilterByType(CacheType.MULTI));
} else if (id == MENU_FILTER_TYPE_MYSTERY) {
- return setFilter(new cgFilterByType("mystery"));
+ return setFilter(new cgFilterByType(CacheType.MYSTERY));
} else if (id == MENU_FILTER_TYPE_LETTERBOX) {
- return setFilter(new cgFilterByType("letterbox"));
+ return setFilter(new cgFilterByType(CacheType.LETTERBOX));
} else if (id == MENU_FILTER_TYPE_EVENT) {
- return setFilter(new cgFilterByType("event"));
+ return setFilter(new cgFilterByType(CacheType.EVENT));
} else if (id == MENU_FILTER_TYPE_MEGA) {
- return setFilter(new cgFilterByType("mega"));
+ return setFilter(new cgFilterByType(CacheType.MEGA_EVENT));
} else if (id == MENU_FILTER_TYPE_EARTH) {
- return setFilter(new cgFilterByType("earth"));
+ return setFilter(new cgFilterByType(CacheType.EARTH));
} else if (id == MENU_FILTER_TYPE_CITO) {
- return setFilter(new cgFilterByType("cito"));
+ return setFilter(new cgFilterByType(CacheType.CITO));
} else if (id == MENU_FILTER_TYPE_WEBCAM) {
- return setFilter(new cgFilterByType("webcam"));
+ return setFilter(new cgFilterByType(CacheType.WEBCAM));
} else if (id == MENU_FILTER_TYPE_VIRTUAL) {
- return setFilter(new cgFilterByType("virtual"));
+ return setFilter(new cgFilterByType(CacheType.VIRTUAL));
} else if (id == MENU_FILTER_TYPE_WHERIGO) {
- return setFilter(new cgFilterByType("wherigo"));
+ return setFilter(new cgFilterByType(CacheType.WHERIGO));
} else if (id == MENU_FILTER_TYPE_LOSTFOUND) {
- return setFilter(new cgFilterByType("lostfound"));
+ return setFilter(new cgFilterByType(CacheType.LOSTANDFOUND));
} else if (id == MENU_FILTER_TYPE_APE) {
- return setFilter(new cgFilterByType("ape"));
+ return setFilter(new cgFilterByType(CacheType.PROJECT_APE));
} else if (id == MENU_FILTER_TYPE_GCHQ) {
- return setFilter(new cgFilterByType("gchq"));
+ return setFilter(new cgFilterByType(CacheType.GCHQ));
} else if (id == MENU_FILTER_TYPE_GPS) {
- return setFilter(new cgFilterByType("gps"));
+ return setFilter(new cgFilterByType(CacheType.GPS_EXHIBIT));
} else if (id == MENU_DROP_CACHE) {
cgBase.dropCache(app, cache, new Handler() {
@Override
diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java
index 637330e..4b6558b 100644
--- a/main/src/cgeo/geocaching/cgeodetail.java
+++ b/main/src/cgeo/geocaching/cgeodetail.java
@@ -8,6 +8,7 @@ import cgeo.geocaching.compatibility.Compatibility;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.utils.CryptUtils;
import org.apache.commons.collections.CollectionUtils;
@@ -682,7 +683,7 @@ public class cgeodetail extends AbstractActivity {
if (cgBase.cacheTypesInv.containsKey(cache.type)) { // cache icon
itemValue.setText(cgBase.cacheTypesInv.get(cache.type) + size);
} else {
- itemValue.setText(cgBase.cacheTypesInv.get("mystery") + size);
+ itemValue.setText(cgBase.cacheTypesInv.get(CacheType.MYSTERY.id) + size);
}
detailsList.addView(itemLayout);
@@ -808,7 +809,7 @@ public class cgeodetail extends AbstractActivity {
itemName = (TextView) itemLayout.findViewById(R.id.name);
itemValue = (TextView) itemLayout.findViewById(R.id.value);
- if (cache.type != null && (cache.type.equalsIgnoreCase("event") || cache.type.equalsIgnoreCase("mega") || cache.type.equalsIgnoreCase("cito"))) {
+ if (cache.isEventCache()) {
itemName.setText(res.getString(R.string.cache_event));
} else {
itemName.setText(res.getString(R.string.cache_hidden));
diff --git a/main/src/cgeo/geocaching/cgeopopup.java b/main/src/cgeo/geocaching/cgeopopup.java
index f8a9541..5be7706 100644
--- a/main/src/cgeo/geocaching/cgeopopup.java
+++ b/main/src/cgeo/geocaching/cgeopopup.java
@@ -2,6 +2,7 @@ package cgeo.geocaching;
import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.apps.cache.navi.NavigationAppFactory;
+import cgeo.geocaching.enumerations.CacheType;
import org.apache.commons.lang3.StringUtils;
@@ -245,10 +246,10 @@ public class cgeopopup extends AbstractActivity {
}
} else {
if (cache.size != null) {
- itemValue.setText(cgBase.cacheTypesInv.get("mystery")
+ itemValue.setText(cgBase.cacheTypesInv.get(CacheType.MYSTERY.id)
+ " (" + res.getString(cache.size.stringId) + ")");
} else {
- itemValue.setText(cgBase.cacheTypesInv.get("mystery"));
+ itemValue.setText(cgBase.cacheTypesInv.get(CacheType.MYSTERY.id));
}
}
detailsList.addView(itemLayout);
diff --git a/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java b/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java
index cda7e54..30c1673 100644
--- a/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java
+++ b/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java
@@ -8,6 +8,7 @@ import cgeo.geocaching.cgLog;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.GeopointParser;
import org.apache.commons.lang3.StringUtils;
@@ -233,15 +234,15 @@ final public class OkapiClient {
private static String getCacheType(final String type) {
if (type.equalsIgnoreCase("Traditional")) {
- return "traditional";
+ return CacheType.TRADITIONAL.id;
} else if (type.equalsIgnoreCase("Multi")) {
- return "multi";
+ return CacheType.MULTI.id;
} else if (type.equalsIgnoreCase("Quiz")) {
- return "mystery";
+ return CacheType.MYSTERY.id;
} else if (type.equalsIgnoreCase("Virtual")) {
- return "virtual";
+ return CacheType.VIRTUAL.id;
}
- return "other";
+ return CacheType.UNKNOWN.id;
}
private static JSONObject request(final String geoCode, final String service, final Parameters params) {
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index 59c774b..1dc9cf1 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -26,7 +26,8 @@ public enum CacheType {
LOSTANDFOUND("lostfound", "lost & found", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound),
PROJECT_APE("ape", "project ape cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape),
GCHQ("gchq", "groundspeak hq", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq),
- GPS_EXHIBIT("gps", "gps cache exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps);
+ GPS_EXHIBIT("gps", "gps cache exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps),
+ UNKNOWN("unknown", "unknown", "", R.string.unknown);
public final String id;
public final String pattern;
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 94f1e58..3ef200f 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -11,6 +11,7 @@ import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;
@@ -796,7 +797,7 @@ public abstract class GPXParser extends FileParser {
}
else {
if (StringUtils.isBlank(cache.type)) {
- cache.type = "mystery"; // default for not recognized types
+ cache.type = CacheType.UNKNOWN.id;
}
}
}
diff --git a/main/src/cgeo/geocaching/files/LocParser.java b/main/src/cgeo/geocaching/files/LocParser.java
index 7442d07..6f8d26c 100644
--- a/main/src/cgeo/geocaching/files/LocParser.java
+++ b/main/src/cgeo/geocaching/files/LocParser.java
@@ -8,6 +8,7 @@ import cgeo.geocaching.cgCoord;
import cgeo.geocaching.cgSearch;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.CacheSize;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.GeopointParser;
import org.apache.commons.lang3.StringUtils;
@@ -156,7 +157,7 @@ public final class LocParser extends FileParser {
caches.cacheList.add(cache);
fixCache(cache);
- cache.type = "traditional"; // type is not given in the LOC file
+ cache.type = CacheType.UNKNOWN.id; // type is not given in the LOC file
cache.reason = listId;
cache.detailed = true;
diff --git a/main/src/cgeo/geocaching/filter/cgFilter.java b/main/src/cgeo/geocaching/filter/cgFilter.java
index 36463ba..550c40a 100644
--- a/main/src/cgeo/geocaching/filter/cgFilter.java
+++ b/main/src/cgeo/geocaching/filter/cgFilter.java
@@ -6,7 +6,7 @@ import java.util.ArrayList;
import java.util.List;
public abstract class cgFilter {
- String name;
+ private String name;
public cgFilter(String name) {
this.name = name;
diff --git a/main/src/cgeo/geocaching/filter/cgFilterByType.java b/main/src/cgeo/geocaching/filter/cgFilterByType.java
index 57607a5..c497777 100644
--- a/main/src/cgeo/geocaching/filter/cgFilterByType.java
+++ b/main/src/cgeo/geocaching/filter/cgFilterByType.java
@@ -2,19 +2,23 @@ package cgeo.geocaching.filter;
import cgeo.geocaching.cgBase;
import cgeo.geocaching.cgCache;
+import cgeo.geocaching.enumerations.CacheType;
public class cgFilterByType extends cgFilter {
- public cgFilterByType(String type) {
- super(type);
+ private CacheType cacheType;
+
+ public cgFilterByType(final CacheType cacheType) {
+ super(cacheType.id);
+ this.cacheType = cacheType;
}
@Override
- boolean applyFilter(cgCache cache) {
- return name.equals(cache.type);
+ boolean applyFilter(final cgCache cache) {
+ return cacheType.id.equals(cache.type);
}
@Override
public String getFilterName() {
- return cgBase.cacheTypesInv.get(name);
+ return cgBase.cacheTypesInv.get(cacheType.id);
}
}
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index 60561b2..2c78a2c 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -7,6 +7,7 @@ import cgeo.geocaching.cgeodetail;
import cgeo.geocaching.cgeonavigate;
import cgeo.geocaching.cgeopopup;
import cgeo.geocaching.cgeowaypoint;
+import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
@@ -155,7 +156,7 @@ public class CachesOverlay extends AbstractItemizedOverlay implements GeneralOve
int radius = center.x - left.x;
final String type = item.getType();
- if (type == null || "multi".equals(type) || "mystery".equals(type) || "virtual".equals(type)) {
+ if (type == null || CacheType.MULTI.id.equals(type) || CacheType.MYSTERY.id.equals(type) || CacheType.VIRTUAL.id.equals(type)) {
blockedCircle.setColor(0x66000000);
blockedCircle.setStyle(Style.STROKE);
canvas.drawCircle(center.x, center.y, radius, blockedCircle);
@@ -279,7 +280,7 @@ public class CachesOverlay extends AbstractItemizedOverlay implements GeneralOve
if (cgBase.cacheTypesInv.containsKey(coordinate.typeSpec)) {
cacheType = cgBase.cacheTypesInv.get(coordinate.typeSpec);
} else {
- cacheType = cgBase.cacheTypesInv.get("mystery");
+ cacheType = cgBase.cacheTypesInv.get(CacheType.MYSTERY.id);
}
dialog.setMessage(Html.fromHtml(item.getTitle()) + "\n\ngeocode: " + coordinate.geocode.toUpperCase() + "\ntype: " + cacheType);