Add confirmation message

This commit is contained in:
Victor Shcherb 2011-10-16 11:49:34 +02:00
parent 74671267b5
commit b746742956
2 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="delete_confirmation_title">About to delete</string>
<string name="delete_confirmation_msg">Are you sure about deleting %1$s?</string>
<string name="city_type_suburb">Suburb</string>
<string name="city_type_hamlet">Hamlet</string>
<string name="city_type_village">Village</string>

View file

@ -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) {