aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/StoredList.java
diff options
context:
space:
mode:
authorOndřej Kunc <kunc88@gmail.com>2012-05-20 00:47:00 +0200
committerOndřej Kunc <kunc88@gmail.com>2012-05-20 00:47:00 +0200
commitfaf0a95eb3bdcf6550b88fb3c0b93b31dbbf957e (patch)
tree736c5e08ce2d5f64af1b99486ac29fed6397208e /main/src/cgeo/geocaching/StoredList.java
parentf8102fe27dc5c217a167d584ea8afd992ee518bb (diff)
downloadcgeo-faf0a95eb3bdcf6550b88fb3c0b93b31dbbf957e.zip
cgeo-faf0a95eb3bdcf6550b88fb3c0b93b31dbbf957e.tar.gz
cgeo-faf0a95eb3bdcf6550b88fb3c0b93b31dbbf957e.tar.bz2
Virtual "all caches" list
Diffstat (limited to 'main/src/cgeo/geocaching/StoredList.java')
-rw-r--r--main/src/cgeo/geocaching/StoredList.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/StoredList.java b/main/src/cgeo/geocaching/StoredList.java
index eaf677d..6cf018a 100644
--- a/main/src/cgeo/geocaching/StoredList.java
+++ b/main/src/cgeo/geocaching/StoredList.java
@@ -18,6 +18,7 @@ import java.util.List;
public class StoredList {
public static final int TEMPORARY_LIST_ID = 0;
public static final int STANDARD_LIST_ID = 1;
+ public static final int ALL_LIST_ID = 2;
public final int id;
public final String title;
@@ -45,6 +46,10 @@ public class StoredList {
}
public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards) {
+ promptForListSelection(titleId, runAfterwards, false);
+ }
+
+ public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards, final boolean onlyMoveTargets) {
final List<StoredList> lists = app.getLists();
if (lists == null) {
@@ -55,6 +60,9 @@ public class StoredList {
for (StoredList list : lists) {
listsTitle.add(list.getTitleAndCount());
}
+ if (!onlyMoveTargets) {
+ listsTitle.add("<" + res.getString(R.string.list_menu_all_lists) + ">");
+ }
listsTitle.add("<" + res.getString(R.string.list_menu_create) + ">");
final CharSequence[] items = new CharSequence[listsTitle.size()];
@@ -63,7 +71,10 @@ public class StoredList {
builder.setTitle(res.getString(titleId));
builder.setItems(listsTitle.toArray(items), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int itemId) {
- if (itemId >= lists.size()) {
+ if (itemId == lists.size() && !onlyMoveTargets) {
+ // all lists
+ runAfterwards.run(StoredList.ALL_LIST_ID);
+ } else if (itemId >= lists.size()) {
// create new list on the fly
promptForListCreation(runAfterwards);
}