From 258f271c85a801ab7dd05bc550baa15a74fce808 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Wed, 6 Jul 2016 19:11:38 +0300 Subject: [PATCH] Fixed name lookup in context menu after marker was moved --- OsmAnd/src/net/osmand/plus/MapMarkersHelper.java | 14 +++++++------- .../osmand/plus/mapcontextmenu/MapContextMenu.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 412a5f4583..6226eafe56 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -90,13 +90,12 @@ public class MapMarkersHelper { if (colorIndex != mapMarker.colorIndex) return false; if (pos != mapMarker.pos) return false; - if (index != mapMarker.index) return false; - if (history != mapMarker.history) return false; - if (selected != mapMarker.selected) return false; - if (dist != mapMarker.dist) return false; - //noinspection SimplifiableIfStatement - if (!point.equals(mapMarker.point)) return false; - return pointDescription != null ? pointDescription.equals(mapMarker.pointDescription) : mapMarker.pointDescription == null; + //if (index != mapMarker.index) return false; + //if (history != mapMarker.history) return false; + //if (selected != mapMarker.selected) return false; + //if (dist != mapMarker.dist) return false; + return point.equals(mapMarker.point); + //return pointDescription != null ? pointDescription.equals(mapMarker.pointDescription) : mapMarker.pointDescription == null; } @@ -399,6 +398,7 @@ public class MapMarkersHelper { if (marker != null) { settings.moveMapMarker(new LatLon(marker.getLatitude(), marker.getLongitude()), latLon, marker.pointDescription, marker.colorIndex, marker.pos, marker.selected); + marker.point = new LatLon(latLon.getLatitude(), latLon.getLongitude()); readFromSettings(); refresh(); } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index fe2a4ac64f..2cc20e02e2 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -382,8 +382,8 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL @Override public void onMapMarkerChanged(MapMarker mapMarker) { - if (object == mapMarker) { - String address = ((MapMarker) object).getOnlyName(); + if (object.equals(mapMarker)) { + String address = mapMarker.getOnlyName(); nameStr = address; pointDescription.setName(address); WeakReference fragmentRef = findMenuFragment();