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 | |
| parent | 9731ffa193c81c77ad64cb06c7574098113fd316 (diff) | |
| download | cgeo-6e950c529ab6d1df27841e88b4237180a2465b79.zip cgeo-6e950c529ab6d1df27841e88b4237180a2465b79.tar.gz cgeo-6e950c529ab6d1df27841e88b4237180a2465b79.tar.bz2 | |
always use WaypointType
| -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 | 67 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgData.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgWaypoint.java | 14 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeodetail.java | 2 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeowaypointadd.java | 9 | ||||
| -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 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/files/GPXParserTest.java | 4 |
13 files changed, 93 insertions, 99 deletions
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java index 59990b7..1bf5655 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.typee != null ? waypoint.typee.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..20810d5 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.typee); 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..bd432c0 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.typee.id); } 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 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; diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index 86d6b60..6d07c64 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; @@ -1412,7 +1413,7 @@ public class cgData { values.clear(); values.put("geocode", geocode); values.put("updated", timeStamp); - values.put("type", oneWaypoint.type); + values.put("type", oneWaypoint.typee != null ? oneWaypoint.typee.id : null); values.put("prefix", oneWaypoint.getPrefix()); values.put("lookup", oneWaypoint.lookup); values.put("name", oneWaypoint.name); @@ -1498,7 +1499,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.typee != null ? waypoint.typee.id : null); values.put("prefix", waypoint.getPrefix()); values.put("lookup", waypoint.lookup); values.put("name", waypoint.name); @@ -2201,7 +2202,7 @@ public class cgData { cgWaypoint waypoint = new cgWaypoint(); waypoint.id = (int) cursor.getInt(cursor.getColumnIndex("_id")); waypoint.geocode = (String) cursor.getString(cursor.getColumnIndex("geocode")); - waypoint.type = (String) cursor.getString(cursor.getColumnIndex("type")); + waypoint.typee = WaypointType.FIND_BY_ID.get((String) cursor.getString(cursor.getColumnIndex("type"))); waypoint.setPrefix((String) cursor.getString(cursor.getColumnIndex("prefix"))); waypoint.lookup = (String) cursor.getString(cursor.getColumnIndex("lookup")); waypoint.name = (String) cursor.getString(cursor.getColumnIndex("name")); diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/cgWaypoint.java index 6fc59d7..2e0e309 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 typee = 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(typee.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 typee == WaypointType.OWN; } private int computeOrder() { diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java index d3daad2..45fea30 100644 --- a/main/src/cgeo/geocaching/cgeodetail.java +++ b/main/src/cgeo/geocaching/cgeodetail.java @@ -1028,7 +1028,7 @@ public class cgeodetail extends AbstractActivity { waypointView = (LinearLayout) inflater.inflate(R.layout.waypoint_item, null); final TextView identification = (TextView) waypointView.findViewById(R.id.identification); - ((TextView) waypointView.findViewById(R.id.type)).setText(cgBase.waypointTypes.get(wpt.type)); + ((TextView) waypointView.findViewById(R.id.type)).setText(cgBase.waypointTypees.get(wpt.typee)); if (wpt.getPrefix().equalsIgnoreCase("OWN") == false) { identification.setText(wpt.getPrefix().trim() + "/" + wpt.lookup.trim()); } else { diff --git a/main/src/cgeo/geocaching/cgeowaypointadd.java b/main/src/cgeo/geocaching/cgeowaypointadd.java index b33e3ff..e4e1479 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 = "---"; /** @@ -53,7 +54,7 @@ public class cgeowaypointadd extends AbstractActivity { id = -1; } else { geocode = waypoint.geocode; - type = waypoint.type; + type = waypoint.typee; prefix = waypoint.getPrefix(); lookup = waypoint.lookup; @@ -126,7 +127,7 @@ public class cgeowaypointadd extends AbstractActivity { Button addWaypoint = (Button) findViewById(R.id.add_waypoint); addWaypoint.setOnClickListener(new coordsListener()); - List<String> wayPointNames = new ArrayList<String>(cgBase.waypointTypes.values()); + List<String> wayPointNames = new ArrayList<String>(cgBase.waypointTypees.values()); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.name); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames); textView.setAdapter(adapter); @@ -328,7 +329,7 @@ public class cgeowaypointadd extends AbstractActivity { final String note = ((EditText) findViewById(R.id.note)).getText().toString().trim(); final cgWaypoint waypoint = new cgWaypoint(); - waypoint.type = type; + waypoint.typee = type; waypoint.geocode = geocode; waypoint.setPrefix(prefix); waypoint.lookup = 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 226efab..9ef25c9 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -301,7 +301,7 @@ public abstract class GPXParser extends FileParser { if (cacheForWaypoint != null) { final cgWaypoint waypoint = new cgWaypoint(); waypoint.id = -1; - waypoint.type = convertWaypointSym2Type(sym).id; + waypoint.typee = 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 481ae62..b02d796 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -14,6 +14,7 @@ import cgeo.geocaching.cgUser; import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeoapplication; 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; @@ -88,7 +89,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 waypointTypeeIntent = null; private int[] mapStateIntent = null; // status data private UUID searchId = null; @@ -326,7 +327,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"); + waypointTypeeIntent = WaypointType.FIND_BY_ID.get(extras.getString("wpttype")); mapStateIntent = extras.getIntArray("mapstate"); if ("".equals(searchIdIntent)) { @@ -675,7 +676,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", waypointTypeeIntent.id); int[] mapState = new int[4]; GeoPointImpl mapCenter = mapView.getMapViewCenter(); mapState[0] = mapCenter.getLatitudeE6(); @@ -1305,10 +1306,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.typee)); } } - 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); @@ -1337,12 +1338,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 @@ -1353,13 +1352,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); @@ -1506,7 +1528,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 = waypointTypeeIntent.markerId; 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..07e0004 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.waypointTypees.get(coordinate.typeSpec); + if (waypointL10N == null) { + waypointL10N = cgBase.waypointTypees.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) { diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java index a2512a8..22401a1 100644 --- a/tests/src/cgeo/geocaching/files/GPXParserTest.java +++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java @@ -159,7 +159,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertEquals("---", wp.lookup); assertEquals("Parkplatz", wp.name); assertEquals("Kostenfreies Parken (je nach Parkreihe Parkscheibe erforderlich)", wp.note); - assertEquals(WaypointType.PKG.id, wp.type); + assertEquals(WaypointType.PKG, wp.typee); assertEquals(49.317517, wp.coords.getLatitude(), 0.000001); assertEquals(8.545083, wp.coords.getLongitude(), 0.000001); @@ -169,7 +169,7 @@ public class GPXParserTest extends InstrumentationTestCase { assertEquals("---", wp.lookup); assertEquals("Station 1", wp.name); assertEquals("Ein zweiter Wegpunkt, der nicht wirklich existiert sondern nur zum Testen gedacht ist.", wp.note); - assertEquals(WaypointType.STAGE.id, wp.type); + assertEquals(WaypointType.STAGE, wp.typee); assertEquals(49.317500, wp.coords.getLatitude(), 0.000001); assertEquals(8.545100, wp.coords.getLongitude(), 0.000001); } |
