aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2013-09-13 09:22:41 +0200
committerSamuel Tardieu <sam@rfc1149.net>2013-09-13 09:46:36 +0200
commit15282e600a818c2e4d3b5fc21e8a2d5143d818e5 (patch)
tree3491c025204d27052d36664d1302a6e5defbb9b7
parente0d2a7ff191024c39b3b65fd7f0d52d6340bebbe (diff)
downloadcgeo-15282e600a818c2e4d3b5fc21e8a2d5143d818e5.zip
cgeo-15282e600a818c2e4d3b5fc21e8a2d5143d818e5.tar.gz
cgeo-15282e600a818c2e4d3b5fc21e8a2d5143d818e5.tar.bz2
refactoring: cgData -> DataStore
-rw-r--r--main/src/cgeo/geocaching/AbstractPopupActivity.java2
-rw-r--r--main/src/cgeo/geocaching/CacheCache.java2
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java12
-rw-r--r--main/src/cgeo/geocaching/DataStore.java (renamed from main/src/cgeo/geocaching/cgData.java)66
-rw-r--r--main/src/cgeo/geocaching/EditWaypointActivity.java14
-rw-r--r--main/src/cgeo/geocaching/Geocache.java44
-rw-r--r--main/src/cgeo/geocaching/ImagesActivity.java2
-rw-r--r--main/src/cgeo/geocaching/LogCacheActivity.java12
-rw-r--r--main/src/cgeo/geocaching/LogTrackableActivity.java2
-rw-r--r--main/src/cgeo/geocaching/MainActivity.java12
-rw-r--r--main/src/cgeo/geocaching/NavigateAnyPointActivity.java8
-rw-r--r--main/src/cgeo/geocaching/SearchActivity.java4
-rw-r--r--main/src/cgeo/geocaching/SearchResult.java10
-rw-r--r--main/src/cgeo/geocaching/StaticMapsActivity.java4
-rw-r--r--main/src/cgeo/geocaching/StoredList.java12
-rw-r--r--main/src/cgeo/geocaching/TrackableActivity.java2
-rw-r--r--main/src/cgeo/geocaching/WaypointPopup.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java4
-rw-r--r--main/src/cgeo/geocaching/cgeoapplication.java8
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java22
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConnector.java20
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCMap.java6
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java8
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java6
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OkapiClient.java6
-rw-r--r--main/src/cgeo/geocaching/export/FieldnoteExport.java4
-rw-r--r--main/src/cgeo/geocaching/export/GpxSerializer.java4
-rw-r--r--main/src/cgeo/geocaching/files/GPXImporter.java4
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java12
-rw-r--r--main/src/cgeo/geocaching/files/LocParser.java4
-rw-r--r--main/src/cgeo/geocaching/filter/AttributeFilter.java4
-rw-r--r--main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java4
-rw-r--r--main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java4
-rw-r--r--main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java6
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java24
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java4
-rw-r--r--main/src/cgeo/geocaching/sorting/FindsComparator.java4
-rw-r--r--main/src/cgeo/geocaching/twitter/Twitter.java6
-rw-r--r--main/src/cgeo/geocaching/ui/LoggingUI.java4
-rw-r--r--main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java10
-rw-r--r--tests/src/cgeo/CGeoTestCase.java6
-rw-r--r--tests/src/cgeo/geocaching/DataStoreTest.java (renamed from tests/src/cgeo/geocaching/cgDataTest.java)90
-rw-r--r--tests/src/cgeo/geocaching/StoredListTest.java6
-rw-r--r--tests/src/cgeo/geocaching/cgeoApplicationTest.java8
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java4
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java4
-rw-r--r--tests/src/cgeo/geocaching/export/ExportTest.java6
-rw-r--r--tests/src/cgeo/geocaching/files/GPXImporterTest.java26
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java8
-rw-r--r--tests/src/cgeo/geocaching/test/AbstractResourceInstrumentationTestCase.java12
50 files changed, 279 insertions, 279 deletions
diff --git a/main/src/cgeo/geocaching/AbstractPopupActivity.java b/main/src/cgeo/geocaching/AbstractPopupActivity.java
index 03f0680..da4888f 100644
--- a/main/src/cgeo/geocaching/AbstractPopupActivity.java
+++ b/main/src/cgeo/geocaching/AbstractPopupActivity.java
@@ -109,7 +109,7 @@ public abstract class AbstractPopupActivity extends AbstractActivity {
}
protected void init() {
- cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
if (cache == null) {
showToast(res.getString(R.string.err_detail_cache_find));
diff --git a/main/src/cgeo/geocaching/CacheCache.java b/main/src/cgeo/geocaching/CacheCache.java
index e70b7a0..b3c674c 100644
--- a/main/src/cgeo/geocaching/CacheCache.java
+++ b/main/src/cgeo/geocaching/CacheCache.java
@@ -1,6 +1,6 @@
package cgeo.geocaching;
-import cgeo.geocaching.cgData.StorageLocation;
+import cgeo.geocaching.DataStore.StorageLocation;
import cgeo.geocaching.connector.gc.Tile;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Viewport;
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index e04f7ed..0497a69 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -493,14 +493,14 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
case CONTEXT_MENU_WAYPOINT_DUPLICATE:
final Waypoint waypointDuplicate = cache.getWaypoint(index);
if (cache.duplicateWaypoint(waypointDuplicate)) {
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
notifyDataSetChanged();
}
break;
case CONTEXT_MENU_WAYPOINT_DELETE:
final Waypoint waypointDelete = cache.getWaypoint(index);
if (cache.deleteWaypoint(waypointDelete)) {
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
notifyDataSetChanged();
}
break;
@@ -1480,7 +1480,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
}
Settings.saveLastList(listId);
- cgData.moveToList(cache, listId);
+ DataStore.moveToList(cache, listId);
updateListBox();
}
@@ -1563,7 +1563,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
// update text
final TextView text = (TextView) view.findViewById(R.id.list_text);
- final StoredList list = cgData.getList(cache.getListId());
+ final StoredList list = DataStore.getList(cache.getListId());
if (list != null) {
text.setText(res.getString(R.string.cache_list_text) + " " + list.title);
} else {
@@ -2201,7 +2201,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
cache.setCoords(wpt.getCoords());
cache.setUserModifiedCoords(false);
cache.deleteWaypointForce(wpt);
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
handler.sendEmptyMessage(LOCAL);
}
@@ -2495,7 +2495,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
cache.parseWaypointsFromNote();
TextView personalNoteView = (TextView) activity.findViewById(R.id.personalnote);
setPersonalNote(personalNoteView, note);
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
activity.notifyDataSetChanged();
}
};
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/DataStore.java
index a2c9367..86946a0 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -52,9 +52,9 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Pattern;
-public class cgData {
+public class DataStore {
- private cgData() {
+ private DataStore() {
// utility class
}
@@ -297,7 +297,7 @@ public class cgData {
final DbHelper dbHelper = new DbHelper(new DBContext(cgeoapplication.getInstance()));
database = dbHelper.getWritableDatabase();
} catch (Exception e) {
- Log.e("cgData.init: unable to open database for R/W", e);
+ Log.e("DataStore.init: unable to open database for R/W", e);
}
}
@@ -757,7 +757,7 @@ public class cgData {
// to NPE traces.
final int staleHistorySearches = db.delete(dbTableSearchDestionationHistory, "date is null", null);
if (staleHistorySearches > 0) {
- Log.w(String.format(Locale.getDefault(), "cgData.dbHelper.onOpen: removed %d bad search history entries", staleHistorySearches));
+ Log.w(String.format(Locale.getDefault(), "DataStore.dbHelper.onOpen: removed %d bad search history entries", staleHistorySearches));
}
}
@@ -860,7 +860,7 @@ public class cgData {
return getFirstColumn(cursor);
} catch (final Exception e) {
- Log.e("cgData.allDetailedThere", e);
+ Log.e("DataStore.allDetailedThere", e);
return new String[0];
}
}
@@ -907,7 +907,7 @@ public class cgData {
cursor.close();
} catch (final Exception e) {
- Log.e("cgData.isThere", e);
+ Log.e("DataStore.isThere", e);
}
if (detailed && dataDetailed == 0) {
@@ -954,7 +954,7 @@ public class cgData {
} catch (SQLiteDoneException e) {
// Do nothing, it only means we have no information on the cache
} catch (Exception e) {
- Log.e("cgData.isOffline", e);
+ Log.e("DataStore.isOffline", e);
}
return false;
@@ -975,7 +975,7 @@ public class cgData {
} catch (SQLiteDoneException e) {
// Do nothing, it only means we have no information on the cache
} catch (Exception e) {
- Log.e("cgData.getGeocodeForGuid", e);
+ Log.e("DataStore.getGeocodeForGuid", e);
}
return null;
@@ -996,7 +996,7 @@ public class cgData {
} catch (SQLiteDoneException e) {
// Do nothing, it only means we have no information on the cache
} catch (Exception e) {
- Log.e("cgData.getCacheidForGeocode", e);
+ Log.e("DataStore.getCacheidForGeocode", e);
}
return null;
@@ -1497,7 +1497,7 @@ public class cgData {
}
if (remaining.size() >= 1) {
- Log.d("cgData.loadCaches(" + remaining.toString() + ") returned no results");
+ Log.d("DataStore.loadCaches(" + remaining.toString() + ") returned no results");
}
return result;
}
@@ -1528,7 +1528,7 @@ public class cgData {
}
query.append(" WHERE ").append(dbTableCaches).append('.');
- query.append(cgData.whereGeocodeIn(geocodes));
+ query.append(DataStore.whereGeocodeIn(geocodes));
Cursor cursor = database.rawQuery(query.toString(), null);
try {
@@ -1536,7 +1536,7 @@ public class cgData {
int logIndex = -1;
while (cursor.moveToNext()) {
- Geocache cache = cgData.createCacheFromDatabaseContent(cursor);
+ Geocache cache = DataStore.createCacheFromDatabaseContent(cursor);
if (loadFlags.contains(LoadFlag.LOAD_ATTRIBUTES)) {
cache.setAttributes(loadAttributes(cache.getGeocode()));
@@ -1717,7 +1717,7 @@ public class cgData {
null,
"1");
- Log.d("cgData.loadWaypoint(" + id + ")");
+ Log.d("DataStore.loadWaypoint(" + id + ")");
final Waypoint waypoint = cursor.moveToFirst() ? createWaypointFromDatabaseContent(cursor) : null;
@@ -2038,7 +2038,7 @@ public class cgData {
}
return (int) compiledStmnt.simpleQueryForLong();
} catch (Exception e) {
- Log.e("cgData.loadAllStoredCachesCount", e);
+ Log.e("DataStore.loadAllStoredCachesCount", e);
}
return 0;
@@ -2050,7 +2050,7 @@ public class cgData {
try {
return (int) PreparedStatements.getCountHistoryCaches().simpleQueryForLong();
} catch (Exception e) {
- Log.e("cgData.getAllHistoricCachesCount", e);
+ Log.e("DataStore.getAllHistoricCachesCount", e);
}
return 0;
@@ -2115,7 +2115,7 @@ public class cgData {
cursor.close();
} catch (final Exception e) {
- Log.e("cgData.loadBatchOfStoredGeocodes", e);
+ Log.e("DataStore.loadBatchOfStoredGeocodes", e);
}
return geocodes;
@@ -2152,7 +2152,7 @@ public class cgData {
}
cursor.close();
} catch (Exception e) {
- Log.e("cgData.loadBatchOfHistoricGeocodes", e);
+ Log.e("DataStore.loadBatchOfHistoricGeocodes", e);
}
return geocodes;
@@ -2222,7 +2222,7 @@ public class cgData {
cursor.close();
} catch (final Exception e) {
- Log.e("cgData.loadInViewport", e);
+ Log.e("DataStore.loadInViewport", e);
}
return new SearchResult(geocodes);
@@ -2286,7 +2286,7 @@ public class cgData {
removeCaches(geocodes, LoadFlags.REMOVE_ALL);
}
} catch (final Exception e) {
- Log.w("cgData.clean", e);
+ Log.w("DataStore.clean", e);
}
Log.d("Database clean: finished");
@@ -2357,11 +2357,11 @@ public class cgData {
public static boolean saveLogOffline(String geocode, Date date, LogType type, String log) {
if (StringUtils.isBlank(geocode)) {
- Log.e("cgData.saveLogOffline: cannot log a blank geocode");
+ Log.e("DataStore.saveLogOffline: cannot log a blank geocode");
return false;
}
if (LogType.UNKNOWN == type && StringUtils.isBlank(log)) {
- Log.e("cgData.saveLogOffline: cannot log an unknown log type and no message");
+ Log.e("DataStore.saveLogOffline: cannot log an unknown log type and no message");
return false;
}
@@ -2452,7 +2452,7 @@ public class cgData {
return logCount.simpleQueryForLong() > 0;
}
} catch (Exception e) {
- Log.e("cgData.hasLogOffline", e);
+ Log.e("DataStore.hasLogOffline", e);
}
return false;
@@ -2500,7 +2500,7 @@ public class cgData {
lists.addAll(storedLists);
cursor.close();
} catch (final Exception e) {
- Log.e("cgData.readLists", e);
+ Log.e("DataStore.readLists", e);
}
return lists;
}
@@ -2740,7 +2740,7 @@ public class cgData {
} catch (SQLiteDoneException e) {
// Do nothing, it only means we have no information on the cache
} catch (Exception e) {
- Log.e("cgData.getCacheDescription", e);
+ Log.e("DataStore.getCacheDescription", e);
}
return partial;
@@ -2850,7 +2850,7 @@ public class cgData {
}
public static boolean saveChangedCache(Geocache cache) {
- return cgData.saveCache(cache, cache.getStorageLocation().contains(StorageLocation.DATABASE) ? LoadFlags.SAVE_ALL : EnumSet.of(SaveFlag.SAVE_CACHE));
+ return DataStore.saveCache(cache, cache.getStorageLocation().contains(StorageLocation.DATABASE) ? LoadFlags.SAVE_ALL : EnumSet.of(SaveFlag.SAVE_CACHE));
}
private static class PreparedStatements {
@@ -2912,7 +2912,7 @@ public class cgData {
}
private static SQLiteStatement getLogCountOfGeocode() {
- return getStatement("LogCountFromGeocode", "SELECT count(_id) FROM " + cgData.dbTableLogsOffline + " WHERE geocode = ?");
+ return getStatement("LogCountFromGeocode", "SELECT count(_id) FROM " + DataStore.dbTableLogsOffline + " WHERE geocode = ?");
}
private static SQLiteStatement getCountCachesOnStandardList() {
@@ -2962,7 +2962,7 @@ public class cgData {
return null;
}
- return cgData.getBounds(Collections.singleton(geocode));
+ return DataStore.getBounds(Collections.singleton(geocode));
}
public static void clearVisitDate(String[] selected) {
@@ -2970,18 +2970,18 @@ public class cgData {
}
public static SearchResult getBatchOfStoredCaches(Geopoint coords, CacheType cacheType, int listId) {
- final Set<String> geocodes = cgData.loadBatchOfStoredGeocodes(coords, cacheType, listId);
- return new SearchResult(geocodes, cgData.getAllStoredCachesCount(cacheType, listId));
+ final Set<String> geocodes = DataStore.loadBatchOfStoredGeocodes(coords, cacheType, listId);
+ return new SearchResult(geocodes, DataStore.getAllStoredCachesCount(cacheType, listId));
}
public static SearchResult getHistoryOfCaches(boolean detailedOnly, CacheType cacheType) {
- final Set<String> geocodes = cgData.loadBatchOfHistoricGeocodes(detailedOnly, cacheType);
- return new SearchResult(geocodes, cgData.getAllHistoryCachesCount());
+ final Set<String> geocodes = DataStore.loadBatchOfHistoricGeocodes(detailedOnly, cacheType);
+ return new SearchResult(geocodes, DataStore.getAllHistoryCachesCount());
}
public static boolean saveWaypoint(int id, String geocode, Waypoint waypoint) {
- if (cgData.saveWaypointInternal(id, geocode, waypoint)) {
- cgData.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
+ if (DataStore.saveWaypointInternal(id, geocode, waypoint)) {
+ DataStore.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
return true;
}
return false;
diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java
index 59666e9..11d15da 100644
--- a/main/src/cgeo/geocaching/EditWaypointActivity.java
+++ b/main/src/cgeo/geocaching/EditWaypointActivity.java
@@ -107,7 +107,7 @@ public class EditWaypointActivity extends AbstractActivity {
note.setText(StringUtils.trimToEmpty(waypoint.getNote()));
}
}
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY);
setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache);
}
@@ -168,7 +168,7 @@ public class EditWaypointActivity extends AbstractActivity {
initializeWaypointTypeSelector();
if (geocode != null) {
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache);
}
}
@@ -259,7 +259,7 @@ public class EditWaypointActivity extends AbstractActivity {
@Override
public void run() {
try {
- waypoint = cgData.loadWaypoint(id);
+ waypoint = DataStore.loadWaypoint(id);
loadWaypointHandler.sendMessage(Message.obtain());
} catch (Exception e) {
@@ -278,7 +278,7 @@ public class EditWaypointActivity extends AbstractActivity {
} catch (Geopoint.ParseException e) {
// button text is blank when creating new waypoint
}
- Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
CoordinatesInputDialog coordsDialog = new CoordinatesInputDialog(EditWaypointActivity.this, cache, gp, app.currentGeo());
coordsDialog.setCancelable(true);
coordsDialog.setOnCoordinateUpdate(new CoordinatesInputDialog.CoordinateUpdate() {
@@ -416,14 +416,14 @@ public class EditWaypointActivity extends AbstractActivity {
waypoint.setVisited(visited);
waypoint.setId(id);
- Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
if (cache == null) {
finishHandler.sendEmptyMessage(SAVE_ERROR);
return null;
}
Waypoint oldWaypoint = cache.getWaypointById(id);
if (cache.addOrChangeWaypoint(waypoint, true)) {
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
if (!StaticMapsProvider.hasAllStaticMapsForWaypoint(geocode, waypoint)) {
StaticMapsProvider.removeWpStaticMaps(oldWaypoint, geocode);
if (Settings.isStoreOfflineWpMaps()) {
@@ -438,7 +438,7 @@ public class EditWaypointActivity extends AbstractActivity {
cache.setUserModifiedCoords(true);
}
cache.setCoords(waypoint.getCoords());
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
if (modifyBoth.isChecked() && waypoint.getCoords() != null) {
finishHandler.sendEmptyMessage(UPLOAD_START);
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index 7aceed4..94de3b4 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -1,6 +1,6 @@
package cgeo.geocaching;
-import cgeo.geocaching.cgData.StorageLocation;
+import cgeo.geocaching.DataStore.StorageLocation;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
@@ -112,20 +112,20 @@ public class Geocache implements ICache, IWaypoint {
private final List<String> attributes = new LazyInitializedList<String>() {
@Override
public List<String> call() {
- return cgData.loadAttributes(geocode);
+ return DataStore.loadAttributes(geocode);
}
};
private final List<Waypoint> waypoints = new LazyInitializedList<Waypoint>() {
@Override
public List<Waypoint> call() {
- return cgData.loadWaypoints(geocode);
+ return DataStore.loadWaypoints(geocode);
}
};
private List<Image> spoilers = null;
private final List<LogEntry> logs = new LazyInitializedList<LogEntry>() {
@Override
public List<LogEntry> call() {
- return cgData.loadLogs(geocode);
+ return DataStore.loadLogs(geocode);
}
};
private List<Trackable> inventory = null;
@@ -469,12 +469,12 @@ public class Geocache implements ICache, IWaypoint {
if (logType == LogType.UNKNOWN) {
return;
}
- final boolean status = cgData.saveLogOffline(geocode, date.getTime(), logType, log);
+ final boolean status = DataStore.saveLogOffline(geocode, date.getTime(), logType, log);
final Resources res = fromActivity.getResources();
if (status) {
ActivityMixin.showToast(fromActivity, res.getString(R.string.info_log_saved));
- cgData.saveVisitDate(geocode);
+ DataStore.saveVisitDate(geocode);
logOffline = Boolean.TRUE;
notifyChange();
@@ -484,7 +484,7 @@ public class Geocache implements ICache, IWaypoint {
}
public void clearOfflineLog() {
- cgData.clearLogOffline(geocode);
+ DataStore.clearLogOffline(geocode);
notifyChange();
}
@@ -664,7 +664,7 @@ public class Geocache implements ICache, IWaypoint {
*/
private void initializeCacheTexts() {
if (description == null || shortdesc == null || hint == null || location == null) {
- final Geocache partial = cgData.loadCacheTexts(this.getGeocode());
+ final Geocache partial = DataStore.loadCacheTexts(this.getGeocode());
if (description == null) {
setDescription(partial.getDescription());
}
@@ -1028,7 +1028,7 @@ public class Geocache implements ICache, IWaypoint {
}
}
}
- return saveToDatabase && cgData.saveWaypoints(this);
+ return saveToDatabase && DataStore.saveWaypoints(this);
}
/**
@@ -1244,7 +1244,7 @@ public class Geocache implements ICache, IWaypoint {
// when waypoint was edited, finalDefined may have changed
resetFinalDefined();
}
- return saveToDatabase && cgData.saveWaypoint(waypoint.getId(), geocode, waypoint);
+ return saveToDatabase && DataStore.saveWaypoint(waypoint.getId(), geocode, waypoint);
}
public boolean hasWaypoints() {
@@ -1297,7 +1297,7 @@ public class Geocache implements ICache, IWaypoint {
copy.setUserDefined();
copy.setName(cgeoapplication.getInstance().getString(R.string.waypoint_copy_of) + " " + copy.getName());
waypoints.add(index + 1, copy);
- return cgData.saveWaypoint(-1, geocode, copy);
+ return DataStore.saveWaypoint(-1, geocode, copy);
}
/**
@@ -1317,8 +1317,8 @@ public class Geocache implements ICache, IWaypoint {
if (waypoint.isUserDefined()) {
final int index = getWaypointIndex(waypoint);
waypoints.remove(index);
- cgData.deleteWaypoint(waypoint.getId());
- cgData.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
+ DataStore.deleteWaypoint(waypoint.getId());
+ DataStore.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
// Check status if Final is defined
if (waypoint.isFinalWithCoords()) {
resetFinalDefined();
@@ -1337,8 +1337,8 @@ public class Geocache implements ICache, IWaypoint {
public void deleteWaypointForce(Waypoint waypoint) {
final int index = getWaypointIndex(waypoint);
waypoints.remove(index);
- cgData.deleteWaypoint(waypoint.getId());
- cgData.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
+ DataStore.deleteWaypoint(waypoint.getId());
+ DataStore.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
resetFinalDefined();
}
@@ -1511,8 +1511,8 @@ public class Geocache implements ICache, IWaypoint {
public void drop(Handler handler) {
try {
- cgData.markDropped(Collections.singletonList(this));
- cgData.removeCache(getGeocode(), EnumSet.of(RemoveFlag.REMOVE_CACHE));
+ DataStore.markDropped(Collections.singletonList(this));
+ DataStore.removeCache(getGeocode(), EnumSet.of(RemoveFlag.REMOVE_CACHE));
handler.sendMessage(Message.obtain());
} catch (final Exception e) {
@@ -1563,7 +1563,7 @@ public class Geocache implements ICache, IWaypoint {
}
public void refresh(int newListId, CancellableHandler handler) {
- cgData.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
+ DataStore.removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
storeCache(null, geocode, newListId, true, handler);
}
@@ -1639,7 +1639,7 @@ public class Geocache implements ICache, IWaypoint {
}
cache.setListId(listId);
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
if (CancellableHandler.isCancelled(handler)) {
return;
@@ -1661,9 +1661,9 @@ public class Geocache implements ICache, IWaypoint {
return null;
}
- if (!forceReload && listId == StoredList.TEMPORARY_LIST_ID && (cgData.isOffline(geocode, guid) || cgData.isThere(geocode, guid, true, true))) {
+ if (!forceReload && listId == StoredList.TEMPORARY_LIST_ID && (DataStore.isOffline(geocode, guid) || DataStore.isThere(geocode, guid, true, true))) {
final SearchResult search = new SearchResult();
- final String realGeocode = StringUtils.isNotBlank(geocode) ? geocode : cgData.getGeocodeForGuid(guid);
+ final String realGeocode = StringUtils.isNotBlank(geocode) ? geocode : DataStore.getGeocodeForGuid(guid);
search.addGeocode(realGeocode);
return search;
}
@@ -1735,7 +1735,7 @@ public class Geocache implements ICache, IWaypoint {
* @return
*/
public boolean hasAttribute(CacheAttribute attribute, boolean yes) {
- Geocache fullCache = cgData.loadCache(getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES));
+ Geocache fullCache = DataStore.loadCache(getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES));
if (fullCache == null) {
fullCache = this;
}
diff --git a/main/src/cgeo/geocaching/ImagesActivity.java b/main/src/cgeo/geocaching/ImagesActivity.java
index 0b80d53..5eeb621 100644
--- a/main/src/cgeo/geocaching/ImagesActivity.java
+++ b/main/src/cgeo/geocaching/ImagesActivity.java
@@ -58,7 +58,7 @@ public class ImagesActivity extends AbstractActivity {
return;
}
- offline = cgData.isOffline(geocode, null) && (imgType == ImageType.SpoilerImages
+ offline = DataStore.isOffline(geocode, null) && (imgType == ImageType.SpoilerImages
|| Settings.isStoreLogImages());
}
diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java
index cb565bd..8c3ef44 100644
--- a/main/src/cgeo/geocaching/LogCacheActivity.java
+++ b/main/src/cgeo/geocaching/LogCacheActivity.java
@@ -234,13 +234,13 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
}
if ((StringUtils.isBlank(cacheid)) && StringUtils.isNotBlank(geocode)) {
- cacheid = cgData.getCacheidForGeocode(geocode);
+ cacheid = DataStore.getCacheidForGeocode(geocode);
}
if (StringUtils.isBlank(geocode) && StringUtils.isNotBlank(cacheid)) {
- geocode = cgData.getGeocodeForGuid(cacheid);
+ geocode = DataStore.getGeocodeForGuid(cacheid);
}
- cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
possibleLogTypes = cache.getPossibleLogTypes();
if (StringUtils.isNotBlank(cache.getName())) {
@@ -268,7 +268,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
imageUri = Uri.parse(savedInstanceState.getString(SAVED_STATE_IMAGE_URI));
} else {
// If log had been previously saved, load it now, otherwise initialize signature as needed
- final LogEntry log = cgData.loadLogOffline(geocode);
+ final LogEntry log = DataStore.loadLogOffline(geocode);
if (log != null) {
typeSelected = log.type;
date.setTime(new Date(log.date));
@@ -542,7 +542,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
cache.setVisitedDate(new Date().getTime());
}
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
cache.clearOfflineLog();
if (typeSelected == LogType.FOUND_IT) {
@@ -559,7 +559,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
final String uploadedImageUrl = imageResult.getImageUri();
if (StringUtils.isNotEmpty(uploadedImageUrl)) {
logNow.addLogImage(new Image(uploadedImageUrl, imageCaption, imageDescription));
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return imageResult.getPostResult();
}
diff --git a/main/src/cgeo/geocaching/LogTrackableActivity.java b/main/src/cgeo/geocaching/LogTrackableActivity.java
index a45d584..129ae2a 100644
--- a/main/src/cgeo/geocaching/LogTrackableActivity.java
+++ b/main/src/cgeo/geocaching/LogTrackableActivity.java
@@ -130,7 +130,7 @@ public class LogTrackableActivity extends AbstractLoggingActivity implements Dat
}
}
- trackable = cgData.loadTrackable(geocode);
+ trackable = DataStore.loadTrackable(geocode);
if (StringUtils.isNotBlank(trackable.getName())) {
setTitle(res.getString(R.string.trackable_touch) + ": " + trackable.getName());
diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java
index b6f267a..e4955b5 100644
--- a/main/src/cgeo/geocaching/MainActivity.java
+++ b/main/src/cgeo/geocaching/MainActivity.java
@@ -469,7 +469,7 @@ public class MainActivity extends AbstractActivity {
}
private void checkRestore() {
- if (!cgData.isNewlyCreatedDatebase() || null == DatabaseBackupUtils.getRestoreFile()) {
+ if (!DataStore.isNewlyCreatedDatebase() || null == DatabaseBackupUtils.getRestoreFile()) {
return;
}
new AlertDialog.Builder(this)
@@ -480,7 +480,7 @@ public class MainActivity extends AbstractActivity {
@Override
public void onClick(final DialogInterface dialog, final int id) {
dialog.dismiss();
- cgData.resetNewlyCreatedDatabase();
+ DataStore.resetNewlyCreatedDatabase();
DatabaseBackupUtils.restoreDatabase(MainActivity.this);
}
})
@@ -488,7 +488,7 @@ public class MainActivity extends AbstractActivity {
@Override
public void onClick(final DialogInterface dialog, final int id) {
dialog.cancel();
- cgData.resetNewlyCreatedDatabase();
+ DataStore.resetNewlyCreatedDatabase();
}
})
.create()
@@ -641,7 +641,7 @@ public class MainActivity extends AbstractActivity {
}
int checks = 0;
- while (!cgData.isInitialized()) {
+ while (!DataStore.isInitialized()) {
try {
wait(500);
checks++;
@@ -654,7 +654,7 @@ public class MainActivity extends AbstractActivity {
}
}
- countBubbleCnt = cgData.getAllCachesCount();
+ countBubbleCnt = DataStore.getAllCachesCount();
countBubbleHandler.sendEmptyMessage(0);
}
@@ -679,7 +679,7 @@ public class MainActivity extends AbstractActivity {
}
cleanupRunning = true;
- cgData.clean(more);
+ DataStore.clean(more);
cleanupRunning = false;
if (version > 0) {
diff --git a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
index 87d7ba7..fa81e73 100644
--- a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
+++ b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
@@ -214,7 +214,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
private List<Destination> getHistoryOfSearchedLocations() {
if (historyOfSearchedLocations == null) {
// Load from database
- historyOfSearchedLocations = cgData.loadHistoryOfSearchedLocations();
+ historyOfSearchedLocations = DataStore.loadHistoryOfSearchedLocations();
}
return historyOfSearchedLocations;
@@ -377,7 +377,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
getHistoryOfSearchedLocations().add(0, loc);
// Save location
- cgData.saveSearchedDestination(loc);
+ DataStore.saveSearchedDestination(loc);
// Ensure to remove the footer
historyListView.removeFooterView(getEmptyHistoryFooter());
@@ -396,7 +396,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
getHistoryOfSearchedLocations().remove(destination);
// Save
- cgData.removeSearchedDestination(destination);
+ DataStore.removeSearchedDestination(destination);
if (getHistoryOfSearchedLocations().isEmpty()) {
if (historyListView.getFooterViewsCount() == 0) {
@@ -415,7 +415,7 @@ public class NavigateAnyPointActivity extends AbstractActivity {
getHistoryOfSearchedLocations().clear();
// Save
- cgData.clearSearchedDestinations();
+ DataStore.clearSearchedDestinations();
if (historyListView.getFooterViewsCount() == 0) {
historyListView.addFooterView(getEmptyHistoryFooter());
diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java
index 8f58bcd..dc204d0 100644
--- a/main/src/cgeo/geocaching/SearchActivity.java
+++ b/main/src/cgeo/geocaching/SearchActivity.java
@@ -171,7 +171,7 @@ public class SearchActivity extends AbstractActivity {
findByGeocodeFn();
}
});
- addHistoryEntries(geocodeEdit, cgData.getRecentGeocodesForSearch());
+ addHistoryEntries(geocodeEdit, DataStore.getRecentGeocodesForSearch());
displayByGeocode.setOnClickListener(new FindByGeocodeListener());
EditUtils.setActionListener((EditText) findViewById(R.id.keyword), new Runnable() {
@@ -214,7 +214,7 @@ public class SearchActivity extends AbstractActivity {
findTrackableFn();
}
});
- addHistoryEntries(trackable, cgData.getTrackableCodes());
+ addHistoryEntries(trackable, DataStore.getTrackableCodes());
disableSuggestions(trackable);
displayTrackable.setOnClickListener(new FindTrackableListener());
}
diff --git a/main/src/cgeo/geocaching/SearchResult.java b/main/src/cgeo/geocaching/SearchResult.java
index e637d1f..add7ce2 100644
--- a/main/src/cgeo/geocaching/SearchResult.java
+++ b/main/src/cgeo/geocaching/SearchResult.java
@@ -199,7 +199,7 @@ public class SearchResult implements Parcelable {
SearchResult result = new SearchResult(this);
result.geocodes.clear();
final ArrayList<Geocache> cachesForVote = new ArrayList<Geocache>();
- final Set<Geocache> caches = cgData.loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB);
+ final Set<Geocache> caches = DataStore.loadCaches(geocodes, LoadFlags.LOAD_CACHE_OR_DB);
int excluded = 0;
for (Geocache cache : caches) {
// Is there any reason to exclude the cache from the list?
@@ -220,11 +220,11 @@ public class SearchResult implements Parcelable {
}
public Geocache getFirstCacheFromResult(final EnumSet<LoadFlag> loadFlags) {
- return CollectionUtils.isNotEmpty(geocodes) ? cgData.loadCache(geocodes.iterator().next(), loadFlags) : null;
+ return CollectionUtils.isNotEmpty(geocodes) ? DataStore.loadCache(geocodes.iterator().next(), loadFlags) : null;
}
public Set<Geocache> getCachesFromSearchResult(final EnumSet<LoadFlag> loadFlags) {
- return cgData.loadCaches(geocodes, loadFlags);
+ return DataStore.loadCaches(geocodes, loadFlags);
}
/** Add the geocode to the search. No cache is loaded into the CacheCache */
@@ -243,7 +243,7 @@ public class SearchResult implements Parcelable {
/** Add the cache geocode to the search and store the cache in the CacheCache */
public boolean addAndPutInCache(final Geocache cache) {
addGeocode(cache.getGeocode());
- return cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE));
+ return DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE));
}
public boolean isEmpty() {
@@ -252,7 +252,7 @@ public class SearchResult implements Parcelable {
public boolean hasUnsavedCaches() {
for (final String geocode : getGeocodes()) {
- if (!cgData.isOffline(geocode, null)) {
+ if (!DataStore.isOffline(geocode, null)) {
return true;
}
}
diff --git a/main/src/cgeo/geocaching/StaticMapsActivity.java b/main/src/cgeo/geocaching/StaticMapsActivity.java
index 2268df9..0f03b34 100644
--- a/main/src/cgeo/geocaching/StaticMapsActivity.java
+++ b/main/src/cgeo/geocaching/StaticMapsActivity.java
@@ -117,7 +117,7 @@ public class StaticMapsActivity extends AbstractActivity {
for (int level = 1; level <= StaticMapsProvider.MAPS_LEVEL_MAX; level++) {
try {
if (waypointId != null) {
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
final Bitmap image = StaticMapsProvider.getWaypointMap(geocode, cache.getWaypointById(waypointId), level);
if (image != null) {
maps.add(image);
@@ -151,7 +151,7 @@ public class StaticMapsActivity extends AbstractActivity {
}
private boolean downloadStaticMaps() {
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
if (waypointId == null) {
showToast(res.getString(R.string.info_storing_static_maps));
StaticMapsProvider.storeCacheStaticMap(cache, true);
diff --git a/main/src/cgeo/geocaching/StoredList.java b/main/src/cgeo/geocaching/StoredList.java
index 6f49625..1084a4b 100644
--- a/main/src/cgeo/geocaching/StoredList.java
+++ b/main/src/cgeo/geocaching/StoredList.java
@@ -80,7 +80,7 @@ public final class StoredList {
final List<StoredList> lists = getSortedLists();
if (exceptListId > StoredList.TEMPORARY_LIST_ID) {
- StoredList exceptList = cgData.getList(exceptListId);
+ StoredList exceptList = DataStore.getList(exceptListId);
if (exceptList != null) {
lists.remove(exceptList);
}
@@ -122,7 +122,7 @@ public final class StoredList {
@NonNull
private static List<StoredList> getSortedLists() {
final Collator collator = Collator.getInstance();
- final List<StoredList> lists = cgData.getLists();
+ final List<StoredList> lists = DataStore.getLists();
Collections.sort(lists, new Comparator<StoredList>() {
@Override
@@ -146,9 +146,9 @@ public final class StoredList {
@Override
public void run(final String listName) {
- final int newId = cgData.createList(listName);
+ final int newId = DataStore.createList(listName);
- if (newId >= cgData.customListIdOffset) {
+ if (newId >= DataStore.customListIdOffset) {
ActivityMixin.showToast(activity, res.getString(R.string.list_dialog_create_ok));
if (runAfterwards != null) {
runAfterwards.run(newId);
@@ -189,12 +189,12 @@ public final class StoredList {
}
public void promptForListRename(final int listId, final Runnable runAfterRename) {
- final StoredList list = cgData.getList(listId);
+ final StoredList list = DataStore.getList(listId);
handleListNameInput(list.title, R.string.list_dialog_rename_title, R.string.list_dialog_rename, new RunnableWithArgument<String>() {
@Override
public void run(final String listName) {
- cgData.renameList(listId, listName);
+ DataStore.renameList(listId, listName);
if (runAfterRename != null) {
runAfterRename.run();
}
diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java
index 20a9ccf..1ab428e 100644
--- a/main/src/cgeo/geocaching/TrackableActivity.java
+++ b/main/src/cgeo/geocaching/TrackableActivity.java
@@ -233,7 +233,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
@Override
public void run() {
if (StringUtils.isNotEmpty(geocode)) {
- trackable = cgData.loadTrackable(geocode);
+ trackable = DataStore.loadTrackable(geocode);
if (trackable == null || trackable.isLoggable()) {
// iterate over the connectors as some codes may be handled by multiple connectors
diff --git a/main/src/cgeo/geocaching/WaypointPopup.java b/main/src/cgeo/geocaching/WaypointPopup.java
index a1ab36a..c33bbb5 100644
--- a/main/src/cgeo/geocaching/WaypointPopup.java
+++ b/main/src/cgeo/geocaching/WaypointPopup.java
@@ -56,7 +56,7 @@ public class WaypointPopup extends AbstractPopupActivity {
@Override
protected void init() {
super.init();
- waypoint = cgData.loadWaypoint(waypointId);
+ waypoint = DataStore.loadWaypoint(waypointId);
try {
if (StringUtils.isNotBlank(waypoint.getName())) {
setTitle(waypoint.getName());
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
index d898d7e..d5c9435 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
@@ -6,7 +6,7 @@ import cgeo.geocaching.R;
import cgeo.geocaching.StaticMapsActivity;
import cgeo.geocaching.StaticMapsProvider;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.apps.AbstractApp;
@@ -34,7 +34,7 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat
return false;
}
String geocode = waypoint.getGeocode();
- if (StringUtils.isNotEmpty(geocode) && cgData.isOffline(geocode, null)) {
+ if (StringUtils.isNotEmpty(geocode) && DataStore.isOffline(geocode, null)) {
return StaticMapsProvider.hasStaticMapForWaypoint(geocode, waypoint);
}
return false;
diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java
index 5a793f5..403f597 100644
--- a/main/src/cgeo/geocaching/cgeoapplication.java
+++ b/main/src/cgeo/geocaching/cgeoapplication.java
@@ -46,15 +46,15 @@ public class cgeoapplication extends Application {
@Override
public void onLowMemory() {
Log.i("Cleaning applications cache.");
- cgData.removeAllFromCache();
+ DataStore.removeAllFromCache();
}
@Override
public void onTerminate() {
Log.d("Terminating c:geo…");
- cgData.clean();
- cgData.closeDb();
+ DataStore.clean();
+ DataStore.closeDb();
super.onTerminate();
}
@@ -82,7 +82,7 @@ public class cgeoapplication extends Application {
@Override
public void run() {
- atomic.set(cgData.moveDatabase());
+ atomic.set(DataStore.moveDatabase());
handler.sendMessage(handler.obtainMessage());
}
};
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 423e9c6..2c791a4 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -469,7 +469,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
private boolean isConcreteList() {
return type == CacheListType.OFFLINE &&
- (listId == StoredList.STANDARD_LIST_ID || listId >= cgData.customListIdOffset);
+ (listId == StoredList.STANDARD_LIST_ID || listId >= DataStore.customListIdOffset);
}
private boolean isInvokedFromAttachment() {
@@ -503,7 +503,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
// refresh standard list if it has changed (new caches downloaded)
if (type == CacheListType.OFFLINE && listId >= StoredList.STANDARD_LIST_ID && search != null) {
- final SearchResult newSearch = cgData.getBatchOfStoredCaches(coords, Settings.getCacheType(), listId);
+ final SearchResult newSearch = DataStore.getBatchOfStoredCaches(coords, Settings.getCacheType(), listId);
if (newSearch.getTotal() != search.getTotal()) {
refreshCurrentList();
}
@@ -643,7 +643,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
item.setVisible(isNonDefaultList);
}
- final boolean multipleLists = cgData.getLists().size() >= 2;
+ final boolean multipleLists = DataStore.getLists().size() >= 2;
item = menu.findItem(MENU_SWITCH_LIST);
if (item != null) {
item.setVisible(multipleLists);
@@ -866,7 +866,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
@Override
public void run(Integer newListId) {
- cgData.moveToList(adapter.getCheckedOrAllCaches(), newListId);
+ DataStore.moveToList(adapter.getCheckedOrAllCaches(), newListId);
adapter.setSelectMode(false);
refreshCurrentList();
@@ -924,7 +924,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
@Override
public void run(Integer newListId) {
- cgData.moveToList(Collections.singletonList(cache), newListId);
+ DataStore.moveToList(Collections.singletonList(cache), newListId);
adapter.setSelectMode(false);
refreshCurrentList();
}
@@ -1385,7 +1385,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
@Override
protected Void doInBackgroundInternal(Geocache[] caches) {
removeGeoAndDir();
- cgData.markDropped(Arrays.asList(caches));
+ DataStore.markDropped(Arrays.asList(caches));
startGeoAndDir();
return null;
}
@@ -1416,7 +1416,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
@Override
public void run() {
- cgData.clearLogsOffline(selected);
+ DataStore.clearLogsOffline(selected);
handler.sendEmptyMessage(MSG_DONE);
}
}
@@ -1468,7 +1468,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
return;
}
- final StoredList list = cgData.getList(id);
+ final StoredList list = DataStore.getList(id);
if (list == null) {
return;
}
@@ -1480,7 +1480,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
showProgress(true);
showFooterLoadingCaches();
- cgData.moveToList(adapter.getCheckedCaches(), listId);
+ DataStore.moveToList(adapter.getCheckedCaches(), listId);
currentLoader = (OfflineGeocacheListLoader) getSupportLoaderManager().initLoader(CacheListType.OFFLINE.ordinal(), new Bundle(), this);
currentLoader.reset();
@@ -1503,7 +1503,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
}
private void removeListInternal() {
- if (cgData.removeList(listId)) {
+ if (DataStore.removeList(listId)) {
showToast(res.getString(R.string.list_dialog_remove_ok));
switchListById(StoredList.STANDARD_LIST_ID);
} else {
@@ -1701,7 +1701,7 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
listId = StoredList.STANDARD_LIST_ID;
title = res.getString(R.string.stored_caches_button);
} else {
- final StoredList list = cgData.getList(listId);
+ final StoredList list = DataStore.getList(listId);
// list.id may be different if listId was not valid
listId = list.id;
title = list.title;
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
index 9ac9c9d..066e656 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
@@ -1,11 +1,11 @@
package cgeo.geocaching.connector.gc;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.ICache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.connector.AbstractConnector;
import cgeo.geocaching.connector.ILoggingManager;
@@ -137,10 +137,10 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
if (StringUtils.isEmpty(page)) {
final SearchResult search = new SearchResult();
- if (cgData.isThere(geocode, guid, true, false)) {
+ if (DataStore.isThere(geocode, guid, true, false)) {
if (StringUtils.isBlank(geocode) && StringUtils.isNotBlank(guid)) {
Log.i("Loading old cache from cache.");
- search.addGeocode(cgData.getGeocodeForGuid(guid));
+ search.addGeocode(DataStore.getGeocodeForGuid(guid));
} else {
search.addGeocode(geocode);
}
@@ -189,7 +189,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public boolean addToWatchlist(Geocache cache) {
final boolean added = GCParser.addToWatchlist(cache);
if (added) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return added;
}
@@ -198,7 +198,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public boolean removeFromWatchlist(Geocache cache) {
final boolean removed = GCParser.removeFromWatchlist(cache);
if (removed) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return removed;
}
@@ -215,7 +215,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public static boolean addToFavorites(Geocache cache) {
final boolean added = GCParser.addToFavorites(cache);
if (added) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return added;
}
@@ -232,7 +232,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public static boolean removeFromFavorites(Geocache cache) {
final boolean removed = GCParser.removeFromFavorites(cache);
if (removed) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return removed;
}
@@ -241,7 +241,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) {
final boolean uploaded = GCParser.uploadModifiedCoordinates(cache, wpt);
if (uploaded) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return uploaded;
}
@@ -250,7 +250,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public boolean deleteModifiedCoordinates(Geocache cache) {
final boolean deleted = GCParser.deleteModifiedCoordinates(cache);
if (deleted) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return deleted;
}
@@ -259,7 +259,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
public boolean uploadPersonalNote(Geocache cache) {
final boolean uploaded = GCParser.uploadPersonalNote(cache);
if (uploaded) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return uploaded;
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java
index 27d8a77..e3259c0 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCMap.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.connector.gc;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
@@ -361,7 +361,7 @@ public class GCMap {
// Check for vanished found caches
if (tiles.iterator().next().getZoomLevel() >= Tile.ZOOMLEVEL_MIN_PERSONALIZED) {
- searchResult.addFilteredGeocodes(cgData.getCachedMissingFromSearch(searchResult, tiles, GCConnector.getInstance(), Tile.ZOOMLEVEL_MIN_PERSONALIZED - 1));
+ searchResult.addFilteredGeocodes(DataStore.getCachedMissingFromSearch(searchResult, tiles, GCConnector.getInstance(), Tile.ZOOMLEVEL_MIN_PERSONALIZED - 1));
}
}
@@ -372,7 +372,7 @@ public class GCMap {
SearchResult search = GCParser.searchByCoords(center, Settings.getCacheType(), false, null);
if (search != null && !search.isEmpty()) {
final Set<String> geocodes = search.getGeocodes();
- lastSearchViewport = cgData.getBounds(geocodes);
+ lastSearchViewport = DataStore.getBounds(geocodes);
searchResult.addGeocodes(geocodes);
}
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index 7eacb8e..f25fa1f 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.connector.gc;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.Image;
import cgeo.geocaching.LogEntry;
@@ -8,7 +9,6 @@ import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Trackable;
import cgeo.geocaching.TrackableLog;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
@@ -357,7 +357,7 @@ public abstract class GCParser {
// save full detailed caches
CancellableHandler.sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_cache);
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
// update progress message so user knows we're still working. This is more of a place holder than
// actual indication of what the program is doing
@@ -1094,7 +1094,7 @@ public abstract class GCParser {
Log.i("Log successfully posted to cache #" + cacheid);
if (geocode != null) {
- cgData.saveVisitDate(geocode);
+ DataStore.saveVisitDate(geocode);
}
Login.getLoginStatus(page);
@@ -1539,7 +1539,7 @@ public abstract class GCParser {
}
if (cgeoapplication.getInstance() != null) {
- cgData.saveTrackable(trackable);
+ DataStore.saveTrackable(trackable);
}
return trackable;
diff --git a/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java b/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java
index 663bbf7..89327f1 100644
--- a/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java
+++ b/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.connector.oc;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogCacheActivity;
import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.connector.ILoggingManager;
import cgeo.geocaching.connector.capability.ILogin;
@@ -87,7 +87,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente
final boolean added = OkapiClient.setWatchState(cache, true, this);
if (added) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return added;
@@ -98,7 +98,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente
final boolean removed = OkapiClient.setWatchState(cache, false, this);
if (removed) {
- cgData.saveChangedCache(cache);
+ DataStore.saveChangedCache(cache);
}
return removed;
diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
index 189b6a4..61fde59 100644
--- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
+++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
@@ -1,11 +1,11 @@
package cgeo.geocaching.connector.oc;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.Image;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
@@ -265,7 +265,7 @@ final class OkapiClient {
parseCoreCache(response, cache);
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE));
} catch (final JSONException e) {
Log.e("OkapiClient.parseSmallCache", e);
}
@@ -340,7 +340,7 @@ final class OkapiClient {
cache.setDetailedUpdatedNow();
// save full detailed caches
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
} catch (final JSONException e) {
Log.e("OkapiClient.parseCache", e);
}
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java
index d0040a9..16c8780 100644
--- a/main/src/cgeo/geocaching/export/FieldnoteExport.java
+++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java
@@ -3,7 +3,7 @@ package cgeo.geocaching.export;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.connector.gc.Login;
import cgeo.geocaching.enumerations.StatusCode;
@@ -134,7 +134,7 @@ class FieldnoteExport extends AbstractExport {
int i = 0;
for (final Geocache cache : caches) {
if (cache.isLogOffline()) {
- final LogEntry log = cgData.loadLogOffline(cache.getGeocode());
+ final LogEntry log = DataStore.loadLogOffline(cache.getGeocode());
if (!onlyNew || log.date > Settings.getFieldnoteExportDate()) {
appendFieldNote(fieldNoteBuffer, cache, log);
}
diff --git a/main/src/cgeo/geocaching/export/GpxSerializer.java b/main/src/cgeo/geocaching/export/GpxSerializer.java
index 1e39be4..e4051b5 100644
--- a/main/src/cgeo/geocaching/export/GpxSerializer.java
+++ b/main/src/cgeo/geocaching/export/GpxSerializer.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.export;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheAttribute;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.geopoint.Geopoint;
@@ -81,7 +81,7 @@ public final class GpxSerializer {
}
private void exportBatch(final XmlSerializer gpx, Collection<String> geocodesOfBatch) throws IOException {
- final Set<Geocache> caches = cgData.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY);
+ final Set<Geocache> caches = DataStore.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY);
for (final Geocache cache : caches) {
gpx.startTag(PREFIX_GPX, "wpt");
gpx.attribute("", "lat", Double.toString(cache.getCoords().getLatitude()));
diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java
index 3f11c26..bf0aa72 100644
--- a/main/src/cgeo/geocaching/files/GPXImporter.java
+++ b/main/src/cgeo/geocaching/files/GPXImporter.java
@@ -4,7 +4,7 @@ import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.StaticMapsProvider;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.enumerations.LoadFlags;
@@ -175,7 +175,7 @@ public class GPXImporter {
private boolean importStaticMaps(final SearchResult importedCaches) {
int storedCacheMaps = 0;
for (final String geocode : importedCaches.getGeocodes()) {
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
if (cache != null) {
Log.d("GPXImporter.ImportThread.importStaticMaps start downloadMaps for cache " + geocode);
StaticMapsProvider.downloadMaps(cache);
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 3358759..431a529 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -1,12 +1,12 @@
package cgeo.geocaching.files;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
import cgeo.geocaching.StoredList;
import cgeo.geocaching.Trackable;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.enumerations.CacheSize;
@@ -312,10 +312,10 @@ public abstract class GPXParser extends FileParser {
// finally store the cache in the database
result.add(geocode);
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
// avoid the cachecache using lots of memory for caches which the user did not actually look at
- cgData.removeAllFromCache();
+ DataStore.removeAllFromCache();
showProgressMessage(progressHandler, progressStream.getProgress());
} else if (StringUtils.isNotBlank(cache.getName())
&& StringUtils.containsIgnoreCase(type, "waypoint")) {
@@ -331,7 +331,7 @@ public abstract class GPXParser extends FileParser {
if (cache.getName().length() > 2) {
final String cacheGeocodeForWaypoint = "GC" + cache.getName().substring(2).toUpperCase(Locale.US);
// lookup cache for waypoint in already parsed caches
- final Geocache cacheForWaypoint = cgData.loadCache(cacheGeocodeForWaypoint, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cacheForWaypoint = DataStore.loadCache(cacheGeocodeForWaypoint, LoadFlags.LOAD_CACHE_OR_DB);
if (cacheForWaypoint != null) {
final Waypoint waypoint = new Waypoint(cache.getShortDescription(), convertWaypointSym2Type(sym), false);
waypoint.setId(-1);
@@ -349,7 +349,7 @@ public abstract class GPXParser extends FileParser {
newPoints.add(waypoint);
Waypoint.mergeWayPoints(newPoints, mergedWayPoints, true);
cacheForWaypoint.setWaypoints(newPoints, false);
- cgData.saveCache(cacheForWaypoint, EnumSet.of(SaveFlag.SAVE_DB));
+ DataStore.saveCache(cacheForWaypoint, EnumSet.of(SaveFlag.SAVE_DB));
showProgressMessage(progressHandler, progressStream.getProgress());
}
}
@@ -785,7 +785,7 @@ public abstract class GPXParser extends FileParser {
try {
progressStream = new ProgressInputStream(stream);
Xml.parse(progressStream, Xml.Encoding.UTF_8, root.getContentHandler());
- return cgData.loadCaches(result, EnumSet.of(LoadFlag.LOAD_DB_MINIMAL));
+ return DataStore.loadCaches(result, EnumSet.of(LoadFlag.LOAD_DB_MINIMAL));
} catch (final SAXException e) {
Log.w("Cannot parse .gpx file as GPX " + version + ": could not parse XML - ", e);
throw new ParserException("Cannot parse .gpx file as GPX " + version + ": could not parse XML", e);
diff --git a/main/src/cgeo/geocaching/files/LocParser.java b/main/src/cgeo/geocaching/files/LocParser.java
index 1cfb2a3..3d01c1b 100644
--- a/main/src/cgeo/geocaching/files/LocParser.java
+++ b/main/src/cgeo/geocaching/files/LocParser.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.files;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
@@ -59,7 +59,7 @@ public final class LocParser extends FileParser {
contained.add(geocode);
}
}
- Set<Geocache> caches = cgData.loadCaches(contained, LoadFlags.LOAD_CACHE_OR_DB);
+ Set<Geocache> caches = DataStore.loadCaches(contained, LoadFlags.LOAD_CACHE_OR_DB);
for (Geocache cache : caches) {
Geocache coord = cidCoords.get(cache.getGeocode());
copyCoordToCache(coord, cache);
diff --git a/main/src/cgeo/geocaching/filter/AttributeFilter.java b/main/src/cgeo/geocaching/filter/AttributeFilter.java
index cadcf49..0b4279f 100644
--- a/main/src/cgeo/geocaching/filter/AttributeFilter.java
+++ b/main/src/cgeo/geocaching/filter/AttributeFilter.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.filter;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.LoadFlags.LoadFlag;
@@ -29,7 +29,7 @@ class AttributeFilter extends AbstractFilter {
@Override
public boolean accepts(final Geocache cache) {
- Geocache fullCache = cgData.loadCache(cache.getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES));
+ Geocache fullCache = DataStore.loadCache(cache.getGeocode(), EnumSet.of(LoadFlag.LOAD_ATTRIBUTES));
if (fullCache == null) {
fullCache = cache;
}
diff --git a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java
index 722f9f5..605f461 100644
--- a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java
+++ b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.loaders;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.settings.Settings;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
@@ -18,7 +18,7 @@ public class HistoryGeocacheListLoader extends AbstractSearchLoader {
@Override
public SearchResult runSearch() {
- return cgData.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL);
+ return DataStore.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL);
}
}
diff --git a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
index ab8ba6a..5088484 100644
--- a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
+++ b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.loaders;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.settings.Settings;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.geopoint.Geopoint;
import android.content.Context;
@@ -20,7 +20,7 @@ public class OfflineGeocacheListLoader extends AbstractSearchLoader {
@Override
public SearchResult runSearch() {
- return cgData.getBatchOfStoredCaches(searchCenter, Settings.getCacheType(), listId);
+ return DataStore.getBatchOfStoredCaches(searchCenter, Settings.getCacheType(), listId);
}
public void setListId(int listId) {
diff --git a/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java b/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java
index 2229afe..8ca0fa5 100644
--- a/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java
+++ b/main/src/cgeo/geocaching/loaders/RemoveFromHistoryLoader.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.loaders;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.settings.Settings;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
@@ -21,8 +21,8 @@ public class RemoveFromHistoryLoader extends AbstractSearchLoader {
@Override
public SearchResult runSearch() {
- cgData.clearVisitDate(selected);
- return cgData.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL);
+ DataStore.clearVisitDate(selected);
+ return DataStore.getHistoryOfCaches(true, coords != null ? Settings.getCacheType() : CacheType.ALL);
}
}
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 0703dd8..2677b33 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -7,7 +7,7 @@ import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.StoredList;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.cgeocaches;
import cgeo.geocaching.activity.ActivityMixin;
@@ -361,7 +361,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
activity = this.getActivity();
app = (cgeoapplication) activity.getApplication();
- int countBubbleCnt = cgData.getAllCachesCount();
+ int countBubbleCnt = DataStore.getAllCachesCount();
caches = new LeastRecentlyUsedSet<Geocache>(MAX_CACHES + countBubbleCnt);
final MapProvider mapProvider = Settings.getMapProvider();
@@ -491,7 +491,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (!CollectionUtils.isEmpty(dirtyCaches)) {
for (String geocode : dirtyCaches) {
- Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
if (cache != null) {
// new collection type needs to remove first
caches.remove(cache);
@@ -641,7 +641,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final List<String> geocodes = new ArrayList<String>();
for (final String geocode : geocodesInViewport) {
- if (!cgData.isOffline(geocode, null)) {
+ if (!DataStore.isOffline(geocode, null)) {
geocodes.add(geocode);
}
}
@@ -1090,7 +1090,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
SearchResult searchResult;
if (mapMode == MapMode.LIVE) {
- searchResult = isLiveEnabled ? new SearchResult() : new SearchResult(cgData.loadStoredInViewport(viewport, Settings.getCacheType()));
+ searchResult = isLiveEnabled ? new SearchResult() : new SearchResult(DataStore.loadStoredInViewport(viewport, Settings.getCacheType()));
} else {
// map started from another activity
searchResult = searchIntent != null ? new SearchResult(searchIntent) : new SearchResult();
@@ -1100,7 +1100,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
// live mode search result
if (isLiveEnabled) {
- searchResult.addSearchResult(cgData.loadCachedInViewport(viewport, Settings.getCacheType()));
+ searchResult.addSearchResult(DataStore.loadCachedInViewport(viewport, Settings.getCacheType()));
}
downloaded = true;
@@ -1123,7 +1123,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
|| mapMode == MapMode.COORDS) {
//All visible waypoints
CacheType type = Settings.getCacheType();
- Set<Waypoint> waypointsInViewport = cgData.loadWaypoints(viewport, excludeMine, excludeDisabled, type);
+ Set<Waypoint> waypointsInViewport = DataStore.loadWaypoints(viewport, excludeMine, excludeDisabled, type);
waypoints.addAll(waypointsInViewport);
}
else {
@@ -1196,8 +1196,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// first remove filtered out
final Set<String> filteredCodes = searchResult.getFilteredGeocodes();
Log.d("Filtering out " + filteredCodes.size() + " caches: " + filteredCodes.toString());
- caches.removeAll(cgData.loadCaches(filteredCodes, LoadFlags.LOAD_CACHE_ONLY));
- cgData.removeCaches(filteredCodes, EnumSet.of(RemoveFlag.REMOVE_CACHE));
+ caches.removeAll(DataStore.loadCaches(filteredCodes, LoadFlags.LOAD_CACHE_ONLY));
+ DataStore.removeCaches(filteredCodes, EnumSet.of(RemoveFlag.REMOVE_CACHE));
// new collection type needs to remove first to refresh
caches.removeAll(result);
caches.addAll(result);
@@ -1409,7 +1409,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
break;
}
- if (!cgData.isOffline(geocode, null)) {
+ if (!DataStore.isOffline(geocode, null)) {
if ((System.currentTimeMillis() - last) < 1500) {
try {
int delay = 1000 + (int) (Math.random() * 1000.0) - (int) (System.currentTimeMillis() - last);
@@ -1512,9 +1512,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
Viewport viewport = null;
if (geocodeCenter != null) {
- viewport = cgData.getBounds(geocodeCenter);
+ viewport = DataStore.getBounds(geocodeCenter);
} else if (searchCenter != null) {
- viewport = cgData.getBounds(searchCenter.getGeocodes());
+ viewport = DataStore.getBounds(searchCenter.getGeocodes());
}
if (viewport == null) {
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index 8fbb3db..cd2ff75 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -5,7 +5,7 @@ import cgeo.geocaching.Geocache;
import cgeo.geocaching.IWaypoint;
import cgeo.geocaching.R;
import cgeo.geocaching.WaypointPopup;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.connector.gc.GCMap;
import cgeo.geocaching.enumerations.CacheType;
@@ -228,7 +228,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
final IWaypoint coordinate = item.getCoord();
if (StringUtils.isNotBlank(coordinate.getCoordType()) && coordinate.getCoordType().equalsIgnoreCase("cache") && StringUtils.isNotBlank(coordinate.getGeocode())) {
- Geocache cache = cgData.loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
+ Geocache cache = DataStore.loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
RequestDetailsThread requestDetailsThread = new RequestDetailsThread(cache);
if (!requestDetailsThread.requestRequired()) {
// don't show popup if we have enough details
diff --git a/main/src/cgeo/geocaching/sorting/FindsComparator.java b/main/src/cgeo/geocaching/sorting/FindsComparator.java
index ba929b8..b147fad 100644
--- a/main/src/cgeo/geocaching/sorting/FindsComparator.java
+++ b/main/src/cgeo/geocaching/sorting/FindsComparator.java
@@ -1,7 +1,7 @@
package cgeo.geocaching.sorting;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.LogType;
public class FindsComparator extends AbstractCacheComparator {
@@ -20,7 +20,7 @@ public class FindsComparator extends AbstractCacheComparator {
private static int getFindsCount(Geocache cache) {
if (cache.getLogCounts().isEmpty()) {
- cache.setLogCounts(cgData.loadLogCounts(cache.getGeocode()));
+ cache.setLogCounts(DataStore.loadLogCounts(cache.getGeocode()));
}
Integer logged = cache.getLogCounts().get(LogType.FOUND_IT);
if (logged != null) {
diff --git a/main/src/cgeo/geocaching/twitter/Twitter.java b/main/src/cgeo/geocaching/twitter/Twitter.java
index 7233764..b339e28 100644
--- a/main/src/cgeo/geocaching/twitter/Twitter.java
+++ b/main/src/cgeo/geocaching/twitter/Twitter.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.twitter;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.Trackable;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.geopoint.Geopoint;
@@ -22,12 +22,12 @@ public final class Twitter {
private static final int MAX_TWEET_SIZE = 140;
public static void postTweetCache(String geocode) {
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
postTweet(cgeoapplication.getInstance(), getStatusMessage(cache), null);
}
public static void postTweetTrackable(String geocode) {
- final Trackable trackable = cgData.loadTrackable(geocode);
+ final Trackable trackable = DataStore.loadTrackable(geocode);
postTweet(cgeoapplication.getInstance(), getStatusMessage(trackable), null);
}
diff --git a/main/src/cgeo/geocaching/ui/LoggingUI.java b/main/src/cgeo/geocaching/ui/LoggingUI.java
index c2e2d24..1423da2 100644
--- a/main/src/cgeo/geocaching/ui/LoggingUI.java
+++ b/main/src/cgeo/geocaching/ui/LoggingUI.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.ui;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.settings.Settings;
@@ -74,7 +74,7 @@ public class LoggingUI extends AbstractUIFactory {
}
private static void showOfflineMenu(final Geocache cache, final Activity activity) {
- final LogEntry currentLog = cgData.loadLogOffline(cache.getGeocode());
+ final LogEntry currentLog = DataStore.loadLogOffline(cache.getGeocode());
final LogType currentLogType = currentLog == null ? null : currentLog.type;
final List<LogType> logTypes = cache.getPossibleLogTypes();
diff --git a/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java b/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java
index 8aa605f..5c8d641 100644
--- a/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java
+++ b/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.utils;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.MainActivity;
import cgeo.geocaching.R;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.ui.Formatter;
@@ -50,7 +50,7 @@ public class DatabaseBackupUtils {
@Override
public void run() {
- restoreSuccessful.set(cgData.restoreDatabaseInternal());
+ restoreSuccessful.set(DataStore.restoreDatabaseInternal());
handler.sendMessage(handler.obtainMessage());
}
};
@@ -61,7 +61,7 @@ public class DatabaseBackupUtils {
final Context context = activity;
// avoid overwriting an existing backup with an empty database
// (can happen directly after reinstalling the app)
- if (cgData.getAllCachesCount() == 0) {
+ if (DataStore.getAllCachesCount() == 0) {
ActivityMixin.helpDialog(activity,
context.getString(R.string.init_backup),
context.getString(R.string.init_backup_unnecessary));
@@ -74,7 +74,7 @@ public class DatabaseBackupUtils {
new Thread() {
@Override
public void run() {
- final String backupFileName = cgData.backupDatabaseInternal();
+ final String backupFileName = DataStore.backupDatabaseInternal();
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -96,7 +96,7 @@ public class DatabaseBackupUtils {
}
public static File getRestoreFile() {
- final File fileSourceFile = cgData.getBackupFileInternal();
+ final File fileSourceFile = DataStore.getBackupFileInternal();
return fileSourceFile.exists() && fileSourceFile.length() > 0 ? fileSourceFile : null;
}
diff --git a/tests/src/cgeo/CGeoTestCase.java b/tests/src/cgeo/CGeoTestCase.java
index b741e95..fa2c7b5 100644
--- a/tests/src/cgeo/CGeoTestCase.java
+++ b/tests/src/cgeo/CGeoTestCase.java
@@ -1,6 +1,6 @@
package cgeo;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.enumerations.LoadFlags.RemoveFlag;
@@ -29,7 +29,7 @@ public abstract class CGeoTestCase extends ApplicationTestCase<cgeoapplication>
/** Remove cache from DB and cache to ensure that the cache is not loaded from the database */
protected static void deleteCacheFromDB(String geocode) {
- cgData.removeCache(geocode, LoadFlags.REMOVE_ALL);
+ DataStore.removeCache(geocode, LoadFlags.REMOVE_ALL);
}
/**
@@ -40,7 +40,7 @@ public abstract class CGeoTestCase extends ApplicationTestCase<cgeoapplication>
protected static void removeCacheCompletely(final String geocode) {
final EnumSet<RemoveFlag> flags = EnumSet.copyOf(LoadFlags.REMOVE_ALL);
flags.add(RemoveFlag.REMOVE_OWN_WAYPOINTS_ONLY_FOR_TESTING);
- cgData.removeCache(geocode, flags);
+ DataStore.removeCache(geocode, flags);
}
/**
diff --git a/tests/src/cgeo/geocaching/cgDataTest.java b/tests/src/cgeo/geocaching/DataStoreTest.java
index cacf061..3f0214b 100644
--- a/tests/src/cgeo/geocaching/cgDataTest.java
+++ b/tests/src/cgeo/geocaching/DataStoreTest.java
@@ -18,7 +18,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-public class cgDataTest extends CGeoTestCase {
+public class DataStoreTest extends CGeoTestCase {
public static void testStoredLists() {
@@ -35,11 +35,11 @@ public class cgDataTest extends CGeoTestCase {
try {
// create lists
- listId1 = cgData.createList("cgData Test");
+ listId1 = DataStore.createList("DataStore Test");
assertTrue(listId1 > StoredList.STANDARD_LIST_ID);
- listId2 = cgData.createList("cgDataTest");
+ listId2 = DataStore.createList("DataStoreTest");
assertTrue(listId2 > StoredList.STANDARD_LIST_ID);
- assertTrue(cgData.getLists().size() >= 2);
+ assertTrue(DataStore.getLists().size() >= 2);
cache1.setDetailed(true);
cache1.setListId(listId1);
@@ -47,33 +47,33 @@ public class cgDataTest extends CGeoTestCase {
cache2.setListId(listId1);
// save caches to DB (cache1=listId1, cache2=listId1)
- cgData.saveCache(cache1, LoadFlags.SAVE_ALL);
- cgData.saveCache(cache2, LoadFlags.SAVE_ALL);
- assertTrue(cgData.getAllCachesCount() >= 2);
+ DataStore.saveCache(cache1, LoadFlags.SAVE_ALL);
+ DataStore.saveCache(cache2, LoadFlags.SAVE_ALL);
+ assertTrue(DataStore.getAllCachesCount() >= 2);
// rename list (cache1=listId1, cache2=listId1)
- assertEquals(1, cgData.renameList(listId1, "cgData Test (renamed)"));
+ assertEquals(1, DataStore.renameList(listId1, "DataStore Test (renamed)"));
// get list
- final StoredList list1 = cgData.getList(listId1);
- assertEquals("cgData Test (renamed)", list1.title);
+ final StoredList list1 = DataStore.getList(listId1);
+ assertEquals("DataStore Test (renamed)", list1.title);
// move to list (cache1=listId2, cache2=listId2)
- cgData.moveToList(Collections.singletonList(cache1), listId2);
- assertEquals(1, cgData.getAllStoredCachesCount(CacheType.ALL, listId2));
+ DataStore.moveToList(Collections.singletonList(cache1), listId2);
+ assertEquals(1, DataStore.getAllStoredCachesCount(CacheType.ALL, listId2));
// remove list (cache1=listId2, cache2=listId2)
- assertTrue(cgData.removeList(listId1));
+ assertTrue(DataStore.removeList(listId1));
// mark dropped (cache1=1, cache2=0)
- cgData.markDropped(Collections.singletonList(cache2));
+ DataStore.markDropped(Collections.singletonList(cache2));
// mark stored (cache1=1, cache2=listId2)
- cgData.moveToList(Collections.singletonList(cache2), listId2);
- assertEquals(2, cgData.getAllStoredCachesCount(CacheType.ALL, listId2));
+ DataStore.moveToList(Collections.singletonList(cache2), listId2);
+ assertEquals(2, DataStore.getAllStoredCachesCount(CacheType.ALL, listId2));
// drop stored (cache1=0, cache2=0)
- cgData.removeList(listId2);
+ DataStore.removeList(listId2);
} finally {
@@ -81,25 +81,25 @@ public class cgDataTest extends CGeoTestCase {
final Set<String> geocodes = new HashSet<String>();
geocodes.add(cache1.getGeocode());
geocodes.add(cache2.getGeocode());
- cgData.removeCaches(geocodes, LoadFlags.REMOVE_ALL);
+ DataStore.removeCaches(geocodes, LoadFlags.REMOVE_ALL);
// remove list
- cgData.removeList(listId1);
- cgData.removeList(listId2);
+ DataStore.removeList(listId1);
+ DataStore.removeList(listId2);
}
}
// Check that queries don't throw an exception (see issue #1429).
public static void testLoadWaypoints() {
final Viewport viewport = new Viewport(new Geopoint(-1, -2), new Geopoint(3, 4));
- cgData.loadWaypoints(viewport, false, false, CacheType.ALL);
- cgData.loadWaypoints(viewport, false, true, CacheType.ALL);
- cgData.loadWaypoints(viewport, true, false, CacheType.ALL);
- cgData.loadWaypoints(viewport, true, true, CacheType.ALL);
- cgData.loadWaypoints(viewport, false, false, CacheType.TRADITIONAL);
- cgData.loadWaypoints(viewport, false, true, CacheType.TRADITIONAL);
- cgData.loadWaypoints(viewport, true, false, CacheType.TRADITIONAL);
- cgData.loadWaypoints(viewport, true, true, CacheType.TRADITIONAL);
+ DataStore.loadWaypoints(viewport, false, false, CacheType.ALL);
+ DataStore.loadWaypoints(viewport, false, true, CacheType.ALL);
+ DataStore.loadWaypoints(viewport, true, false, CacheType.ALL);
+ DataStore.loadWaypoints(viewport, true, true, CacheType.ALL);
+ DataStore.loadWaypoints(viewport, false, false, CacheType.TRADITIONAL);
+ DataStore.loadWaypoints(viewport, false, true, CacheType.TRADITIONAL);
+ DataStore.loadWaypoints(viewport, true, false, CacheType.TRADITIONAL);
+ DataStore.loadWaypoints(viewport, true, true, CacheType.TRADITIONAL);
}
// Check that saving a cache and trackable without logs works (see #2199)
@@ -118,12 +118,12 @@ public class cgDataTest extends CGeoTestCase {
cache.setInventory(inventory);
try {
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
- final Geocache loadedCache = cgData.loadCache(GEOCODE_CACHE, LoadFlags.LOAD_ALL_DB_ONLY);
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ final Geocache loadedCache = DataStore.loadCache(GEOCODE_CACHE, LoadFlags.LOAD_ALL_DB_ONLY);
assertNotNull("Cache was not saved!", loadedCache);
assertEquals(1, loadedCache.getInventory().size());
} finally {
- cgData.removeCache(GEOCODE_CACHE, LoadFlags.REMOVE_ALL);
+ DataStore.removeCache(GEOCODE_CACHE, LoadFlags.REMOVE_ALL);
}
}
@@ -141,25 +141,25 @@ public class cgDataTest extends CGeoTestCase {
cache.setDetailed(true);
try {
- final Geocache oldCache = cgData.loadCache(upperCase, LoadFlags.LOAD_ALL_DB_ONLY);
+ final Geocache oldCache = DataStore.loadCache(upperCase, LoadFlags.LOAD_ALL_DB_ONLY);
assertNull("Database contained old cache!", oldCache);
- cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
- final Geocache cacheWithOriginalCode = cgData.loadCache(upperCase, LoadFlags.LOAD_ALL_DB_ONLY);
+ DataStore.saveCache(cache, EnumSet.of(SaveFlag.SAVE_DB));
+ final Geocache cacheWithOriginalCode = DataStore.loadCache(upperCase, LoadFlags.LOAD_ALL_DB_ONLY);
assertNotNull("Cache was not saved correctly!", cacheWithOriginalCode);
- final Geocache cacheLowerCase = cgData.loadCache(lowerCase, LoadFlags.LOAD_ALL_DB_ONLY);
+ final Geocache cacheLowerCase = DataStore.loadCache(lowerCase, LoadFlags.LOAD_ALL_DB_ONLY);
assertNotNull("Could not find cache by case insensitive geocode", cacheLowerCase);
} finally {
- cgData.removeCache(upperCase, LoadFlags.REMOVE_ALL);
+ DataStore.removeCache(upperCase, LoadFlags.REMOVE_ALL);
}
}
// Loading logs for an empty geocode should return an empty list, not null!
public static void testLoadLogsFromEmptyGeocode() {
- final List<LogEntry> logs = cgData.loadLogs("");
+ final List<LogEntry> logs = DataStore.loadLogs("");
assertNotNull("Logs must not be null", logs);
assertEquals("Logs from empty geocode must be empty", 0, logs.size());
@@ -169,7 +169,7 @@ public class cgDataTest extends CGeoTestCase {
int sumCaches = 0;
int allCaches = 0;
for (CacheType cacheType : CacheType.values()) {
- SearchResult historyOfType = cgData.getHistoryOfCaches(false, cacheType);
+ SearchResult historyOfType = DataStore.getHistoryOfCaches(false, cacheType);
assertNotNull(historyOfType);
if (cacheType != CacheType.ALL) {
sumCaches += historyOfType.getCount();
@@ -180,7 +180,7 @@ public class cgDataTest extends CGeoTestCase {
// check that sum of types equals 'all'
assertEquals(sumCaches, allCaches);
// check that two different routines behave the same
- assertEquals(cgData.getAllHistoryCachesCount(), sumCaches);
+ assertEquals(DataStore.getAllHistoryCachesCount(), sumCaches);
}
public static void testCachedMissing() {
@@ -208,15 +208,15 @@ public class cgDataTest extends CGeoTestCase {
inTileHighZoom.setCoords(new Geopoint("N49 44.001 E8 37.001"), Tile.ZOOMLEVEL_MIN_PERSONALIZED + 1);
// put in cache
- cgData.saveCache(main, EnumSet.of(SaveFlag.SAVE_CACHE));
- cgData.saveCache(inTileLowZoom, EnumSet.of(SaveFlag.SAVE_CACHE));
- cgData.saveCache(inTileHighZoom, EnumSet.of(SaveFlag.SAVE_CACHE));
- cgData.saveCache(outTile, EnumSet.of(SaveFlag.SAVE_CACHE));
- cgData.saveCache(otherConnector, EnumSet.of(SaveFlag.SAVE_CACHE));
+ DataStore.saveCache(main, EnumSet.of(SaveFlag.SAVE_CACHE));
+ DataStore.saveCache(inTileLowZoom, EnumSet.of(SaveFlag.SAVE_CACHE));
+ DataStore.saveCache(inTileHighZoom, EnumSet.of(SaveFlag.SAVE_CACHE));
+ DataStore.saveCache(outTile, EnumSet.of(SaveFlag.SAVE_CACHE));
+ DataStore.saveCache(otherConnector, EnumSet.of(SaveFlag.SAVE_CACHE));
final SearchResult search = new SearchResult(main);
- Set<String> filteredGeoCodes = cgData.getCachedMissingFromSearch(search, tiles, GCConnector.getInstance(), Tile.ZOOMLEVEL_MIN_PERSONALIZED - 1);
+ Set<String> filteredGeoCodes = DataStore.getCachedMissingFromSearch(search, tiles, GCConnector.getInstance(), Tile.ZOOMLEVEL_MIN_PERSONALIZED - 1);
assertTrue(filteredGeoCodes.contains(inTileLowZoom.getGeocode()));
assertFalse(filteredGeoCodes.contains(inTileHighZoom.getGeocode()));
diff --git a/tests/src/cgeo/geocaching/StoredListTest.java b/tests/src/cgeo/geocaching/StoredListTest.java
index dd8b6c7..ce7c963 100644
--- a/tests/src/cgeo/geocaching/StoredListTest.java
+++ b/tests/src/cgeo/geocaching/StoredListTest.java
@@ -5,13 +5,13 @@ import junit.framework.TestCase;
public class StoredListTest extends TestCase {
public static void testStandardListExists() {
- final StoredList list = cgData.getList(StoredList.STANDARD_LIST_ID);
+ final StoredList list = DataStore.getList(StoredList.STANDARD_LIST_ID);
assertNotNull(list);
}
public static void testEquals() {
- final StoredList list1 = cgData.getList(StoredList.STANDARD_LIST_ID);
- final StoredList list2 = cgData.getList(StoredList.STANDARD_LIST_ID);
+ final StoredList list1 = DataStore.getList(StoredList.STANDARD_LIST_ID);
+ final StoredList list2 = DataStore.getList(StoredList.STANDARD_LIST_ID);
assertEquals(list1, list2);
}
diff --git a/tests/src/cgeo/geocaching/cgeoApplicationTest.java b/tests/src/cgeo/geocaching/cgeoApplicationTest.java
index 83bf28d..4f45cc5 100644
--- a/tests/src/cgeo/geocaching/cgeoApplicationTest.java
+++ b/tests/src/cgeo/geocaching/cgeoApplicationTest.java
@@ -111,7 +111,7 @@ public class cgeoApplicationTest extends CGeoTestCase {
if (Settings.isPremiumMember() || search.getError() == null) {
assertEquals(1, search.getGeocodes().size());
assertTrue(search.getGeocodes().contains(geocode));
- return cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ return DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
}
assertEquals(0, search.getGeocodes().size());
return null;
@@ -295,7 +295,7 @@ public class cgeoApplicationTest extends CGeoTestCase {
SearchResult search = ConnectorFactory.searchByViewport(viewport, tokens);
assertNotNull(search);
assertTrue(search.getGeocodes().contains(mockedCache.getGeocode()));
- Geocache parsedCache = cgData.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
+ Geocache parsedCache = DataStore.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
assertEquals(Settings.isPremiumMember(), mockedCache.getCoords().equals(parsedCache.getCoords()));
assertEquals(Settings.isPremiumMember(), parsedCache.isReliableLatLon());
@@ -307,7 +307,7 @@ public class cgeoApplicationTest extends CGeoTestCase {
search = ConnectorFactory.searchByViewport(viewport, tokens);
assertNotNull(search);
assertTrue(search.getGeocodes().contains(mockedCache.getGeocode()));
- parsedCache = cgData.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
+ parsedCache = DataStore.loadCache(mockedCache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
assertEquals(Settings.isPremiumMember(), mockedCache.getCoords().equals(parsedCache.getCoords()));
assertEquals(Settings.isPremiumMember(), parsedCache.isReliableLatLon());
@@ -350,7 +350,7 @@ public class cgeoApplicationTest extends CGeoTestCase {
assertNotNull(search);
assertTrue(search.getGeocodes().contains(cache.getGeocode()));
// coords differ
- final Geocache cacheFromViewport = cgData.loadCache(cache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cacheFromViewport = DataStore.loadCache(cache.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords expected = " + cache.getCoords());
Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords actual = " + cacheFromViewport.getCoords());
assertFalse(cache.getCoords().isEqualTo(cacheFromViewport.getCoords(), 1e-3));
diff --git a/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java b/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java
index d186526..19acd7c 100644
--- a/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/WaypointsTest.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.connector.gc;
import cgeo.CGeoTestCase;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.utils.CancellableHandler;
@@ -27,7 +27,7 @@ public class WaypointsTest extends CGeoTestCase {
public static void testDownloadWaypoints() {
// Check that repeated loads of "GC33HXE" hold the right number of waypoints (issue #2430).
final String GEOCODE = "GC33HXE";
- cgData.removeCache(GEOCODE, LoadFlags.REMOVE_ALL);
+ DataStore.removeCache(GEOCODE, LoadFlags.REMOVE_ALL);
assertEquals(9, downloadCache(GEOCODE).getWaypoints().size());
assertEquals(9, downloadCache(GEOCODE).getWaypoints().size());
}
diff --git a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
index aeb4e00..eb797c2 100644
--- a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
+++ b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.connector.oc;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.cgData;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.enumerations.LoadFlags;
public class OkapiClientTest extends CGeoTestCase {
@@ -15,7 +15,7 @@ public class OkapiClientTest extends CGeoTestCase {
assertEquals("Oshkosh Municipal Tank", cache.getName());
assertTrue(cache.isDetailed());
// cache should be stored to DB (to listID 0) when loaded above
- cache = cgData.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY);
+ cache = DataStore.loadCache(geoCode, LoadFlags.LOAD_ALL_DB_ONLY);
assertNotNull(cache);
assertEquals(geoCode, cache.getGeocode());
assertEquals("Oshkosh Municipal Tank", cache.getName());
diff --git a/tests/src/cgeo/geocaching/export/ExportTest.java b/tests/src/cgeo/geocaching/export/ExportTest.java
index 3e5505a..6d39f8d 100644
--- a/tests/src/cgeo/geocaching/export/ExportTest.java
+++ b/tests/src/cgeo/geocaching/export/ExportTest.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.export;
import cgeo.CGeoTestCase;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.geopoint.Geopoint;
@@ -30,7 +30,7 @@ public class ExportTest extends CGeoTestCase {
cache.setCoords(new Geopoint("N 49 44.000 E 8 37.000"));
final LogEntry log = new LogEntry(1353244820000L, LogType.FOUND_IT, "Smile: \ud83d\ude0a");
cache.getLogs().add(log);
- cgData.saveCache(cache, LoadFlags.SAVE_ALL);
+ DataStore.saveCache(cache, LoadFlags.SAVE_ALL);
ArrayList<Geocache> exportList = new ArrayList<Geocache>();
exportList.add(cache);
GpxExportTester gpxExport = new GpxExportTester();
@@ -38,7 +38,7 @@ public class ExportTest extends CGeoTestCase {
try {
result = gpxExport.testExportSync(exportList);
} finally {
- cgData.removeCache(cache.getGeocode(), LoadFlags.REMOVE_ALL);
+ DataStore.removeCache(cache.getGeocode(), LoadFlags.REMOVE_ALL);
}
assertNotNull(result);
diff --git a/tests/src/cgeo/geocaching/files/GPXImporterTest.java b/tests/src/cgeo/geocaching/files/GPXImporterTest.java
index 03f917c..8f5d821 100644
--- a/tests/src/cgeo/geocaching/files/GPXImporterTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXImporterTest.java
@@ -1,8 +1,8 @@
package cgeo.geocaching.files;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.settings.Settings;
@@ -74,7 +74,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertEquals(GPXImporter.IMPORT_STEP_FINISHED, iMsg.next().what);
final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj;
assertEquals(Collections.singletonList(geocode), new ArrayList<String>(search.getGeocodes()));
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
assertTrue(cache.getWaypoints().isEmpty());
@@ -101,7 +101,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_READ_WPT_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED);
final SearchResult search = (SearchResult) importStepHandler.messages.get(4).obj;
assertEquals(Collections.singletonList("GC31J2H"), new ArrayList<String>(search.getGeocodes()));
- final Geocache cache = cgData.loadCache("GC31J2H", LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache("GC31J2H", LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
assertEquals(2, cache.getWaypoints().size());
}
@@ -114,7 +114,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
runImportThread(importThread);
assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED);
- final Geocache cache = cgData.loadCache("AID1", LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache("AID1", LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
assertEquals("First Aid Station #1", cache.getName());
}
@@ -136,7 +136,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED);
final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj;
assertEquals(Collections.singletonList("OC5952"), new ArrayList<String>(search.getGeocodes()));
- final Geocache cache = cgData.loadCache("OC5952", LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache("OC5952", LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
}
@@ -178,7 +178,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED);
final SearchResult search = (SearchResult) importStepHandler.messages.get(3).obj;
assertEquals(Collections.singletonList(geocode), new ArrayList<String>(search.getGeocodes()));
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
assertTrue(cache.getWaypoints().isEmpty());
@@ -196,7 +196,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_READ_WPT_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED);
final SearchResult search = (SearchResult) importStepHandler.messages.get(4).obj;
assertEquals(Collections.singletonList(geocode), new ArrayList<String>(search.getGeocodes()));
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
assertEquals(1, cache.getWaypoints().size()); // this is the original pocket query result without test waypoint
}
@@ -222,7 +222,7 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertImportStepMessages(GPXImporter.IMPORT_STEP_START, GPXImporter.IMPORT_STEP_READ_FILE, GPXImporter.IMPORT_STEP_READ_WPT_FILE, GPXImporter.IMPORT_STEP_STORE_STATIC_MAPS, GPXImporter.IMPORT_STEP_FINISHED);
final SearchResult search = (SearchResult) importStepHandler.messages.get(4).obj;
assertEquals(Collections.singletonList(geocode), new ArrayList<String>(search.getGeocodes()));
- final Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
+ final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
assertCacheProperties(cache);
assertEquals(1, cache.getWaypoints().size()); // this is the original pocket query result without test waypoint
}
@@ -267,8 +267,8 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
tempDir.mkdir();
assertTrue("Could not create directory " + tempDir.getPath(), tempDir.exists());
// workaround to get storage initialized
- cgData.getAllHistoryCachesCount();
- listId = cgData.createList("cgeogpxesTest");
+ DataStore.getAllHistoryCachesCount();
+ listId = DataStore.createList("cgeogpxesTest");
importCacheStaticMaps = Settings.isStoreOfflineMaps();
TestSettings.setStoreOfflineMaps(true);
@@ -278,11 +278,11 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
@Override
protected void tearDown() throws Exception {
- final SearchResult search = cgData.getBatchOfStoredCaches(null, CacheType.ALL, listId);
+ final SearchResult search = DataStore.getBatchOfStoredCaches(null, CacheType.ALL, listId);
final List<Geocache> cachesInList = new ArrayList<Geocache>();
cachesInList.addAll(search.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB));
- cgData.markDropped(cachesInList);
- cgData.removeList(listId);
+ DataStore.markDropped(cachesInList);
+ DataStore.removeList(listId);
deleteDirectory(tempDir);
TestSettings.setStoreOfflineMaps(importCacheStaticMaps);
TestSettings.setStoreOfflineWpMaps(importWpStaticMaps);
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index 06661eb..9604519 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.files;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.Waypoint;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
@@ -215,7 +215,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
}
}
// reload caches, because the parser only returns the minimum version of each cache
- return new ArrayList<Geocache>(cgData.loadCaches(result, LoadFlags.LOAD_ALL_DB_ONLY));
+ return new ArrayList<Geocache>(DataStore.loadCaches(result, LoadFlags.LOAD_ALL_DB_ONLY));
}
public static void testParseDateWithFractionalSeconds() throws ParseException {
@@ -258,9 +258,9 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
removeCacheCompletely(geocode);
final List<Geocache> caches = readGPX10(R.raw.lazy);
assertEquals(1, caches.size());
- cgData.removeAllFromCache();
+ DataStore.removeAllFromCache();
// load only the minimum cache, it has several members missing
- final Geocache minimalCache = cgData.loadCache(geocode, EnumSet.of(LoadFlag.LOAD_DB_MINIMAL));
+ final Geocache minimalCache = DataStore.loadCache(geocode, EnumSet.of(LoadFlag.LOAD_DB_MINIMAL));
// now check that we load lazy members on demand
assertFalse(minimalCache.getAttributes().isEmpty());
diff --git a/tests/src/cgeo/geocaching/test/AbstractResourceInstrumentationTestCase.java b/tests/src/cgeo/geocaching/test/AbstractResourceInstrumentationTestCase.java
index cb8238f..bb03274 100644
--- a/tests/src/cgeo/geocaching/test/AbstractResourceInstrumentationTestCase.java
+++ b/tests/src/cgeo/geocaching/test/AbstractResourceInstrumentationTestCase.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.test;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.StoredList;
-import cgeo.geocaching.cgData;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
import cgeo.geocaching.enumerations.LoadFlags.RemoveFlag;
@@ -27,7 +27,7 @@ public abstract class AbstractResourceInstrumentationTestCase extends Instrument
protected static void removeCacheCompletely(final String geocode) {
final EnumSet<RemoveFlag> flags = EnumSet.copyOf(LoadFlags.REMOVE_ALL);
flags.add(RemoveFlag.REMOVE_OWN_WAYPOINTS_ONLY_FOR_TESTING);
- cgData.removeCache(geocode, flags);
+ DataStore.removeCache(geocode, flags);
}
protected InputStream getResourceStream(int resourceId) {
@@ -65,17 +65,17 @@ public abstract class AbstractResourceInstrumentationTestCase extends Instrument
@Override
protected void setUp() throws Exception {
super.setUp();
- temporaryListId = cgData.createList("Temporary unit testing");
+ temporaryListId = DataStore.createList("Temporary unit testing");
assertTrue(temporaryListId != StoredList.TEMPORARY_LIST_ID);
assertTrue(temporaryListId != StoredList.STANDARD_LIST_ID);
}
@Override
protected void tearDown() throws Exception {
- final SearchResult search = cgData.getBatchOfStoredCaches(null, CacheType.ALL, temporaryListId);
+ final SearchResult search = DataStore.getBatchOfStoredCaches(null, CacheType.ALL, temporaryListId);
assertNotNull(search);
- cgData.removeCaches(search.getGeocodes(), LoadFlags.REMOVE_ALL);
- cgData.removeList(temporaryListId);
+ DataStore.removeCaches(search.getGeocodes(), LoadFlags.REMOVE_ALL);
+ DataStore.removeList(temporaryListId);
super.tearDown();
}