From b74674295684b723e780f735b3d948de84a66afd Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 16 Oct 2011 11:49:34 +0200 Subject: [PATCH] Add confirmation message --- OsmAnd/res/values/strings.xml | 2 ++ .../plus/activities/LocalIndexesActivity.java | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index ae41105c14..02609f20ee 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,7 @@ + About to delete + Are you sure about deleting %1$s? Suburb Hamlet Village diff --git a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java index 1b01c0ac20..13f829a05c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/LocalIndexesActivity.java @@ -108,6 +108,7 @@ public class LocalIndexesActivity extends ExpandableListActivity { updateDescriptionTextWithSize(); } + @SuppressWarnings("unchecked") @Override protected void onResume() { super.onResume(); @@ -165,7 +166,17 @@ public class LocalIndexesActivity extends ExpandableListActivity { } else if (resId == R.string.local_index_mi_restore) { new LocalIndexOperationTask(RESTORE_OPERATION).execute(info); } else if (resId == R.string.local_index_mi_delete) { - new LocalIndexOperationTask(DELETE_OPERATION).execute(info); + Builder confirm = new AlertDialog.Builder(LocalIndexesActivity.this); + confirm.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + new LocalIndexOperationTask(DELETE_OPERATION).execute(info); + } + }); + confirm.setNegativeButton(R.string.default_buttons_no, null); + confirm.setTitle(R.string.delete_confirmation_title); + confirm.setMessage(getString(R.string.delete_confirmation_msg, info.getFileName())); + confirm.show(); } else if (resId == R.string.local_index_mi_backup) { new LocalIndexOperationTask(BACKUP_OPERATION).execute(info); } else if (resId == R.string.local_index_mi_upload_gpx) {