aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/DataStore.java
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-04-25 14:23:03 +0200
committerMichael Keppler <michael.keppler@gmx.de>2014-04-25 14:23:15 +0200
commit530440bbb9ce55f96395055abe86dcdcac3ca2a6 (patch)
treebbcfc8fee5872a8fccece03b2b3d76ecb2025679 /main/src/cgeo/geocaching/DataStore.java
parent31ea44fe5261808f827741296029384ca517df4f (diff)
downloadcgeo-530440bbb9ce55f96395055abe86dcdcac3ca2a6.zip
cgeo-530440bbb9ce55f96395055abe86dcdcac3ca2a6.tar.gz
cgeo-530440bbb9ce55f96395055abe86dcdcac3ca2a6.tar.bz2
fix #3791: have logs separated from caches
Diffstat (limited to 'main/src/cgeo/geocaching/DataStore.java')
-rw-r--r--main/src/cgeo/geocaching/DataStore.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index 302bfc3..0adefb8 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -25,6 +25,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+
import rx.android.observables.AndroidObservable;
import rx.functions.Action1;
import rx.functions.Func0;
@@ -1188,7 +1189,6 @@ public class DataStore {
saveAttributesWithoutTransaction(cache);
saveWaypointsWithoutTransaction(cache);
saveSpoilersWithoutTransaction(cache);
- saveLogsWithoutTransaction(cache.getGeocode(), cache.getLogs());
saveLogCountsWithoutTransaction(cache);
saveInventoryWithoutTransaction(cache.getGeocode(), cache.getInventory());
@@ -1421,7 +1421,7 @@ public class DataStore {
}
}
- private static void saveLogsWithoutTransaction(final String geocode, final List<LogEntry> logs) {
+ public static void saveLogsWithoutTransaction(final String geocode, final List<LogEntry> logs) {
// TODO delete logimages referring these logs
database.delete(dbTableLogs, "geocode = ?", new String[]{geocode});
@@ -1655,7 +1655,6 @@ public class DataStore {
}
if (loadFlags.contains(LoadFlag.LOAD_LOGS)) {
- cache.setLogs(loadLogs(cache.getGeocode()));
final Map<LogType, Integer> logCounts = loadLogCounts(cache.getGeocode());
if (MapUtils.isNotEmpty(logCounts)) {
cache.getLogCounts().clear();
@@ -1917,6 +1916,11 @@ public class DataStore {
return false;
}
+ /**
+ * @param geocode
+ * @return an immutable, non null list of logs
+ */
+ @NonNull
public static List<LogEntry> loadLogs(String geocode) {
List<LogEntry> logs = new ArrayList<LogEntry>();
@@ -1952,7 +1956,7 @@ public class DataStore {
cursor.close();
- return logs;
+ return Collections.unmodifiableList(logs);
}
public static Map<LogType, Integer> loadLogCounts(String geocode) {