diff options
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/StoredList.java | 34 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 4 |
2 files changed, 34 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/StoredList.java b/main/src/cgeo/geocaching/StoredList.java index bb00506..d6f0993 100644 --- a/main/src/cgeo/geocaching/StoredList.java +++ b/main/src/cgeo/geocaching/StoredList.java @@ -34,6 +34,29 @@ public class StoredList { return title + " [" + count + "]"; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + id; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof StoredList)) { + return false; + } + StoredList other = (StoredList) obj; + if (id != other.id) { + return false; + } + return true; + } + public static class UserInterface { private final IAbstractActivity activity; private final cgeoapplication app; @@ -46,16 +69,23 @@ public class StoredList { } public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards) { - promptForListSelection(titleId, runAfterwards, false); + promptForListSelection(titleId, runAfterwards, false, -1); } - public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards, final boolean onlyMoveTargets) { + public void promptForListSelection(final int titleId, final RunnableWithArgument<Integer> runAfterwards, final boolean onlyMoveTargets, final int exceptListId) { final List<StoredList> lists = cgData.getLists(); if (lists == null) { return; } + if (exceptListId > StoredList.TEMPORARY_LIST_ID) { + StoredList exceptList = cgData.getList(exceptListId); + if (exceptList != null) { + lists.remove(exceptList); + } + } + final List<CharSequence> listsTitle = new ArrayList<CharSequence>(); for (StoredList list : lists) { listsTitle.add(list.getTitleAndCount()); diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index aa4c89e..628c012 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -985,7 +985,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity refreshCurrentList(); } - }, true); + }, true, listId); } @Override @@ -1045,7 +1045,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity adapter.setSelectMode(false); refreshCurrentList(); } - }, true); + }, true, listId); break; case MENU_STORE_CACHE: //FIXME: this must use the same handler like in the CacheDetailActivity. Will be done by moving the handler into the store method. |
