Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
177d472639
4 changed files with 49 additions and 9 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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<String, String> 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<String, PoiType> 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<String, String> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue