diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-13 12:02:11 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-13 12:02:11 +0200 |
| commit | bb3ed391288dd80295c32da2baf1df89f562ed2d (patch) | |
| tree | 8c719c0e64b2b611cc7c7c28b8d40e3c7175feb0 /main | |
| parent | 1d37c0c934d0731574982f45b5ae565cd21aafaa (diff) | |
| parent | 2e6caaa61eff54f717da0810f9ab748a7f6dffbe (diff) | |
| download | cgeo-bb3ed391288dd80295c32da2baf1df89f562ed2d.zip cgeo-bb3ed391288dd80295c32da2baf1df89f562ed2d.tar.gz cgeo-bb3ed391288dd80295c32da2baf1df89f562ed2d.tar.bz2 | |
Merge remote-tracking branch 'koem/enums' into upstream
Conflicts:
main/src/cgeo/geocaching/maps/CGeoMap.java
Diffstat (limited to 'main')
| -rw-r--r-- | main/src/cgeo/geocaching/StaticMapsProvider.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/apps/AbstractLocusApp.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgBase.java | 69 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgCoord.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 8 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgWaypoint.java | 14 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeowaypointadd.java | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/enumerations/WaypointType.java | 20 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/files/GPXParser.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 44 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CachesOverlay.java | 13 |
12 files changed, 91 insertions, 94 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index 6eaa662..91fa719 100644 --- a/main/src/cgeo/geocaching/StaticMapsProvider.java +++ b/main/src/cgeo/geocaching/StaticMapsProvider.java @@ -80,7 +80,7 @@ public class StaticMapsProvider { waypoints.append("&markers=icon%3A"); waypoints.append(MARKERS_URL); waypoints.append("marker_waypoint_"); - waypoints.append(waypoint.type); + waypoints.append(waypoint.type != null ? waypoint.type.id : null); waypoints.append(".png%7C"); waypoints.append(String.format((Locale) null, "%.6f", waypoint.coords.getLatitude())); waypoints.append(','); diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java index 6213899..3819b40 100644 --- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java @@ -1,8 +1,8 @@ package cgeo.geocaching.apps; import cgeo.geocaching.R; -import cgeo.geocaching.cgCache; import cgeo.geocaching.Settings; +import cgeo.geocaching.cgCache; import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.enumerations.CacheSize; import cgeo.geocaching.enumerations.CacheType; @@ -148,7 +148,7 @@ public abstract class AbstractLocusApp extends AbstractApp { PointGeocachingDataWaypoint wp = new PointGeocachingDataWaypoint(); wp.code = waypoint.geocode; wp.name = waypoint.name; - String locusWpId = toLocusId(WaypointType.FIND_BY_ID.get(waypoint.type)); + String locusWpId = toLocusId(waypoint.type); if (locusWpId != null) { wp.type = locusWpId; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java index 57e67a5..bccf739 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java @@ -1,9 +1,9 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; +import cgeo.geocaching.Settings; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; -import cgeo.geocaching.Settings; import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; @@ -37,7 +37,7 @@ class InternalMap extends AbstractInternalMap implements if (waypoint != null) { mapIntent.putExtra("latitude", waypoint.coords.getLatitude()); mapIntent.putExtra("longitude", waypoint.coords.getLongitude()); - mapIntent.putExtra("wpttype", waypoint.type); + mapIntent.putExtra("wpttype", waypoint.type != null ? waypoint.type.id : null); } else if (coords != null) { mapIntent.putExtra("latitude", coords.getLatitude()); mapIntent.putExtra("longitude", coords.getLongitude()); diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 5230583..6039587 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -135,7 +135,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> waypointTypes = 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>(); @@ -189,7 +189,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; @@ -239,12 +238,11 @@ 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()) { + if (wt != WaypointType.OWN) { + waypointTypes.put(wt, res.getString(wt.stringId)); + } + } // log types logTypes.put("icon_smile", LOG_FOUND_IT); @@ -1422,7 +1420,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.type = WaypointType.FIND_BY_ID.get(matcherWpType.group(1).trim()); } } catch (Exception e) { // failed to parse type @@ -3309,53 +3307,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; diff --git a/main/src/cgeo/geocaching/cgCoord.java b/main/src/cgeo/geocaching/cgCoord.java index a8e6349..ff8765a 100644 --- a/main/src/cgeo/geocaching/cgCoord.java +++ b/main/src/cgeo/geocaching/cgCoord.java @@ -41,6 +41,6 @@ public class cgCoord { coords = waypoint.coords; name = waypoint.name; type = "waypoint"; - typeSpec = waypoint.type; + typeSpec = waypoint.type != null ? waypoint.type.id : null; } } diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 0b35822..c6e26c0 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -1,6 +1,7 @@ package cgeo.geocaching; import cgeo.geocaching.enumerations.CacheSize; +import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.files.LocalStorage; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.Geopoint.MalformedCoordinateException; @@ -1408,7 +1409,7 @@ public class cgData { values.clear(); values.put("geocode", geocode); values.put("updated", timeStamp); - values.put("type", oneWaypoint.type); + values.put("type", oneWaypoint.type != null ? oneWaypoint.type.id : null); values.put("prefix", oneWaypoint.getPrefix()); values.put("lookup", oneWaypoint.lookup); values.put("name", oneWaypoint.name); @@ -1494,7 +1495,7 @@ public class cgData { ContentValues values = new ContentValues(); values.put("geocode", geocode); values.put("updated", System.currentTimeMillis()); - values.put("type", waypoint.type); + values.put("type", waypoint.type != null ? waypoint.type.id : null); values.put("prefix", waypoint.getPrefix()); values.put("lookup", waypoint.lookup); values.put("name", waypoint.name); @@ -2199,9 +2200,10 @@ public class cgData { private static cgWaypoint createWaypointFromDatabaseContent(Cursor cursor) { cgWaypoint waypoint = new cgWaypoint(); + waypoint.id = cursor.getInt(cursor.getColumnIndex("_id")); waypoint.geocode = cursor.getString(cursor.getColumnIndex("geocode")); - waypoint.type = cursor.getString(cursor.getColumnIndex("type")); + waypoint.type = WaypointType.FIND_BY_ID.get(cursor.getString(cursor.getColumnIndex("type"))); waypoint.setPrefix(cursor.getString(cursor.getColumnIndex("prefix"))); waypoint.lookup = cursor.getString(cursor.getColumnIndex("lookup")); waypoint.name = cursor.getString(cursor.getColumnIndex("name")); diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/cgWaypoint.java index 6fc59d7..aaaa07e 100644 --- a/main/src/cgeo/geocaching/cgWaypoint.java +++ b/main/src/cgeo/geocaching/cgWaypoint.java @@ -1,5 +1,6 @@ package cgeo.geocaching; +import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; import org.apache.commons.lang3.StringUtils; @@ -12,7 +13,7 @@ import java.util.List; public class cgWaypoint implements Comparable<cgWaypoint> { public Integer id = 0; public String geocode = "geocode"; - public String type = "waypoint"; + public WaypointType type = WaypointType.WAYPOINT; private String prefix = ""; public String lookup = ""; public String name = ""; @@ -22,14 +23,7 @@ public class cgWaypoint implements Comparable<cgWaypoint> { private Integer cachedOrder = null; public void setIcon(Resources res, cgBase base, TextView nameView) { - int iconId = R.drawable.waypoint_waypoint; - if (type != null) { - int specialId = res.getIdentifier("waypoint_" + type, "drawable", base.context.getPackageName()); - if (specialId > 0) { - iconId = specialId; - } - } - nameView.setCompoundDrawablesWithIntrinsicBounds(res.getDrawable(iconId), null, null, null); + nameView.setCompoundDrawablesWithIntrinsicBounds(res.getDrawable(type.drawableId), null, null, null); } public void merge(final cgWaypoint old) { @@ -84,7 +78,7 @@ public class cgWaypoint implements Comparable<cgWaypoint> { } public boolean isUserDefined() { - return type != null && type.equalsIgnoreCase("own"); + return type == WaypointType.OWN; } private int computeOrder() { diff --git a/main/src/cgeo/geocaching/cgeowaypointadd.java b/main/src/cgeo/geocaching/cgeowaypointadd.java index 0f161e6..5d21f0e 100644 --- a/main/src/cgeo/geocaching/cgeowaypointadd.java +++ b/main/src/cgeo/geocaching/cgeowaypointadd.java @@ -2,6 +2,7 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.activity.ActivityMixin; +import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.DistanceParser; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter; @@ -32,7 +33,7 @@ public class cgeowaypointadd extends AbstractActivity { private cgUpdateLoc geoUpdate = new update(); private ProgressDialog waitDialog = null; private cgWaypoint waypoint = null; - private String type = "own"; + private WaypointType type = WaypointType.OWN; private String prefix = "OWN"; private String lookup = "---"; /** diff --git a/main/src/cgeo/geocaching/enumerations/WaypointType.java b/main/src/cgeo/geocaching/enumerations/WaypointType.java index 2cb22a0..ada738d 100644 --- a/main/src/cgeo/geocaching/enumerations/WaypointType.java +++ b/main/src/cgeo/geocaching/enumerations/WaypointType.java @@ -12,20 +12,24 @@ import java.util.Map; * @author koem */ public enum WaypointType { - FLAG("flag", R.string.wp_final), - OWN("own", R.string.wp_stage), - PKG("pkg", R.string.wp_pkg), - PUZZLE("puzzle", R.string.wp_puzzle), - STAGE("stage", R.string.wp_stage), - TRAILHEAD("trailhead", R.string.wp_trailhead), - WAYPOINT("waypoint", R.string.wp_waypoint); + FLAG("flag", R.string.wp_final, R.drawable.waypoint_flag, R.drawable.marker_waypoint_flag), + OWN("own", R.string.wp_waypoint, R.drawable.waypoint_waypoint, R.drawable.marker_waypoint_waypoint), + PKG("pkg", R.string.wp_pkg, R.drawable.waypoint_pkg, R.drawable.marker_waypoint_pkg), + PUZZLE("puzzle", R.string.wp_puzzle, R.drawable.waypoint_puzzle, R.drawable.marker_waypoint_puzzle), + STAGE("stage", R.string.wp_stage, R.drawable.waypoint_stage, R.drawable.marker_waypoint_stage), + TRAILHEAD("trailhead", R.string.wp_trailhead, R.drawable.waypoint_trailhead, R.drawable.marker_waypoint_trailhead), + WAYPOINT("waypoint", R.string.wp_waypoint, R.drawable.waypoint_waypoint, R.drawable.marker_waypoint_waypoint); public final String id; public final int stringId; + public final int drawableId; + public final int markerId; - private WaypointType(String id, int stringId) { + private WaypointType(String id, int stringId, int drawableId, int markerId) { this.id = id; this.stringId = stringId; + this.drawableId = drawableId; + this.markerId = markerId; } public static final Map<String, WaypointType> FIND_BY_ID; diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java index dd11e55..94f1e58 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -306,7 +306,7 @@ public abstract class GPXParser extends FileParser { if (cacheForWaypoint != null) { final cgWaypoint waypoint = new cgWaypoint(); waypoint.id = -1; - waypoint.type = convertWaypointSym2Type(sym).id; + waypoint.type = convertWaypointSym2Type(sym); waypoint.geocode = cacheGeocodeForWaypoint; waypoint.setPrefix(cache.name.substring(0, 2)); waypoint.lookup = "---"; diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 7c0d1a0..baaa78b 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -16,6 +16,7 @@ import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.cgeocaches; import cgeo.geocaching.activity.ActivityMixin; +import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl; import cgeo.geocaching.maps.interfaces.GeoPointImpl; @@ -92,7 +93,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory private String searchIdIntent = null; private String geocodeIntent = null; private Geopoint coordsIntent = null; - private String waypointTypeIntent = null; + private WaypointType waypointTypeIntent = null; private int[] mapStateIntent = null; // status data private UUID searchId = null; @@ -330,7 +331,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory final double latitudeIntent = extras.getDouble("latitude"); final double longitudeIntent = extras.getDouble("longitude"); coordsIntent = new Geopoint(latitudeIntent, longitudeIntent); - waypointTypeIntent = extras.getString("wpttype"); + waypointTypeIntent = WaypointType.FIND_BY_ID.get(extras.getString("wpttype")); mapStateIntent = extras.getIntArray("mapstate"); if ("".equals(searchIdIntent)) { @@ -683,7 +684,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory mapIntent.putExtra("latitude", coordsIntent.getLatitude()); mapIntent.putExtra("longitude", coordsIntent.getLongitude()); } - mapIntent.putExtra("wpttype", waypointTypeIntent); + mapIntent.putExtra("wpttype", waypointTypeIntent != null ? waypointTypeIntent.id : null); int[] mapState = new int[4]; GeoPointImpl mapCenter = mapView.getMapViewCenter(); mapState[0] = mapCenter.getLatitudeE6(); @@ -1314,10 +1315,10 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory continue; } - items.add(getItem(new cgCoord(oneWaypoint), false, oneWaypoint.type, false, false, false)); + items.add(getWaypointItem(new cgCoord(oneWaypoint), oneWaypoint.type)); } } - items.add(getItem(new cgCoord(cacheOne), true, cacheOne.type, cacheOne.own, cacheOne.found, cacheOne.disabled)); + items.add(getCacheItem(new cgCoord(cacheOne), cacheOne.type, cacheOne.own, cacheOne.found, cacheOne.disabled)); } overlayCaches.updateItems(items); @@ -1346,12 +1347,10 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory } /** - * Returns a OverlayItem representing the cache/waypoint + * Returns a OverlayItem representing the cache * * @param cgCoord * The coords - * @param cache - * true for caches * @param type * String name * @param own @@ -1362,13 +1361,36 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory * true for disabled * @return */ + private CachesOverlayItemImpl getCacheItem(cgCoord cgCoord, String type, boolean own, boolean found, boolean disabled) { + return getItem(cgCoord, cgBase.getCacheMarkerIcon(type, own, found, disabled)); + } - private CachesOverlayItemImpl getItem(cgCoord cgCoord, boolean cache, String type, boolean own, boolean found, boolean disabled) { + /** + * Returns a OverlayItem representing the waypoint + * + * @param cgCoord + * The coords + * @param type + * The waypoint's type + * @return + */ + private CachesOverlayItemImpl getWaypointItem(cgCoord cgCoord, WaypointType type) { + return getItem(cgCoord, type != null ? type.markerId : WaypointType.WAYPOINT.markerId); + } + /** + * Returns a OverlayItem represented by an icon + * + * @param cgCoord + * The coords + * @param icon + * The icon + * @return + */ + private CachesOverlayItemImpl getItem(cgCoord cgCoord, int icon) { coordinates.add(cgCoord); CachesOverlayItemImpl item = Settings.getMapFactory().getCachesOverlayItem(cgCoord, null); - int icon = cgBase.getMarkerIcon(cache, type, own, found, disabled); Drawable pin = null; if (iconsCache.containsKey(icon)) { pin = iconsCache.get(icon); @@ -1515,7 +1537,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory coordinates.add(coord); CachesOverlayItemImpl item = Settings.getMapFactory().getCachesOverlayItem(coord, null); - final int icon = cgBase.getMarkerIcon(false, waypointTypeIntent, false, false, false); + final int icon = waypointTypeIntent != null ? waypointTypeIntent.markerId : null; Drawable pin = null; if (iconsCache.containsKey(icon)) { pin = iconsCache.get(icon); diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java index eaac8b8..60561b2 100644 --- a/main/src/cgeo/geocaching/maps/CachesOverlay.java +++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java @@ -1,12 +1,13 @@ package cgeo.geocaching.maps; +import cgeo.geocaching.Settings; import cgeo.geocaching.cgBase; import cgeo.geocaching.cgCoord; -import cgeo.geocaching.Settings; import cgeo.geocaching.cgeodetail; import cgeo.geocaching.cgeonavigate; import cgeo.geocaching.cgeopopup; import cgeo.geocaching.cgeowaypoint; +import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl; import cgeo.geocaching.maps.interfaces.GeneralOverlay; @@ -314,14 +315,12 @@ public class CachesOverlay extends AbstractItemizedOverlay implements GeneralOve } else { dialog.setTitle("waypoint"); - String waypointType; - if (cgBase.cacheTypesInv.containsKey(coordinate.typeSpec)) { - waypointType = cgBase.waypointTypes.get(coordinate.typeSpec); - } else { - waypointType = cgBase.waypointTypes.get("waypoint"); + String waypointL10N = cgBase.waypointTypes.get(WaypointType.FIND_BY_ID.get(coordinate.typeSpec)); + if (waypointL10N == null) { + waypointL10N = cgBase.waypointTypes.get(WaypointType.WAYPOINT); } - dialog.setMessage(Html.fromHtml(item.getTitle()) + "\n\ntype: " + waypointType); + dialog.setMessage(Html.fromHtml(item.getTitle()) + "\n\ntype: " + waypointL10N); dialog.setPositiveButton("navigate", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { |
