Change icons
This commit is contained in:
parent
cd6a9a473c
commit
1bd9b7bff9
2 changed files with 27 additions and 1 deletions
|
@ -305,4 +305,8 @@
|
||||||
<color name="coordinate_input_keyboard_icon_color">#9fadfc</color>
|
<color name="coordinate_input_keyboard_icon_color">#9fadfc</color>
|
||||||
<color name="coordinate_input_error_color">#ed5421</color>
|
<color name="coordinate_input_error_color">#ed5421</color>
|
||||||
|
|
||||||
|
<color name="color_osm_edit_create">#73b825</color>
|
||||||
|
<color name="color_osm_edit_modify">#FDD835</color>
|
||||||
|
<color name="color_osm_edit_delete">#e53935</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -11,8 +11,11 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
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.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -117,7 +120,26 @@ public class OsmEditsAdapter extends ArrayAdapter<OsmPoint> {
|
||||||
|
|
||||||
private Drawable getIcon(OsmPoint point) {
|
private Drawable getIcon(OsmPoint point) {
|
||||||
if (point.getGroup() == OsmPoint.Group.POI) {
|
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) {
|
} else if (point.getGroup() == OsmPoint.Group.BUG) {
|
||||||
return app.getIconsCache().getIcon(R.drawable.ic_type_bug, R.color.color_distance);
|
return app.getIconsCache().getIcon(R.drawable.ic_type_bug, R.color.color_distance);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue