From 1bd9b7bff918f0282df7ddf97a20034e555364af Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 17 Nov 2017 18:40:47 +0200 Subject: [PATCH] Change icons --- OsmAnd/res/values/colors.xml | 4 ++++ .../osmand/plus/osmedit/OsmEditsAdapter.java | 24 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values/colors.xml b/OsmAnd/res/values/colors.xml index c95e62c66f..3d16d4ae95 100644 --- a/OsmAnd/res/values/colors.xml +++ b/OsmAnd/res/values/colors.xml @@ -305,4 +305,8 @@ #9fadfc #ed5421 + #73b825 + #FDD835 + #e53935 + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java index d52250269e..cf7c7ff088 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsAdapter.java @@ -11,8 +11,11 @@ import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; +import net.osmand.osm.edit.Node; +import net.osmand.osm.edit.OSMSettings; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; +import net.osmand.plus.render.RenderingIcons; import net.osmand.util.Algorithms; import java.util.List; @@ -117,7 +120,26 @@ public class OsmEditsAdapter extends ArrayAdapter { private Drawable getIcon(OsmPoint point) { if (point.getGroup() == OsmPoint.Group.POI) { - return app.getIconsCache().getIcon(R.drawable.ic_type_info, R.color.color_distance); + Node node = ((OpenstreetmapPoint) point).getEntity(); + int iconResId = 0; + String typeStr = node.getTag(OSMSettings.OSMTagKey.AMENITY); + if (!Algorithms.isEmpty(typeStr)) { + iconResId = RenderingIcons.getBigIconResourceId(OSMSettings.OSMTagKey.AMENITY.getValue() + "_" + typeStr); + } + if (iconResId == 0) { + iconResId = R.drawable.ic_type_info; + } + int colorResId = R.color.color_distance; + if (point.getAction() == OsmPoint.Action.CREATE) { + colorResId = R.color.color_osm_edit_create; + } else if (point.getAction() == OsmPoint.Action.MODIFY) { + colorResId = R.color.color_osm_edit_modify; + } else if (point.getAction() == OsmPoint.Action.DELETE) { + colorResId = R.color.color_osm_edit_delete; + } else if (point.getAction() == OsmPoint.Action.REOPEN) { + colorResId = R.color.color_osm_edit_modify; + } + return app.getIconsCache().getIcon(iconResId, colorResId); } else if (point.getGroup() == OsmPoint.Group.BUG) { return app.getIconsCache().getIcon(R.drawable.ic_type_bug, R.color.color_distance); }