diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2011-08-29 20:49:39 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2011-08-29 20:49:39 +0200 |
| commit | 48ec48f87f7b736411f28cb76ac1add8c61d2e10 (patch) | |
| tree | 88be8911c9b8088808101929206e4a4da4d81680 /src | |
| parent | 08c73a9d14e160d6c00e6fc36215bef97c7b7414 (diff) | |
| download | cgeo-48ec48f87f7b736411f28cb76ac1add8c61d2e10.zip cgeo-48ec48f87f7b736411f28cb76ac1add8c61d2e10.tar.gz cgeo-48ec48f87f7b736411f28cb76ac1add8c61d2e10.tar.bz2 | |
don't ask for list deletion in case of empty list, fixes #277
Diffstat (limited to 'src')
| -rw-r--r-- | src/cgeo/geocaching/cgeocaches.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/cgeo/geocaching/cgeocaches.java b/src/cgeo/geocaching/cgeocaches.java index 495eed7..40b379f 100644 --- a/src/cgeo/geocaching/cgeocaches.java +++ b/src/cgeo/geocaching/cgeocaches.java @@ -2475,21 +2475,33 @@ public class cgeocaches extends AbstractListActivity { alert.show(); } + private void removeListInternal() { + boolean status = app.removeList(listId); + + if (status) { + showToast(res.getString(R.string.list_dialog_remove_ok)); + switchListById(1); + } else { + showToast(res.getString(R.string.list_dialog_remove_err)); + } + } + private void removeList() { + // if there are no caches on this list, don't bother the user with questions. + // there is no harm in deleting the list, he could recreate it easily + if (cacheList != null && cacheList.isEmpty()) { + removeListInternal(); + return; + } + + // ask him, if there are caches on the list final AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.list_dialog_remove_title); alert.setMessage(R.string.list_dialog_remove_description); alert.setPositiveButton(R.string.list_dialog_remove, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { - boolean status = app.removeList(listId); - - if (status) { - showToast(res.getString(R.string.list_dialog_remove_ok)); - switchListById(1); - } else { - showToast(res.getString(R.string.list_dialog_remove_err)); - } + removeListInternal(); } }); alert.setNegativeButton(res.getString(R.string.list_dialog_cancel), new DialogInterface.OnClickListener() { |
