From 8987674ab4882f7684c773fc181f5a3fac5f8f12 Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Sat, 14 Sep 2013 07:51:24 +0200 Subject: 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 --- main/src/cgeo/geocaching/DataStore.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'main/src/cgeo/geocaching/DataStore.java') 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 caches, final int listId) { - if (listId == StoredList.ALL_LIST_ID) { + if (listId == PseudoList.ALL_LIST_ID) { return; } if (caches.isEmpty()) { -- cgit v1.1