diff options
| author | koem <koem@petoria.de> | 2011-10-08 16:07:02 +0200 |
|---|---|---|
| committer | koem <koem@petoria.de> | 2011-10-08 16:07:02 +0200 |
| commit | 6e950c529ab6d1df27841e88b4237180a2465b79 (patch) | |
| tree | a46527355078d697536ee6a7ab79d5e708ade2d4 /main/src/cgeo/geocaching/cgBase.java | |
| parent | 9731ffa193c81c77ad64cb06c7574098113fd316 (diff) | |
| download | cgeo-6e950c529ab6d1df27841e88b4237180a2465b79.zip cgeo-6e950c529ab6d1df27841e88b4237180a2465b79.tar.gz cgeo-6e950c529ab6d1df27841e88b4237180a2465b79.tar.bz2 | |
always use WaypointType
Diffstat (limited to 'main/src/cgeo/geocaching/cgBase.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 67 |
1 files changed, 20 insertions, 47 deletions
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index c122bdb..1e44873 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -134,7 +134,7 @@ public class cgBase { public final static Map<String, String> cacheTypesInv = new HashMap<String, String>(); public final static Map<String, String> cacheIDsChoices = new HashMap<String, String>(); public final static Map<CacheSize, String> cacheSizesInv = new HashMap<CacheSize, String>(); - public final static Map<String, String> waypointTypes = new HashMap<String, String>(); + public final static Map<WaypointType, String> waypointTypees = new HashMap<WaypointType, String>(); public final static Map<String, Integer> logTypes = new HashMap<String, Integer>(); public final static Map<String, Integer> logTypes0 = new HashMap<String, Integer>(); public final static Map<Integer, String> logTypes1 = new HashMap<Integer, String>(); @@ -188,7 +188,6 @@ public class cgBase { private static String idBrowser = "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.86 Safari/533.4"; Context context = null; final private static Map<String, Integer> gcIcons = new HashMap<String, Integer>(); - final private static Map<String, Integer> wpIcons = new HashMap<String, Integer>(); public static final int LOG_FOUND_IT = 2; public static final int LOG_DIDNT_FIND_IT = 3; @@ -238,12 +237,9 @@ public class cgBase { } // waypoint types - waypointTypes.put("flag", res.getString(WaypointType.FLAG.stringId)); - waypointTypes.put("stage", res.getString(WaypointType.STAGE.stringId)); - waypointTypes.put("puzzle", res.getString(WaypointType.PUZZLE.stringId)); - waypointTypes.put("pkg", res.getString(WaypointType.PKG.stringId)); - waypointTypes.put("trailhead", res.getString(WaypointType.TRAILHEAD.stringId)); - waypointTypes.put("waypoint", res.getString(WaypointType.WAYPOINT.stringId)); + for (WaypointType wt : WaypointType.values()) { + waypointTypees.put(wt, res.getString(wt.stringId)); + } // log types logTypes.put("icon_smile", LOG_FOUND_IT); @@ -1417,7 +1413,7 @@ public class cgBase { try { final Matcher matcherWpType = patternWpType.matcher(wp[3]); if (matcherWpType.find() && matcherWpType.groupCount() > 0) { - waypoint.type = matcherWpType.group(1).trim(); + waypoint.typee = WaypointType.FIND_BY_ID.get(matcherWpType.group(1).trim()); } } catch (Exception e) { // failed to parse type @@ -3298,53 +3294,30 @@ public class cgBase { return gcIcons.get("type_traditional"); } - public static int getMarkerIcon(final boolean cache, final String type, final boolean own, final boolean found, final boolean disabled) { + public static int getCacheMarkerIcon(final String type, final boolean own, final boolean found, final boolean disabled) { fillIconsMap(); - if (wpIcons.isEmpty()) { - wpIcons.put("waypoint", R.drawable.marker_waypoint_waypoint); - wpIcons.put("flag", R.drawable.marker_waypoint_flag); - wpIcons.put("pkg", R.drawable.marker_waypoint_pkg); - wpIcons.put("puzzle", R.drawable.marker_waypoint_puzzle); - wpIcons.put("stage", R.drawable.marker_waypoint_stage); - wpIcons.put("trailhead", R.drawable.marker_waypoint_trailhead); - } - int icon = -1; String iconTxt = null; - if (cache) { - if (StringUtils.isNotBlank(type)) { - if (own) { - iconTxt = type + "-own"; - } else if (found) { - iconTxt = type + "-found"; - } else if (disabled) { - iconTxt = type + "-disabled"; - } else { - iconTxt = type; - } - } else { - iconTxt = "traditional"; - } - - if (gcIcons.containsKey(iconTxt)) { - icon = gcIcons.get(iconTxt); + if (StringUtils.isNotBlank(type)) { + if (own) { + iconTxt = type + "-own"; + } else if (found) { + iconTxt = type + "-found"; + } else if (disabled) { + iconTxt = type + "-disabled"; } else { - icon = gcIcons.get("traditional"); - } - } else { - if (StringUtils.isNotBlank(type)) { iconTxt = type; - } else { - iconTxt = "waypoint"; } + } else { + iconTxt = "traditional"; + } - if (wpIcons.containsKey(iconTxt)) { - icon = wpIcons.get(iconTxt); - } else { - icon = wpIcons.get("waypoint"); - } + if (gcIcons.containsKey(iconTxt)) { + icon = gcIcons.get(iconTxt); + } else { + icon = gcIcons.get("traditional"); } return icon; |
