diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 18daff693a..6798f05e22 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,7 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Do you want to delete all active markers? Do you want to clear markers history? Active markers Map markers diff --git a/OsmAnd/src/net/osmand/plus/activities/MapMarkersActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapMarkersActivity.java index 5ca4e7e45a..e735f9a086 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapMarkersActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapMarkersActivity.java @@ -288,15 +288,15 @@ public class MapMarkersActivity extends OsmandListActivity implements DynamicLis v.findViewById(R.id.check_item).setVisibility(View.GONE); v.findViewById(R.id.ProgressBar).setVisibility(View.GONE); - if (type == MARKERS_HISTORY) { - final Button btn = (Button) v.findViewById(R.id.header_button); - btn.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) - : getResources().getColor(R.color.osmand_orange)); - btn.setText(getString(R.string.shared_string_clear)); - btn.setVisibility(View.VISIBLE); - btn.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { + final Button btn = (Button) v.findViewById(R.id.header_button); + btn.setTextColor(!nightMode ? getResources().getColor(R.color.map_widget_blue) + : getResources().getColor(R.color.osmand_orange)); + btn.setText(getString(R.string.shared_string_clear)); + btn.setVisibility(View.VISIBLE); + btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (type == MARKERS_HISTORY) { AlertDialog.Builder builder = new AlertDialog.Builder(MapMarkersActivity.this); builder.setMessage(getString(R.string.clear_markers_history_q)) .setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { @@ -309,9 +309,22 @@ public class MapMarkersActivity extends OsmandListActivity implements DynamicLis }) .setNegativeButton(R.string.shared_string_no, null) .show(); + } else if (type == ACTIVE_MARKERS) { + AlertDialog.Builder builder = new AlertDialog.Builder(MapMarkersActivity.this); + builder.setMessage(getString(R.string.clear_active_markers_q)) + .setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + getListAdapter().notifyDataSetInvalidated(); + getMyApplication().getMapMarkersHelper().removeActiveMarkers(); + reloadListAdapter(); + } + }) + .setNegativeButton(R.string.shared_string_no, null) + .show(); } - }); - } + } + }); TextView tv = (TextView) v.findViewById(R.id.header_text); AndroidUtils.setTextPrimaryColor(this, tv, nightMode); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java index b70b786ecd..0fc2f91f79 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/MapMarkerMenuController.java @@ -25,6 +25,7 @@ public class MapMarkerMenuController extends MenuController { @Override public void buttonPressed() { markersHelper.removeMapMarker(getMapMarker().index); + markersHelper.addMapMarkerHistory(getMapMarker()); getMapActivity().getContextMenu().close(); } };