diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 1e6fc96f53..4ce3a7d886 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -2061,5 +2061,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A Contact us Map legend Do you really want to save poi without POI type? + Modify OSM change diff --git a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java index 8a6b509cdb..d1168e5001 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/UpdatesIndexFragment.java @@ -1,16 +1,5 @@ package net.osmand.plus.download.ui; -import java.util.Comparator; -import java.util.List; - -import net.osmand.map.OsmandRegions; -import net.osmand.plus.OsmandApplication; -import net.osmand.plus.R; -import net.osmand.plus.activities.OsmAndListFragment; -import net.osmand.plus.download.DownloadActivity; -import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; -import net.osmand.plus.download.DownloadResources; -import net.osmand.plus.download.IndexItem; import android.app.Activity; import android.content.Context; import android.os.Bundle; @@ -27,6 +16,18 @@ import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; +import net.osmand.map.OsmandRegions; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.OsmAndListFragment; +import net.osmand.plus.download.DownloadActivity; +import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents; +import net.osmand.plus.download.DownloadResources; +import net.osmand.plus.download.IndexItem; + +import java.util.Comparator; +import java.util.List; + public class UpdatesIndexFragment extends OsmAndListFragment implements DownloadEvents { private static final int RELOAD_ID = 5; private UpdateIndexAdapter listAdapter; @@ -210,5 +211,4 @@ public class UpdatesIndexFragment extends OsmAndListFragment implements Download return v; } } - } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index ebd7508969..845c3bdcaa 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -162,15 +162,11 @@ public class OsmEditingPlugin extends OsmandPlugin { new EditPoiDialogFragment.ShowDeleteDialogAsyncTask(mapActivity) .execute((Amenity) selectedObj); } else if (resId == R.string.poi_context_menu_modify) { - if (selectedObj instanceof Amenity) { - EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity); - } else if (selectedObj instanceof OpenstreetmapPoint) { - final Node entity = ((OpenstreetmapPoint) selectedObj).getEntity(); - EditPoiDialogFragment.createInstance(entity, false) - .show(mapActivity.getSupportFragmentManager(), "edit_poi"); - } else { - throw new IllegalArgumentException("Selected object is not editable"); - } + EditPoiDialogFragment.showEditInstance((Amenity) selectedObj, mapActivity); + } else if (resId == R.string.poi_context_menu_modify_osm_change) { + final Node entity = ((OpenstreetmapPoint) selectedObj).getEntity(); + EditPoiDialogFragment.createInstance(entity, false) + .show(mapActivity.getSupportFragmentManager(), "edit_poi"); } return true; } @@ -180,12 +176,13 @@ public class OsmEditingPlugin extends OsmandPlugin { Amenity amenity = (Amenity) selectedObj; final PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); isEditable = !amenity.getType().isWiki() && !poiType.isNotEditableOsm(); - } else if (selectedObj instanceof OpenstreetmapPoint) { - isEditable = true; } if (isEditable) { adapter.item(R.string.poi_context_menu_modify).iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg(); adapter.item(R.string.poi_context_menu_delete).iconColor(R.drawable.ic_action_delete_dark).listen(listener).position(2).reg(); + } else if (selectedObj instanceof OpenstreetmapPoint) { + adapter.item(R.string.poi_context_menu_modify_osm_change) + .iconColor(R.drawable.ic_action_edit_dark).listen(listener).position(1).reg(); } else { adapter.item(R.string.context_menu_item_create_poi).iconColor(R.drawable.ic_action_plus_dark).listen(listener).position(-1).reg(); } diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 9a3178f16e..ab1117f520 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -30,6 +30,7 @@ import android.widget.Toast; import net.osmand.access.AccessibleToast; import net.osmand.data.PointDescription; +import net.osmand.osm.edit.Node; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; @@ -464,6 +465,19 @@ public class OsmEditsFragment extends OsmAndListFragment return true; } }); + if (info instanceof OpenstreetmapPoint) { + item = optionsMenu.getMenu().add(R.string.poi_context_menu_modify_osm_change) + .setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_edit_dark)); + item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { + @Override + public boolean onMenuItemClick(MenuItem item) { + final Node entity = ((OpenstreetmapPoint) info).getEntity(); + EditPoiDialogFragment.createInstance(entity, false) + .show(getActivity().getSupportFragmentManager(), "edit_poi"); + return true; + } + }); + } item = optionsMenu.getMenu().add(R.string.shared_string_delete). setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_delete_dark)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {