diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index c046a6b6f2..f244c9bbfa 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -132,11 +132,11 @@ public class MenuBuilder { ll.addView(llIcon); ImageView iconView = new ImageView(view.getContext()); - LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconParams.gravity = Gravity.CENTER_VERTICAL; iconView.setLayoutParams(llIconParams); - iconView.setScaleType(ImageView.ScaleType.CENTER); + iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setImageDrawable(icon); llIcon.addView(iconView); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index f55c343e9d..3ba941c857 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -75,11 +75,11 @@ public class AmenityMenuBuilder extends MenuBuilder { ll.addView(llIcon); ImageView iconView = new ImageView(view.getContext()); - LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f)); llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(32f), dpToPx(12f)); llIconParams.gravity = Gravity.CENTER_VERTICAL; iconView.setLayoutParams(llIconParams); - iconView.setScaleType(ImageView.ScaleType.CENTER); + iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); iconView.setImageDrawable(icon); llIcon.addView(iconView); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java index 63c592b39e..c31bee9d00 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java @@ -89,7 +89,21 @@ public class AmenityMenuController extends MenuController { @Override public void addPlainMenuItems(String typeStr, PointDescription pointDescription, LatLon latLon) { if (!Algorithms.isEmpty(typeStr)) { - addPlainMenuItem(R.drawable.ic_action_info_dark, typeStr, false); + int resId = 0; + PoiCategory pc = amenity.getType(); + if (!Algorithms.isEmpty(getNameStr())) { + resId = getLeftIconId(); + } + if (resId == 0) { + resId = RenderingIcons.getBigIconResourceId(pc.getIconKeyName()); + } + if (resId == 0) { + resId = getLeftIconId(); + } + if (resId == 0) { + resId = R.drawable.ic_action_folder_stroke; + } + addPlainMenuItem(resId, typeStr, false); } addMyLocationToPlainItems(pointDescription, amenity.getLocation()); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java index 273e86c927..938a7e18e4 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/EditPOIMenuBuilder.java @@ -2,9 +2,12 @@ package net.osmand.plus.osmedit; import android.view.View; +import net.osmand.osm.MapPoiTypes; +import net.osmand.osm.PoiType; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.mapcontextmenu.MenuBuilder; +import net.osmand.plus.render.RenderingIcons; import java.util.Map; @@ -29,12 +32,35 @@ public class EditPOIMenuBuilder extends MenuBuilder { OpenstreetmapPoint point = (OpenstreetmapPoint) osmPoint; for (Map.Entry e : point.getEntity().getTags().entrySet()) { - String text; if (EditPoiData.POI_TYPE_TAG.equals(e.getKey())) { - text = e.getValue(); - } else { - text = e.getKey() + "=" + e.getValue(); + String poiTranslation = e.getValue(); + Map poiTypeMap = MapPoiTypes.getDefault().getAllTranslatedNames(false); + PoiType poiType = poiTypeMap.get(poiTranslation.toLowerCase()); + int resId = 0; + if (poiType != null) { + String id = null; + if (RenderingIcons.containsBigIcon(poiType.getIconKeyName())) { + id = poiType.getIconKeyName(); + } else if (RenderingIcons.containsBigIcon(poiType.getOsmTag() + "_" + poiType.getOsmValue())) { + id = poiType.getOsmTag() + "_" + poiType.getOsmValue(); + } + if (id != null) { + resId = RenderingIcons.getBigIconResourceId(id); + } + } + if (resId == 0) { + resId = R.drawable.ic_action_folder_stroke; + } + buildRow(view, resId, poiTranslation, 0, false, 0); + break; } + } + + for (Map.Entry e : point.getEntity().getTags().entrySet()) { + if (EditPoiData.POI_TYPE_TAG.equals(e.getKey())) { + continue; + } + String text = e.getKey() + "=" + e.getValue(); buildRow(view, R.drawable.ic_action_info_dark, text, 0, false, 0); } }