aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/enumerations
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-05-13 23:02:53 +0200
committerSamuel Tardieu <sam@rfc1149.net>2014-05-13 23:02:53 +0200
commit5f85f3b82eebd45337087afac23eb6adfdc8ea59 (patch)
treefbb43ebeae92965f5b3283b5dc92177dc762ea3e /main/src/cgeo/geocaching/enumerations
parent711eac31cda82e1b1c190695343450740cc5d985 (diff)
downloadcgeo-5f85f3b82eebd45337087afac23eb6adfdc8ea59.zip
cgeo-5f85f3b82eebd45337087afac23eb6adfdc8ea59.tar.gz
cgeo-5f85f3b82eebd45337087afac23eb6adfdc8ea59.tar.bz2
fix #3836: cache type is no longer recognized due to gc.com change
Diffstat (limited to 'main/src/cgeo/geocaching/enumerations')
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index 506c791..535bfab 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -58,15 +58,19 @@ public enum CacheType {
private final static Map<String, CacheType> FIND_BY_ID;
private final static Map<String, CacheType> FIND_BY_PATTERN;
+ private final static Map<String, CacheType> FIND_BY_GUID;
static {
final HashMap<String, CacheType> mappingId = new HashMap<String, CacheType>();
final HashMap<String, CacheType> mappingPattern = new HashMap<String, CacheType>();
+ final HashMap<String, CacheType> mappingGuid = new HashMap<String, CacheType>();
for (CacheType ct : values()) {
mappingId.put(ct.id, ct);
mappingPattern.put(ct.pattern.toLowerCase(Locale.US), ct);
+ mappingGuid.put(ct.guid, ct);
}
FIND_BY_ID = Collections.unmodifiableMap(mappingId);
FIND_BY_PATTERN = Collections.unmodifiableMap(mappingPattern);
+ FIND_BY_GUID = Collections.unmodifiableMap(mappingGuid);
}
public static CacheType getById(final String id) {
@@ -85,6 +89,14 @@ public enum CacheType {
return result;
}
+ public static CacheType getByGuid(final String id) {
+ final CacheType result = (id != null) ? CacheType.FIND_BY_GUID.get(id) : null;
+ if (result == null) {
+ return UNKNOWN;
+ }
+ return result;
+ }
+
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}