aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/DataStore.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-09-14 07:51:24 +0200
committerBananeweizen <bananeweizen@gmx.de>2013-09-14 07:51:24 +0200
commit8987674ab4882f7684c773fc181f5a3fac5f8f12 (patch)
treed54dbf08cbee8791c5cc7853bab55779a179c7d0 /main/src/cgeo/geocaching/DataStore.java
parent7f42e219f58d14f7f4a8bf27886bb615c918a6b2 (diff)
downloadcgeo-8987674ab4882f7684c773fc181f5a3fac5f8f12.zip
cgeo-8987674ab4882f7684c773fc181f5a3fac5f8f12.tar.gz
cgeo-8987674ab4882f7684c773fc181f5a3fac5f8f12.tar.bz2
refactoring: introduce PseudoList to handle non concrete lists
* should make adding a history list entry easier * includes some non null annotations * moved list code into separate package
Diffstat (limited to 'main/src/cgeo/geocaching/DataStore.java')
-rw-r--r--main/src/cgeo/geocaching/DataStore.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index 93067b8..f151ce3 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -13,6 +13,8 @@ import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.files.LocalStorage;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.Viewport;
+import cgeo.geocaching.list.PseudoList;
+import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.FileUtils;
import cgeo.geocaching.utils.Log;
@@ -2019,7 +2021,7 @@ public class DataStore {
reasonIndex = 1;
}
String listKey;
- if (list == StoredList.ALL_LIST_ID) {
+ if (list == PseudoList.ALL_LIST_ID) {
sql.append(" and reason > 0");
listKey = "all_list";
} else {
@@ -2033,7 +2035,7 @@ public class DataStore {
if (cacheType != CacheType.ALL) {
compiledStmnt.bindString(1, cacheType.id);
}
- if (list != StoredList.ALL_LIST_ID) {
+ if (list != PseudoList.ALL_LIST_ID) {
compiledStmnt.bindLong(reasonIndex, list);
}
return (int) compiledStmnt.simpleQueryForLong();
@@ -2076,7 +2078,7 @@ public class DataStore {
final StringBuilder selection = new StringBuilder();
selection.append("reason ");
- selection.append(listId != StoredList.ALL_LIST_ID ? "=" + Math.max(listId, 1) : ">= " + StoredList.STANDARD_LIST_ID);
+ selection.append(listId != PseudoList.ALL_LIST_ID ? "=" + Math.max(listId, 1) : ">= " + StoredList.STANDARD_LIST_ID);
selection.append(" and detailed = 1 ");
String[] selectionArgs = null;
@@ -2537,8 +2539,8 @@ public class DataStore {
}
Resources res = CgeoApplication.getInstance().getResources();
- if (id == StoredList.ALL_LIST_ID) {
- return new StoredList(StoredList.ALL_LIST_ID, res.getString(R.string.list_all_lists), getAllCachesCount());
+ if (id == PseudoList.ALL_LIST_ID) {
+ return new StoredList(PseudoList.ALL_LIST_ID, res.getString(R.string.list_all_lists), getAllCachesCount());
}
// fall back to standard list in case of invalid list id
@@ -2653,7 +2655,7 @@ public class DataStore {
}
public static void moveToList(final List<Geocache> caches, final int listId) {
- if (listId == StoredList.ALL_LIST_ID) {
+ if (listId == PseudoList.ALL_LIST_ID) {
return;
}
if (caches.isEmpty()) {