diff --git a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java index 2e3c5e4a75..b727621a62 100644 --- a/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java +++ b/OsmAnd/src/net/osmand/plus/MapMarkersHelper.java @@ -105,6 +105,36 @@ public class MapMarkersHelper { result = 31 * result + colorIndex; return result; } + + public static int getColorId(int colorIndex) { + int colorId; + switch (colorIndex) { + case 0: + colorId = R.color.marker_blue; + break; + case 1: + colorId = R.color.marker_green; + break; + case 2: + colorId = R.color.marker_orange; + break; + case 3: + colorId = R.color.marker_red; + break; + case 4: + colorId = R.color.marker_yellow; + break; + case 5: + colorId = R.color.marker_teal; + break; + case 6: + colorId = R.color.marker_purple; + break; + default: + colorId = R.color.marker_blue; + } + return colorId; + } } public MapMarkersHelper(OsmandApplication ctx) { @@ -463,34 +493,4 @@ public class MapMarkersHelper { ctx.getGeocodingLookupService().cancel(latLon); } } - - public static int getMapMarkerColorId(int colorIndex) { - int colorId; - switch (colorIndex) { - case 0: - colorId = R.color.marker_blue; - break; - case 1: - colorId = R.color.marker_green; - break; - case 2: - colorId = R.color.marker_orange; - break; - case 3: - colorId = R.color.marker_red; - break; - case 4: - colorId = R.color.marker_yellow; - break; - case 5: - colorId = R.color.marker_teal; - break; - case 6: - colorId = R.color.marker_purple; - break; - default: - colorId = R.color.marker_blue; - } - return colorId; - } } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index cebfc913d3..8187f17f61 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -48,6 +48,7 @@ import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dialogs.FavoriteDialogs; import net.osmand.plus.download.IndexItem; import net.osmand.plus.liveupdates.OsmLiveActivity; +import net.osmand.plus.mapmarkers.MapMarkersDialogFragment; import net.osmand.plus.measurementtool.MeasurementToolFragment; import net.osmand.plus.monitoring.OsmandMonitoringPlugin; import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder; @@ -623,6 +624,18 @@ public class MapActivityActions implements DialogProvider { return false; } }).createItem()); + + optionsMenuHelper.addItem(new ItemBuilder().setTitle("New map markers") + .setIcon(R.drawable.ic_action_flag_dark) + .setListener(new ContextMenuAdapter.ItemClickListener() { + @Override + public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked) { + app.logEvent(mapActivity, "drawer_markers_open"); + MapActivity.clearPrevActivityIntent(); + MapMarkersDialogFragment.showInstance(mapActivity); + return true; + } + }).createItem()); } else { optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.waypoints, mapActivity) .setIcon(R.drawable.ic_action_intermediate) diff --git a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java index f74f7c32ff..35823dfcba 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/MapMarkerDialogHelper.java @@ -783,7 +783,7 @@ public class MapMarkerDialogHelper { } public static Drawable getMapMarkerIcon(OsmandApplication app, int colorIndex) { - return app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, MapMarkersHelper.getMapMarkerColorId(colorIndex)); + return app.getIconsCache().getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(colorIndex)); } public void updateLocation(ListView listView, boolean compassChanged) { @@ -865,7 +865,7 @@ public class MapMarkerDialogHelper { WptPt wpt = new WptPt(); wpt.lat = marker.getLatitude(); wpt.lon = marker.getLongitude(); - wpt.setColor(mapActivity.getResources().getColor(MapMarkersHelper.getMapMarkerColorId(marker.colorIndex))); + wpt.setColor(mapActivity.getResources().getColor(MapMarker.getColorId(marker.colorIndex))); wpt.name = marker.getOnlyName(); //wpt.link = r.getFileName(); //wpt.time = r.getFile().lastModified(); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java index 18d491543c..e3dbc3f318 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java @@ -9,7 +9,6 @@ import android.view.ViewGroup; import net.osmand.Location; import net.osmand.data.LatLon; import net.osmand.plus.IconsCache; -import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.R; @@ -63,7 +62,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter