aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java17
-rw-r--r--main/src/cgeo/geocaching/Destination.java (renamed from main/src/cgeo/geocaching/cgDestination.java)10
-rw-r--r--main/src/cgeo/geocaching/LogEntry.java69
-rw-r--r--main/src/cgeo/geocaching/TrackableLog.java18
-rw-r--r--main/src/cgeo/geocaching/VisitCacheActivity.java16
-rw-r--r--main/src/cgeo/geocaching/cgCache.java26
-rw-r--r--main/src/cgeo/geocaching/cgData.java40
-rw-r--r--main/src/cgeo/geocaching/cgLog.java39
-rw-r--r--main/src/cgeo/geocaching/cgTrackable.java6
-rw-r--r--main/src/cgeo/geocaching/cgTrackableLog.java11
-rw-r--r--main/src/cgeo/geocaching/cgeoapplication.java16
-rw-r--r--main/src/cgeo/geocaching/cgeopoint.java38
-rw-r--r--main/src/cgeo/geocaching/cgeotrackable.java16
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java82
-rw-r--r--main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java10
-rw-r--r--main/src/cgeo/geocaching/export/FieldnoteExport.java4
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java4
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java6
-rw-r--r--tests/src/cgeo/geocaching/DestinationTest.java (renamed from tests/src/cgeo/geocaching/cgDestinationTest.java)6
-rw-r--r--tests/src/cgeo/geocaching/TrackablesTest.java20
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java4
21 files changed, 238 insertions, 220 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 7028b32..8362662 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2189,7 +2189,7 @@ public class CacheDetailActivity extends AbstractActivity {
}
}
- view.setAdapter(new ArrayAdapter<cgLog>(CacheDetailActivity.this, R.layout.cacheview_logs_item, cache.getLogs(allLogs)) {
+ view.setAdapter(new ArrayAdapter<LogEntry>(CacheDetailActivity.this, R.layout.cacheview_logs_item, cache.getLogs(allLogs)) {
final UserActionsClickListener userActionsClickListener = new UserActionsClickListener();
final DecryptTextClickListener decryptTextClickListener = new DecryptTextClickListener();
@@ -2205,7 +2205,7 @@ public class CacheDetailActivity extends AbstractActivity {
rowView.setTag(holder);
}
- final cgLog log = getItem(position);
+ final LogEntry log = getItem(position);
if (log.date > 0) {
holder.date.setText(Formatter.formatShortDate(log.date));
@@ -2238,10 +2238,10 @@ public class CacheDetailActivity extends AbstractActivity {
}
// images
- if (CollectionUtils.isNotEmpty(log.logImages)) {
+ if (log.hasLogImages()) {
List<String> titles = new ArrayList<String>(5);
- for (cgImage image : log.logImages) {
+ for (cgImage image : log.getLogImages()) {
if (StringUtils.isNotBlank(image.getTitle())) {
titles.add(image.getTitle());
}
@@ -2255,7 +2255,7 @@ public class CacheDetailActivity extends AbstractActivity {
holder.images.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- cgeoimages.startActivityLogImages(CacheDetailActivity.this, cache.getGeocode(), new ArrayList<cgImage>(log.logImages));
+ cgeoimages.startActivityLogImages(CacheDetailActivity.this, cache.getGeocode(), new ArrayList<cgImage>(log.getLogImages()));
}
});
} else {
@@ -2512,4 +2512,11 @@ public class CacheDetailActivity extends AbstractActivity {
cachesIntent.putExtra("name", cacheName);
context.startActivity(cachesIntent);
}
+
+ public static void startActivityGuid(final Context context, final String guid, final String cacheName) {
+ final Intent cacheIntent = new Intent(context, CacheDetailActivity.class);
+ cacheIntent.putExtra("guid", guid);
+ cacheIntent.putExtra("name", cacheName);
+ context.startActivity(cacheIntent);
+ }
}
diff --git a/main/src/cgeo/geocaching/cgDestination.java b/main/src/cgeo/geocaching/Destination.java
index 1e5253c..441e959 100644
--- a/main/src/cgeo/geocaching/cgDestination.java
+++ b/main/src/cgeo/geocaching/Destination.java
@@ -2,20 +2,20 @@ package cgeo.geocaching;
import cgeo.geocaching.geopoint.Geopoint;
-public class cgDestination implements ICoordinates {
+public final class Destination implements ICoordinates {
final private long id;
final private long date;
final private Geopoint coords;
- public cgDestination(long id, long date, final Geopoint coords) {
+ public Destination(long id, long date, final Geopoint coords) {
this.id = id;
this.date = date;
this.coords = coords;
}
- public cgDestination withDate(final long date) {
- return new cgDestination(id, date, coords);
+ public Destination(final Geopoint coords) {
+ this(0, System.currentTimeMillis(), coords);
}
public long getDate() {
@@ -34,7 +34,7 @@ public class cgDestination implements ICoordinates {
@Override
public boolean equals(final Object obj) {
- return obj != null && obj instanceof cgDestination && ((cgDestination) obj).coords.equals(coords);
+ return obj != null && obj instanceof Destination && ((Destination) obj).coords.equals(coords);
}
public long getId() {
diff --git a/main/src/cgeo/geocaching/LogEntry.java b/main/src/cgeo/geocaching/LogEntry.java
new file mode 100644
index 0000000..3f6ed74
--- /dev/null
+++ b/main/src/cgeo/geocaching/LogEntry.java
@@ -0,0 +1,69 @@
+package cgeo.geocaching;
+
+import cgeo.geocaching.enumerations.LogType;
+
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public final class LogEntry {
+ /**
+ * avoid creating new empty lists all the time using this constant. We could also return Collections.EMPTY_LIST
+ * using a cast, but that might trigger static code analysis tools.
+ */
+ private static final List<cgImage> EMPTY_LIST = Collections.emptyList();
+ public int id = 0;
+ public LogType type = LogType.LOG_NOTE; // note
+ public String author = "";
+ public String log = "";
+ public long date = 0;
+ public int found = -1;
+ /** Friend's log entry */
+ public boolean friend = false;
+ private List<cgImage> logImages = null;
+ public String cacheName = ""; // used for trackables
+ public String cacheGuid = ""; // used for trackables
+
+ @Override
+ public int hashCode() {
+ return (int) date * type.hashCode() * author.hashCode() * log.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof LogEntry)) {
+ return false;
+ }
+ final LogEntry otherLog = (LogEntry) obj;
+ return date == otherLog.date &&
+ type == otherLog.type &&
+ author.compareTo(otherLog.author) == 0 &&
+ log.compareTo(otherLog.log) == 0;
+ }
+
+ public void addLogImage(final cgImage image) {
+ if (logImages == null) {
+ logImages = new ArrayList<cgImage>();
+ }
+ logImages.add(image);
+ }
+
+ /**
+ * @return the log images or an empty list, never <code>null</code>
+ */
+ public List<cgImage> getLogImages() {
+ if (logImages == null) {
+ return EMPTY_LIST;
+ }
+ return logImages;
+ }
+
+ public boolean hasLogImages() {
+ return CollectionUtils.isNotEmpty(logImages);
+ }
+}
diff --git a/main/src/cgeo/geocaching/TrackableLog.java b/main/src/cgeo/geocaching/TrackableLog.java
new file mode 100644
index 0000000..8e2ad90
--- /dev/null
+++ b/main/src/cgeo/geocaching/TrackableLog.java
@@ -0,0 +1,18 @@
+package cgeo.geocaching;
+
+import cgeo.geocaching.enumerations.LogTypeTrackable;
+
+public final class TrackableLog {
+ public TrackableLog(String trackCode, String name, int id, int ctl) {
+ this.trackCode = trackCode;
+ this.name = name;
+ this.id = id;
+ this.ctl = ctl;
+ }
+
+ public final int ctl;
+ public final int id;
+ public final String trackCode;
+ public final String name;
+ public LogTypeTrackable action = LogTypeTrackable.DO_NOTHING; // base.logTrackablesAction - no action
+}
diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java
index 891081e..a2fde26 100644
--- a/main/src/cgeo/geocaching/VisitCacheActivity.java
+++ b/main/src/cgeo/geocaching/VisitCacheActivity.java
@@ -66,7 +66,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
private List<LogType> possibleLogTypes = new ArrayList<LogType>();
private String[] viewstates = null;
private boolean gettingViewstate = true;
- private List<cgTrackableLog> trackables = null;
+ private List<TrackableLog> trackables = null;
private Calendar date = Calendar.getInstance();
private LogType typeSelected = LogType.LOG_UNKNOWN;
private int attempts = 0;
@@ -116,7 +116,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
final LinearLayout inventoryView = (LinearLayout) findViewById(R.id.inventory);
inventoryView.removeAllViews();
- for (cgTrackableLog tb : trackables) {
+ for (TrackableLog tb : trackables) {
LinearLayout inventoryItem = (LinearLayout) inflater.inflate(R.layout.visit_trackable, null);
((TextView) inventoryItem.findViewById(R.id.trackcode)).setText(tb.trackCode);
@@ -384,7 +384,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
} else {
final int realViewId = ((LinearLayout) findViewById(viewId)).getId();
- for (final cgTrackableLog tb : trackables) {
+ for (final TrackableLog tb : trackables) {
if (tb.id == realViewId) {
menu.setHeaderTitle(tb.name);
}
@@ -421,7 +421,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
}
tbText.setText(res.getString(logType.resourceId) + " ▼");
}
- for (cgTrackableLog tb : trackables) {
+ for (TrackableLog tb : trackables) {
tb.action = logType;
}
tbChanged = true;
@@ -444,7 +444,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
return false;
}
- for (cgTrackableLog tb : trackables) {
+ for (TrackableLog tb : trackables) {
if (tb.id == group) {
tbChanged = true;
@@ -477,7 +477,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
possibleLogTypes = cache.getPossibleLogTypes();
- final cgLog log = app.loadLogOffline(geocode);
+ final LogEntry log = app.loadLogOffline(geocode);
if (log != null) {
typeSelected = log.type;
date.setTime(new Date(log.date));
@@ -702,7 +702,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
log, trackables);
if (status == StatusCode.NO_ERROR) {
- final cgLog logNow = new cgLog();
+ final LogEntry logNow = new LogEntry();
logNow.author = Settings.getUsername();
logNow.date = date.getTimeInMillis();
logNow.type = typeSelected;
@@ -767,7 +767,7 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
private class ActivityState {
private final String[] viewstates;
- private final List<cgTrackableLog> trackables;
+ private final List<TrackableLog> trackables;
private final int attempts;
private final List<LogType> possibleLogTypes;
private final LogType typeSelected;
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index 09102f1..f95fb2c 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -92,7 +92,7 @@ public class cgCache implements ICache, IWaypoint {
private List<String> attributes = null;
private List<cgWaypoint> waypoints = null;
private ArrayList<cgImage> spoilers = null;
- private List<cgLog> logs = null;
+ private List<LogEntry> logs = null;
private List<cgTrackable> inventory = null;
private Map<LogType, Integer> logCounts = new HashMap<LogType, Integer>();
private boolean logOffline = false;
@@ -938,7 +938,7 @@ public class cgCache implements ICache, IWaypoint {
return false;
}
- public List<cgLog> getLogs() {
+ public List<LogEntry> getLogs() {
return getLogs(true);
}
@@ -947,15 +947,15 @@ public class cgCache implements ICache, IWaypoint {
* true for all logs, false for friend logs only
* @return the logs with all entries or just the entries of the friends, never <code>null</code>
*/
- public List<cgLog> getLogs(boolean allLogs) {
+ public List<LogEntry> getLogs(boolean allLogs) {
if (logs == null) {
return Collections.emptyList();
}
if (allLogs) {
return logs;
}
- ArrayList<cgLog> friendLogs = new ArrayList<cgLog>();
- for (cgLog log : logs) {
+ ArrayList<LogEntry> friendLogs = new ArrayList<LogEntry>();
+ for (LogEntry log : logs) {
if (log.friend) {
friendLogs.add(log);
}
@@ -967,7 +967,7 @@ public class cgCache implements ICache, IWaypoint {
* @param logs
* the log entries
*/
- public void setLogs(List<cgLog> logs) {
+ public void setLogs(List<LogEntry> logs) {
this.logs = logs;
}
@@ -1358,16 +1358,16 @@ public class cgCache implements ICache, IWaypoint {
return attributes != null && attributes.size() > 0;
}
- public void prependLog(final cgLog log) {
+ public void prependLog(final LogEntry log) {
if (logs == null) {
- logs = new ArrayList<cgLog>();
+ logs = new ArrayList<LogEntry>();
}
logs.add(0, log);
}
- public void appendLog(final cgLog log) {
+ public void appendLog(final LogEntry log) {
if (logs == null) {
- logs = new ArrayList<cgLog>();
+ logs = new ArrayList<LogEntry>();
}
logs.add(log);
}
@@ -1537,9 +1537,9 @@ public class cgCache implements ICache, IWaypoint {
// store images from logs
if (Settings.isStoreLogImages()) {
- for (cgLog log : cache.getLogs(true)) {
- if (CollectionUtils.isNotEmpty(log.logImages)) {
- for (cgImage oneLogImg : log.logImages) {
+ for (LogEntry log : cache.getLogs(true)) {
+ if (log.hasLogImages()) {
+ for (cgImage oneLogImg : log.getLogImages()) {
imgGetter.getDrawable(oneLogImg.getUrl());
}
}
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 894a4ef..c437e72 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -1152,7 +1152,7 @@ public class cgData {
* @param destination
* a destination to save
*/
- public void saveSearchedDestination(final cgDestination destination) {
+ public void saveSearchedDestination(final Destination destination) {
init();
databaseRW.beginTransaction();
@@ -1343,11 +1343,11 @@ public class cgData {
return true;
}
- public boolean saveLogs(String geocode, List<cgLog> logs) {
+ public boolean saveLogs(String geocode, List<LogEntry> logs) {
return saveLogs(geocode, logs, true);
}
- public boolean saveLogs(String geocode, List<cgLog> logs, boolean drop) {
+ public boolean saveLogs(String geocode, List<LogEntry> logs, boolean drop) {
if (StringUtils.isBlank(geocode) || logs == null) {
return false;
}
@@ -1364,7 +1364,7 @@ public class cgData {
if (!logs.isEmpty()) {
InsertHelper helper = new InsertHelper(databaseRW, dbTableLogs);
long timeStamp = System.currentTimeMillis();
- for (cgLog log : logs) {
+ for (LogEntry log : logs) {
helper.prepareForInsert();
helper.bind(LOGS_GEOCODE, geocode);
@@ -1378,9 +1378,9 @@ public class cgData {
long log_id = helper.execute();
- if (CollectionUtils.isNotEmpty(log.logImages)) {
+ if (log.hasLogImages()) {
ContentValues values = new ContentValues();
- for (cgImage img : log.logImages) {
+ for (cgImage img : log.getLogImages()) {
values.clear();
values.put("log_id", log_id);
values.put("title", img.getTitle());
@@ -2022,7 +2022,7 @@ public class cgData {
*
* @return A list of previously entered destinations or an empty list.
*/
- public List<cgDestination> loadHistoryOfSearchedLocations() {
+ public List<Destination> loadHistoryOfSearchedLocations() {
init();
Cursor cursor = databaseRO.query(dbTableSearchDestionationHistory,
@@ -2034,7 +2034,7 @@ public class cgData {
"date desc",
"100");
- final List<cgDestination> destinations = new LinkedList<cgDestination>();
+ final List<Destination> destinations = new LinkedList<Destination>();
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
@@ -2044,7 +2044,7 @@ public class cgData {
int indexLongitude = cursor.getColumnIndex("longitude");
do {
- final cgDestination dest = new cgDestination(cursor.getLong(indexId), cursor.getLong(indexDate), getCoords(cursor, indexLatitude, indexLongitude));
+ final Destination dest = new Destination(cursor.getLong(indexId), cursor.getLong(indexDate), getCoords(cursor, indexLatitude, indexLongitude));
// If coordinates are non-existent or invalid, do not consider
// this point.
@@ -2079,14 +2079,14 @@ public class cgData {
return success;
}
- public List<cgLog> loadLogs(String geocode) {
+ public List<LogEntry> loadLogs(String geocode) {
if (StringUtils.isBlank(geocode)) {
return null;
}
init();
- List<cgLog> logs = new ArrayList<cgLog>();
+ List<LogEntry> logs = new ArrayList<LogEntry>();
Cursor cursor = databaseRO.rawQuery(
"SELECT cg_logs._id as cg_logs_id, type, author, log, date, found, friend, " + dbTableLogImages + "._id as cg_logImages_id, log_id, title, url FROM "
@@ -2094,7 +2094,7 @@ public class cgData {
+ " ON ( cg_logs._id = log_id ) WHERE geocode = ? ORDER BY date desc, cg_logs._id asc", new String[] { geocode });
if (cursor != null && cursor.getCount() > 0) {
- cgLog log = null;
+ LogEntry log = null;
int indexLogsId = cursor.getColumnIndex("cg_logs_id");
int indexType = cursor.getColumnIndex("type");
int indexAuthor = cursor.getColumnIndex("author");
@@ -2107,7 +2107,7 @@ public class cgData {
int indexUrl = cursor.getColumnIndex("url");
while (cursor.moveToNext() && logs.size() < 100) {
if (log == null || log.id != cursor.getInt(indexLogsId)) {
- log = new cgLog();
+ log = new LogEntry();
log.id = cursor.getInt(indexLogsId);
log.type = LogType.getById(cursor.getInt(indexType));
log.author = cursor.getString(indexAuthor);
@@ -2120,11 +2120,7 @@ public class cgData {
if (!cursor.isNull(indexLogImagesId)) {
String title = cursor.getString(indexTitle);
String url = cursor.getString(indexUrl);
- if (log.logImages == null) {
- log.logImages = new ArrayList<cgImage>();
- }
- final cgImage log_img = new cgImage(url, title);
- log.logImages.add(log_img);
+ log.addLogImage(new cgImage(url, title));
}
}
}
@@ -2747,14 +2743,14 @@ public class cgData {
return status;
}
- public cgLog loadLogOffline(String geocode) {
+ public LogEntry loadLogOffline(String geocode) {
if (StringUtils.isBlank(geocode)) {
return null;
}
init();
- cgLog log = null;
+ LogEntry log = null;
Cursor cursor = databaseRO.query(
dbTableLogsOffline,
@@ -2769,7 +2765,7 @@ public class cgData {
if (cursor != null && cursor.getCount() > 0) {
cursor.moveToFirst();
- log = new cgLog();
+ log = new LogEntry();
log.id = cursor.getInt(cursor.getColumnIndex("_id"));
log.type = LogType.getById(cursor.getInt(cursor.getColumnIndex("type")));
log.log = cursor.getString(cursor.getColumnIndex("log"));
@@ -3043,7 +3039,7 @@ public class cgData {
return true;
}
- public boolean removeSearchedDestination(cgDestination destination) {
+ public boolean removeSearchedDestination(Destination destination) {
boolean success = true;
if (destination == null) {
success = false;
diff --git a/main/src/cgeo/geocaching/cgLog.java b/main/src/cgeo/geocaching/cgLog.java
deleted file mode 100644
index 2b3568d..0000000
--- a/main/src/cgeo/geocaching/cgLog.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package cgeo.geocaching;
-
-import cgeo.geocaching.enumerations.LogType;
-
-import java.util.List;
-
-public class cgLog {
- public int id = 0;
- public LogType type = LogType.LOG_NOTE; // note
- public String author = "";
- public String log = "";
- public long date = 0;
- public int found = -1;
- /** Friend's logentry */
- public boolean friend = false;
- public List<cgImage> logImages = null;
- public String cacheName = ""; // used for trackables
- public String cacheGuid = ""; // used for trackables
-
- @Override
- public int hashCode() {
- return (int) date * type.hashCode() * author.hashCode() * log.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!(obj instanceof cgLog)) {
- return false;
- }
- final cgLog otherLog = (cgLog) obj;
- return date == otherLog.date &&
- type == otherLog.type &&
- author.compareTo(otherLog.author) == 0 &&
- log.compareTo(otherLog.log) == 0 ? true : false;
- }
-}
diff --git a/main/src/cgeo/geocaching/cgTrackable.java b/main/src/cgeo/geocaching/cgTrackable.java
index c4a3464..f46e39b 100644
--- a/main/src/cgeo/geocaching/cgTrackable.java
+++ b/main/src/cgeo/geocaching/cgTrackable.java
@@ -34,7 +34,7 @@ public class cgTrackable implements ILogable {
private String goal = null;
private String details = null;
private String image = null;
- private List<cgLog> logs = new ArrayList<cgLog>();
+ private List<LogEntry> logs = new ArrayList<LogEntry>();
private String trackingcode = null;
public String getUrl() {
@@ -188,11 +188,11 @@ public class cgTrackable implements ILogable {
this.image = image;
}
- public List<cgLog> getLogs() {
+ public List<LogEntry> getLogs() {
return logs;
}
- public void setLogs(List<cgLog> logs) {
+ public void setLogs(List<LogEntry> logs) {
this.logs = logs;
}
diff --git a/main/src/cgeo/geocaching/cgTrackableLog.java b/main/src/cgeo/geocaching/cgTrackableLog.java
deleted file mode 100644
index ee134da..0000000
--- a/main/src/cgeo/geocaching/cgTrackableLog.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package cgeo.geocaching;
-
-import cgeo.geocaching.enumerations.LogTypeTrackable;
-
-public class cgTrackableLog {
- public int ctl = -1;
- public int id = -1;
- public String trackCode = null;
- public String name = null;
- public LogTypeTrackable action = LogTypeTrackable.DO_NOTHING; // base.logTrackablesAction - no action
-}
diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java
index abead59..a8a62c3 100644
--- a/main/src/cgeo/geocaching/cgeoapplication.java
+++ b/main/src/cgeo/geocaching/cgeoapplication.java
@@ -297,7 +297,7 @@ public class cgeoapplication extends Application {
}
/** {@link cgData#loadHistoryOfSearchedLocations()} */
- public List<cgDestination> getHistoryOfSearchedLocations() {
+ public List<Destination> getHistoryOfSearchedLocations() {
return storage.loadHistoryOfSearchedLocations();
}
@@ -348,8 +348,8 @@ public class cgeoapplication extends Application {
return storage.clearSearchedDestinations();
}
- /** {@link cgData#saveSearchedDestination(cgDestination)} */
- public void saveSearchedDestination(cgDestination destination) {
+ /** {@link cgData#saveSearchedDestination(Destination)} */
+ public void saveSearchedDestination(Destination destination) {
storage.saveSearchedDestination(destination);
}
@@ -412,7 +412,7 @@ public class cgeoapplication extends Application {
return StringUtils.defaultString(action);
}
- public boolean addLog(String geocode, cgLog log) {
+ public boolean addLog(String geocode, LogEntry log) {
if (StringUtils.isBlank(geocode)) {
return false;
}
@@ -420,7 +420,7 @@ public class cgeoapplication extends Application {
return false;
}
- List<cgLog> list = new ArrayList<cgLog>();
+ List<LogEntry> list = new ArrayList<LogEntry>();
list.add(log);
return storage.saveLogs(geocode, list, false);
@@ -440,7 +440,7 @@ public class cgeoapplication extends Application {
}
/** {@link cgData#loadLogOffline(String)} */
- public cgLog loadLogOffline(String geocode) {
+ public LogEntry loadLogOffline(String geocode) {
return storage.loadLogOffline(geocode);
}
@@ -484,8 +484,8 @@ public class cgeoapplication extends Application {
return storage.removeList(id);
}
- /** {@link cgData#removeSearchedDestination(cgDestination)} */
- public boolean removeSearchedDestinations(cgDestination destination) {
+ /** {@link cgData#removeSearchedDestination(Destination)} */
+ public boolean removeSearchedDestinations(Destination destination) {
return storage.removeSearchedDestination(destination);
}
diff --git a/main/src/cgeo/geocaching/cgeopoint.java b/main/src/cgeo/geocaching/cgeopoint.java
index d501d03..0335453 100644
--- a/main/src/cgeo/geocaching/cgeopoint.java
+++ b/main/src/cgeo/geocaching/cgeopoint.java
@@ -41,18 +41,18 @@ public class cgeopoint extends AbstractActivity {
private static final int MENU_CACHES_AROUND = 5;
private static final int MENU_CLEAR_HISTORY = 6;
- private static class DestinationHistoryAdapter extends ArrayAdapter<cgDestination> {
+ private static class DestinationHistoryAdapter extends ArrayAdapter<Destination> {
private LayoutInflater inflater = null;
public DestinationHistoryAdapter(Context context,
- List<cgDestination> objects) {
+ List<Destination> objects) {
super(context, 0, objects);
}
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
- cgDestination loc = getItem(position);
+ Destination loc = getItem(position);
View v = convertView;
@@ -90,7 +90,7 @@ public class cgeopoint extends AbstractActivity {
private Button latButton = null;
private Button lonButton = null;
private boolean changed = false;
- private List<cgDestination> historyOfSearchedLocations;
+ private List<Destination> historyOfSearchedLocations;
private DestinationHistoryAdapter destionationHistoryAdapter;
private ListView historyListView;
private TextView historyFooter;
@@ -138,8 +138,8 @@ public class cgeopoint extends AbstractActivity {
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
final Object selection = arg0.getItemAtPosition(arg2);
- if (selection instanceof cgDestination) {
- navigateTo(((cgDestination) selection).getCoords());
+ if (selection instanceof Destination) {
+ navigateTo(((Destination) selection).getCoords());
}
}
});
@@ -164,21 +164,21 @@ public class cgeopoint extends AbstractActivity {
switch (item.getItemId()) {
case CONTEXT_MENU_NAVIGATE:
contextMenuItemPosition = position;
- if (destination instanceof cgDestination) {
- NavigationAppFactory.showNavigationMenu(geo, this, null, null, ((cgDestination) destination).getCoords());
+ if (destination instanceof Destination) {
+ NavigationAppFactory.showNavigationMenu(geo, this, null, null, ((Destination) destination).getCoords());
return true;
}
break;
case CONTEXT_MENU_DELETE_WAYPOINT:
- if (destination instanceof cgDestination) {
- removeFromHistory((cgDestination) destination);
+ if (destination instanceof Destination) {
+ removeFromHistory((Destination) destination);
}
return true;
case CONTEXT_MENU_EDIT_WAYPOINT:
- if (destination instanceof cgDestination) {
- final Geopoint gp = ((cgDestination) destination).getCoords();
+ if (destination instanceof Destination) {
+ final Geopoint gp = ((Destination) destination).getCoords();
latButton.setText(gp.format(GeopointFormatter.Format.LAT_DECMINUTE));
lonButton.setText(gp.format(GeopointFormatter.Format.LON_DECMINUTE));
}
@@ -206,7 +206,7 @@ public class cgeopoint extends AbstractActivity {
return destionationHistoryAdapter;
}
- private List<cgDestination> getHistoryOfSearchedLocations() {
+ private List<Destination> getHistoryOfSearchedLocations() {
if (historyOfSearchedLocations == null) {
// Load from database
historyOfSearchedLocations = app.getHistoryOfSearchedLocations();
@@ -383,8 +383,7 @@ public class cgeopoint extends AbstractActivity {
final Geopoint coords = getDestination();
- if (coords != null)
- {
+ if (coords != null) {
addToHistory(coords);
}
@@ -411,21 +410,20 @@ public class cgeopoint extends AbstractActivity {
private void addToHistory(final Geopoint coords) {
// Add locations to history
- final cgDestination loc = new cgDestination(0, 0, coords);
+ final Destination loc = new Destination(coords);
if (!getHistoryOfSearchedLocations().contains(loc)) {
- final cgDestination updatedLoc = loc.withDate(System.currentTimeMillis());
- getHistoryOfSearchedLocations().add(0, updatedLoc);
+ getHistoryOfSearchedLocations().add(0, loc);
// Save location
- app.saveSearchedDestination(updatedLoc);
+ app.saveSearchedDestination(loc);
// Ensure to remove the footer
historyListView.removeFooterView(getEmptyHistoryFooter());
}
}
- private void removeFromHistory(cgDestination destination) {
+ private void removeFromHistory(Destination destination) {
if (getHistoryOfSearchedLocations().contains(destination)) {
getHistoryOfSearchedLocations().remove(destination);
diff --git a/main/src/cgeo/geocaching/cgeotrackable.java b/main/src/cgeo/geocaching/cgeotrackable.java
index 5eeec9a..923e420 100644
--- a/main/src/cgeo/geocaching/cgeotrackable.java
+++ b/main/src/cgeo/geocaching/cgeotrackable.java
@@ -7,7 +7,6 @@ import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.ui.Formatter;
import cgeo.geocaching.utils.Log;
-import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import android.app.ProgressDialog;
@@ -444,7 +443,7 @@ public class cgeotrackable extends AbstractActivity {
RelativeLayout rowView;
if (trackable != null && trackable.getLogs() != null) {
- for (cgLog log : trackable.getLogs()) {
+ for (LogEntry log : trackable.getLogs()) {
rowView = (RelativeLayout) inflater.inflate(R.layout.trackable_logs_item, null);
if (log.date > 0) {
@@ -462,10 +461,7 @@ public class cgeotrackable extends AbstractActivity {
final String cacheName = log.cacheName;
((TextView) rowView.findViewById(R.id.location)).setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
- Intent cacheIntent = new Intent(cgeotrackable.this, CacheDetailActivity.class);
- cacheIntent.putExtra("guid", cacheGuid);
- cacheIntent.putExtra("name", Html.fromHtml(cacheName).toString());
- startActivity(cacheIntent);
+ CacheDetailActivity.startActivityGuid(cgeotrackable.this, cacheGuid, Html.fromHtml(cacheName).toString());
}
});
}
@@ -477,9 +473,9 @@ public class cgeotrackable extends AbstractActivity {
// add LogImages
LinearLayout logLayout = (LinearLayout) rowView.findViewById(R.id.log_layout);
- if (CollectionUtils.isNotEmpty(log.logImages)) {
+ if (log.hasLogImages()) {
- final ArrayList<cgImage> logImages = new ArrayList<cgImage>(log.logImages);
+ final ArrayList<cgImage> logImages = new ArrayList<cgImage>(log.getLogImages());
final View.OnClickListener listener = new View.OnClickListener() {
@Override
@@ -489,8 +485,8 @@ public class cgeotrackable extends AbstractActivity {
};
ArrayList<String> titles = new ArrayList<String>();
- for (int i_img_cnt = 0; i_img_cnt < log.logImages.size(); i_img_cnt++) {
- String img_title = log.logImages.get(i_img_cnt).getTitle();
+ for (cgImage image : log.getLogImages()) {
+ String img_title = image.getTitle();
if (!StringUtils.isBlank(img_title)) {
titles.add(img_title);
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index b6d8f26..cf7c762 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -1,14 +1,14 @@
package cgeo.geocaching.connector.gc;
+import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
+import cgeo.geocaching.TrackableLog;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgImage;
-import cgeo.geocaching.cgLog;
import cgeo.geocaching.cgSearchThread;
import cgeo.geocaching.cgTrackable;
-import cgeo.geocaching.cgTrackableLog;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.enumerations.CacheSize;
@@ -50,6 +50,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
@@ -910,7 +911,7 @@ public abstract class GCParser {
public static StatusCode postLog(final String geocode, final String cacheid, final String[] viewstates,
final LogType logType, final int year, final int month, final int day,
- final String log, final List<cgTrackableLog> trackables) {
+ final String log, final List<TrackableLog> trackables) {
if (Login.isEmpty(viewstates)) {
Log.e("cgeoBase.postLog: No viewstate given");
return StatusCode.LOG_POST_ERROR;
@@ -961,7 +962,7 @@ public abstract class GCParser {
if (trackables != null && !trackables.isEmpty()) { // we have some trackables to proceed
final StringBuilder hdnSelected = new StringBuilder();
- for (final cgTrackableLog tb : trackables) {
+ for (final TrackableLog tb : trackables) {
if (tb.action != LogTypeTrackable.DO_NOTHING) {
hdnSelected.append(Integer.toString(tb.id));
hdnSelected.append(tb.action.action);
@@ -1014,7 +1015,7 @@ public abstract class GCParser {
if (trackables != null && !trackables.isEmpty()) { // we have some trackables to proceed
final StringBuilder hdnSelected = new StringBuilder();
- for (cgTrackableLog tb : trackables) {
+ for (TrackableLog tb : trackables) {
String ctl = null;
final String action = Integer.toString(tb.id) + tb.action.action;
@@ -1332,7 +1333,7 @@ public abstract class GCParser {
*/
while (matcherLogs.find())
{
- final cgLog logDone = new cgLog();
+ final LogEntry logDone = new LogEntry();
logDone.type = LogType.getByIconName(matcherLogs.group(1));
logDone.author = Html.fromHtml(matcherLogs.group(3)).toString().trim();
@@ -1360,10 +1361,7 @@ public abstract class GCParser {
while (matcherLogImages.find())
{
final cgImage logImage = new cgImage(matcherLogImages.group(1), matcherLogImages.group(2));
- if (logDone.logImages == null) {
- logDone.logImages = new ArrayList<cgImage>();
- }
- logDone.logImages.add(logImage);
+ logDone.addLogImage(logImage);
}
trackable.getLogs().add(logDone);
@@ -1395,7 +1393,7 @@ public abstract class GCParser {
* @param friends
* retrieve friend logs
*/
- private static List<cgLog> loadLogsFromDetails(final String page, final cgCache cache, final boolean friends, final boolean getDataFromPage) {
+ private static List<LogEntry> loadLogsFromDetails(final String page, final cgCache cache, final boolean friends, final boolean getDataFromPage) {
String rawResponse = null;
if (!getDataFromPage) {
@@ -1434,7 +1432,7 @@ public abstract class GCParser {
rawResponse = BaseUtils.getMatch(page, GCConstants.PATTERN_LOGBOOK, "");
}
- List<cgLog> logs = new ArrayList<cgLog>();
+ List<LogEntry> logs = new ArrayList<LogEntry>();
try {
final JSONObject resp = new JSONObject(rawResponse);
@@ -1447,7 +1445,7 @@ public abstract class GCParser {
for (int index = 0; index < data.length(); index++) {
final JSONObject entry = data.getJSONObject(index);
- final cgLog logDone = new cgLog();
+ final LogEntry logDone = new LogEntry();
logDone.friend = friends;
// FIXME: use the "LogType" field instead of the "LogTypeImage" one.
@@ -1471,10 +1469,7 @@ public abstract class GCParser {
String url = "http://img.geocaching.com/cache/log/" + image.getString("FileName");
String title = image.getString("Name");
final cgImage logImage = new cgImage(url, title);
- if (logDone.logImages == null) {
- logDone.logImages = new ArrayList<cgImage>();
- }
- logDone.logImages.add(logImage);
+ logDone.addLogImage(logImage);
}
logs.add(logDone);
@@ -1519,18 +1514,16 @@ public abstract class GCParser {
return types;
}
- public static List<cgTrackableLog> parseTrackableLog(final String page) {
+ public static List<TrackableLog> parseTrackableLog(final String page) {
if (StringUtils.isEmpty(page)) {
return null;
}
- final List<cgTrackableLog> trackables = new ArrayList<cgTrackableLog>();
-
String table = StringUtils.substringBetween(page, "<table id=\"tblTravelBugs\"", "</table>");
// if no trackables are currently in the account, the table is not available, so return an empty list instead of null
if (StringUtils.isBlank(table)) {
- return trackables;
+ return Collections.emptyList();
}
table = StringUtils.substringBetween(table, "<tbody>", "</tbody>");
@@ -1539,39 +1532,30 @@ public abstract class GCParser {
return null;
}
+ final List<TrackableLog> trackableLogs = new ArrayList<TrackableLog>();
+
final Matcher trackableMatcher = GCConstants.PATTERN_TRACKABLE.matcher(page);
while (trackableMatcher.find()) {
if (trackableMatcher.groupCount() > 0) {
- final cgTrackableLog trackableLog = new cgTrackableLog();
-
- if (trackableMatcher.group(1) != null) {
- trackableLog.trackCode = trackableMatcher.group(1);
- } else {
- continue;
- }
- if (trackableMatcher.group(2) != null) {
- trackableLog.name = Html.fromHtml(trackableMatcher.group(2)).toString();
- } else {
- continue;
- }
- if (trackableMatcher.group(3) != null) {
- trackableLog.ctl = Integer.valueOf(trackableMatcher.group(3));
- } else {
- continue;
- }
- if (trackableMatcher.group(5) != null) {
- trackableLog.id = Integer.valueOf(trackableMatcher.group(5));
- } else {
- continue;
- }
- Log.i("Trackable in inventory (#" + trackableLog.ctl + "/" + trackableLog.id + "): " + trackableLog.trackCode + " - " + trackableLog.name);
+ final String trackCode = trackableMatcher.group(1);
+ final String name = Html.fromHtml(trackableMatcher.group(2)).toString();
+ try {
+ final Integer ctl = Integer.valueOf(trackableMatcher.group(3));
+ final Integer id = Integer.valueOf(trackableMatcher.group(5));
+ if (trackCode != null && name != null && ctl != null && id != null) {
+ final TrackableLog entry = new TrackableLog(trackCode, name, id.intValue(), ctl.intValue());
- trackables.add(trackableLog);
+ Log.i("Trackable in inventory (#" + entry.ctl + "/" + entry.id + "): " + entry.trackCode + " - " + entry.name);
+ trackableLogs.add(entry);
+ }
+ } catch (NumberFormatException e) {
+ Log.e("GCParser.parseTrackableLog", e);
+ }
}
}
- return trackables;
+ return trackableLogs;
}
/**
@@ -1594,10 +1578,10 @@ public abstract class GCParser {
//cache.setLogs(loadLogsFromDetails(page, cache, false));
if (Settings.isFriendLogsWanted()) {
CancellableHandler.sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_logs);
- List<cgLog> allLogs = cache.getLogs();
- List<cgLog> friendLogs = loadLogsFromDetails(page, cache, true, false);
+ List<LogEntry> allLogs = cache.getLogs();
+ List<LogEntry> friendLogs = loadLogsFromDetails(page, cache, true, false);
if (friendLogs != null) {
- for (cgLog log : friendLogs) {
+ for (LogEntry log : friendLogs) {
if (allLogs.contains(log)) {
allLogs.get(allLogs.indexOf(log)).friend = true;
} else {
diff --git a/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java b/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java
index 80786f9..4e4d9f7 100644
--- a/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java
+++ b/main/src/cgeo/geocaching/connector/opencaching/OkapiClient.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.connector.opencaching;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgImage;
-import cgeo.geocaching.cgLog;
+import cgeo.geocaching.LogEntry;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
@@ -202,18 +202,18 @@ final public class OkapiClient {
return user.getString(USER_USERNAME);
}
- private static List<cgLog> parseLogs(JSONArray logsJSON) {
- List<cgLog> result = null;
+ private static List<LogEntry> parseLogs(JSONArray logsJSON) {
+ List<LogEntry> result = null;
for (int i = 0; i < logsJSON.length(); i++) {
try {
JSONObject logResponse = logsJSON.getJSONObject(i);
- cgLog log = new cgLog();
+ LogEntry log = new LogEntry();
log.date = parseDate(logResponse.getString(LOG_DATE)).getTime();
log.log = logResponse.getString(LOG_COMMENT).trim();
log.type = parseLogType(logResponse.getString(LOG_TYPE));
log.author = parseUser(logResponse.getJSONObject(LOG_USER));
if (result == null) {
- result = new ArrayList<cgLog>();
+ result = new ArrayList<LogEntry>();
}
result.add(log);
} catch (JSONException e) {
diff --git a/main/src/cgeo/geocaching/export/FieldnoteExport.java b/main/src/cgeo/geocaching/export/FieldnoteExport.java
index f9f13e3..32c9943 100644
--- a/main/src/cgeo/geocaching/export/FieldnoteExport.java
+++ b/main/src/cgeo/geocaching/export/FieldnoteExport.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.export;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgLog;
+import cgeo.geocaching.LogEntry;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.activity.Progress;
@@ -144,7 +144,7 @@ class FieldnoteExport extends AbstractExport {
try {
final cgCache cache = caches.get(i);
if (cache.isLogOffline()) {
- cgLog log = cgeoapplication.getInstance().loadLogOffline(cache.getGeocode());
+ LogEntry log = cgeoapplication.getInstance().loadLogOffline(cache.getGeocode());
if (null != logTypes.get(log.type)) {
fieldNoteBuffer.append(cache.getGeocode())
.append(',')
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index bebbed8..2c833a2 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -2,7 +2,7 @@ package cgeo.geocaching.export;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgLog;
+import cgeo.geocaching.LogEntry;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.activity.Progress;
@@ -209,7 +209,7 @@ class GpxExport extends AbstractExport {
if (cache.getLogs().size() > 0) {
gpx.append("<groundspeak:logs>");
- for (cgLog log : cache.getLogs()) {
+ for (LogEntry log : cache.getLogs()) {
gpx.append("<groundspeak:log id=\"");
gpx.append(log.id);
gpx.append("\">");
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 1706964..051a49b 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -3,7 +3,7 @@ package cgeo.geocaching.files;
import cgeo.geocaching.R;
import cgeo.geocaching.StoredList;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgLog;
+import cgeo.geocaching.LogEntry;
import cgeo.geocaching.cgTrackable;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
@@ -76,7 +76,7 @@ public abstract class GPXParser extends FileParser {
private cgCache cache;
private cgTrackable trackable = new cgTrackable();
- private cgLog log = new cgLog();
+ private LogEntry log = new LogEntry();
private String type = null;
private String sym = null;
@@ -674,7 +674,7 @@ public abstract class GPXParser extends FileParser {
@Override
public void start(Attributes attrs) {
- log = new cgLog();
+ log = new LogEntry();
try {
if (attrs.getIndex("id") > -1) {
diff --git a/tests/src/cgeo/geocaching/cgDestinationTest.java b/tests/src/cgeo/geocaching/DestinationTest.java
index cb5fe45..26caacd 100644
--- a/tests/src/cgeo/geocaching/cgDestinationTest.java
+++ b/tests/src/cgeo/geocaching/DestinationTest.java
@@ -6,14 +6,14 @@ import android.test.AndroidTestCase;
import junit.framework.Assert;
-public class cgDestinationTest extends AndroidTestCase {
+public class DestinationTest extends AndroidTestCase {
- private cgDestination dest = null;
+ private Destination dest = null;
@Override
protected void setUp() throws Exception {
super.setUp();
- dest = new cgDestination(1, 10000, new Geopoint(52.5, 9.33));
+ dest = new Destination(1, 10000, new Geopoint(52.5, 9.33));
}
public void testSomething() {
diff --git a/tests/src/cgeo/geocaching/TrackablesTest.java b/tests/src/cgeo/geocaching/TrackablesTest.java
index e8a1505..3cb34a6 100644
--- a/tests/src/cgeo/geocaching/TrackablesTest.java
+++ b/tests/src/cgeo/geocaching/TrackablesTest.java
@@ -10,16 +10,16 @@ import java.util.List;
public class TrackablesTest extends AbstractResourceInstrumentationTestCase {
public void testLogPageWithTrackables() {
- List<cgTrackableLog> tbLogs = GCParser.parseTrackableLog(getFileContent(R.raw.log_with_2tb));
+ List<TrackableLog> tbLogs = GCParser.parseTrackableLog(getFileContent(R.raw.log_with_2tb));
assertNotNull(tbLogs);
assertEquals(2, tbLogs.size());
- cgTrackableLog log = tbLogs.get(0);
+ TrackableLog log = tbLogs.get(0);
assertEquals("Steffen's Kaiserwagen", log.name);
assertEquals("1QG1EE", log.trackCode);
}
public void testLogPageWithoutTrackables() {
- List<cgTrackableLog> tbLogs = GCParser.parseTrackableLog(getFileContent(R.raw.log_without_tb));
+ List<TrackableLog> tbLogs = GCParser.parseTrackableLog(getFileContent(R.raw.log_without_tb));
assertNotNull(tbLogs);
assertEquals(0, tbLogs.size());
}
@@ -41,16 +41,16 @@ public class TrackablesTest extends AbstractResourceInstrumentationTestCase {
final cgTrackable trackable = getTBXATG();
assertEquals("TBXATG", trackable.getGeocode());
- List<cgLog> log = trackable.getLogs();
+ List<LogEntry> log = trackable.getLogs();
// second log entry has several images; just check first two
- assertEquals("http://img.geocaching.com/track/log/large/f2e24c50-394c-4d74-8fb4-87298d8bff1d.jpg", log.get(1).logImages.get(0).getUrl());
- assertEquals("7b Welcome to Geowoodstock", log.get(1).logImages.get(0).getTitle());
- assertEquals("http://img.geocaching.com/track/log/large/b57c29c3-134e-4202-a2a1-69ce8920b055.jpg", log.get(1).logImages.get(1).getUrl());
- assertEquals("8 Crater Lake Natl Park Oregon", log.get(1).logImages.get(1).getTitle());
+ assertEquals("http://img.geocaching.com/track/log/large/f2e24c50-394c-4d74-8fb4-87298d8bff1d.jpg", log.get(1).getLogImages().get(0).getUrl());
+ assertEquals("7b Welcome to Geowoodstock", log.get(1).getLogImages().get(0).getTitle());
+ assertEquals("http://img.geocaching.com/track/log/large/b57c29c3-134e-4202-a2a1-69ce8920b055.jpg", log.get(1).getLogImages().get(1).getUrl());
+ assertEquals("8 Crater Lake Natl Park Oregon", log.get(1).getLogImages().get(1).getTitle());
// third log entry has one image
- assertEquals("http://img.geocaching.com/track/log/large/0096b42d-4d10-45fa-9be2-2d08c0d5cc61.jpg", log.get(2).logImages.get(0).getUrl());
- assertEquals("Traverski&#39;s GC Univ coin on tour", log.get(2).logImages.get(0).getTitle());
+ assertEquals("http://img.geocaching.com/track/log/large/0096b42d-4d10-45fa-9be2-2d08c0d5cc61.jpg", log.get(2).getLogImages().get(0).getUrl());
+ assertEquals("Traverski&#39;s GC Univ coin on tour", log.get(2).getLogImages().get(0).getTitle());
}
public void testParseTrackableWithoutReleaseDate() {
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index 0b7f396..634c551 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -1,7 +1,7 @@
package cgeo.geocaching.files;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgLog;
+import cgeo.geocaching.LogEntry;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
@@ -129,7 +129,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
assertEquals("Station3: Der zerbrochene Stein zählt doppelt.\nFinal: Oben neben dem Tor", cache.getHint());
// logs
assertEquals(6, cache.getLogs().size());
- final cgLog log = cache.getLogs().get(5);
+ final LogEntry log = cache.getLogs().get(5);
assertEquals("Geoteufel", log.author);
assertEquals(parseTime("2011-09-11T07:00:00Z"), log.date);
assertEquals(-1, log.found);