diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index a27308683c..01467e1887 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -545,13 +545,13 @@ public class MapActivity extends AccessibleActivity { dashboardOnMap.hideDashboard(); } if (mapLabelToShow != null) { - mapLayers.getContextMenuLayer().setSelectedObject(toShow); - if (toShow instanceof FavouritePoint) { - mapLayers.getContextMenuLayer().showContextMenuForSelectedObjects(latLonToShow); - } else { +// mapLayers.getContextMenuLayer().setSelectedObject(toShow); +// if (toShow instanceof FavouritePoint) { +// mapLayers.getContextMenuLayer().showContextMenuForSelectedObjects(latLonToShow); +// } else { mapLayers.getContextMenuLayer().setLocation(latLonToShow, mapLabelToShow.getFullPlainName(this)); - } +// } } if (!latLonToShow.equals(cur)) { mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(), diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java index 9df81da3cd..980771a4ec 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointDialogHelper.java @@ -424,15 +424,15 @@ public class WaypointDialogHelper { if(ctx.getDashboard().isVisible()) { ctx.getDashboard().hideDashboard(); ctx.getMapLayers().getContextMenuLayer().setSelectedObject(locationPoint); - if (locationPoint instanceof FavouritePoint) { - ctx.getMapLayers().getContextMenuLayer() - .showContextMenuForSelectedObjects(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude())); - } else { +// if (locationPoint instanceof FavouritePoint) { +// ctx.getMapLayers().getContextMenuLayer() +// .showContextMenuForSelectedObjects(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude())); +// } else { ctx.getMapLayers() .getContextMenuLayer() .setLocation(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()), PointDescription.getSimpleName(locationPoint, ctx)); - } +// } } } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index 41f8bedf00..ce63480b42 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -95,6 +95,10 @@ public class MapContextMenu { if (needStreetName()) { acquireStreetName(new LatLon(pointDescription.getLat(), pointDescription.getLon())); } + if (menuController != null) { + menuController.addPlainMenuItems(typeStr, this.pointDescription); + } + return true; } @@ -130,17 +134,8 @@ public class MapContextMenu { if (object != null) { if (object instanceof Amenity) { menuController = new AmenityMenuController(app, mapActivity, (Amenity)object); - if (!Algorithms.isEmpty(typeStr)) { - menuController.addPlainMenuItem(R.drawable.ic_action_info_dark, typeStr); - } - if (pointDescription != null) { - menuController.addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(mapActivity, true).replaceAll("\n", "")); - } } else if (object instanceof FavouritePoint) { menuController = new FavouritePointMenuController(app, mapActivity, (FavouritePoint)object); - if (pointDescription != null) { - menuController.addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(mapActivity, true).replaceAll("\n", "")); - } } } } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java index 1e58b97c2e..822f6b0120 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/AmenityMenuController.java @@ -1,11 +1,14 @@ package net.osmand.plus.mapcontextmenu.details; import android.os.Bundle; +import android.util.Log; import net.osmand.data.Amenity; +import net.osmand.data.PointDescription; import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiType; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.render.RenderingIcons; import net.osmand.util.Algorithms; @@ -70,6 +73,16 @@ public class AmenityMenuController extends MenuController { return typeStr; } + @Override + public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { + if (!Algorithms.isEmpty(typeStr)) { + addPlainMenuItem(R.drawable.ic_action_info_dark, typeStr); + } + if (pointDescription != null) { + addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(getMapActivity(), true).replaceAll("\n", "")); + } + } + @Override public String getNameStr() { return amenity.getName(getMapActivity().getMyApplication().getSettings().MAP_PREFERRED_LOCALE.get()); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java index 1142f695bb..5be820d164 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/FavouritePointMenuController.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import net.osmand.data.FavouritePoint; +import net.osmand.data.PointDescription; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -73,6 +74,13 @@ public class FavouritePointMenuController extends MenuController { return fav.getName(); } + @Override + public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { + if (pointDescription != null) { + addPlainMenuItem(R.drawable.map_my_location, pointDescription.getLocationName(getMapActivity(), true).replaceAll("\n", "")); + } + } + @Override public void saveEntityState(Bundle bundle, String key) { bundle.putSerializable(key, fav); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MenuController.java index 816636a822..f263d476f7 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/details/MenuController.java @@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; +import net.osmand.data.PointDescription; import net.osmand.plus.IconsCache; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -43,6 +44,9 @@ public abstract class MenuController { builder.addPlainMenuItem(iconId, text); } + public void addPlainMenuItems(String typeStr, PointDescription pointDescription) { + } + public int getInitialMenuState() { if (isLandscapeLayout()) { return MenuState.FULL_SCREEN;