forked from upstream-mirrors/OpenTracks
Cleanup: do not assume first waypoint contains (always) TripStatistics.
This commit is contained in:
@@ -99,7 +99,7 @@ public class FileTrackExporter implements TrackExporter {
|
||||
try (Cursor cursor = contentProviderUtils.getWaypointCursor(track.getId(), -1L, ContentProviderUtils.MAX_LOADED_WAYPOINTS_POINTS)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
// Intentionally skip first waypoint (contains statistics).
|
||||
while (cursor.moveToNext()) {
|
||||
for (int i = 0; i < cursor.getCount(); i++) {
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
@@ -108,7 +108,11 @@ public class FileTrackExporter implements TrackExporter {
|
||||
hasWaypoints = true;
|
||||
}
|
||||
Waypoint waypoint = contentProviderUtils.createWaypoint(cursor);
|
||||
trackWriter.writeWaypoint(waypoint);
|
||||
if (!waypoint.isTripStatistics()) {
|
||||
trackWriter.writeWaypoint(waypoint);
|
||||
}
|
||||
|
||||
cursor.moveToNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +103,7 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
for (Track track : tracks) {
|
||||
try (Cursor cursor = contentProviderUtils.getWaypointCursor(track.getId(), -1L, -1)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
/*
|
||||
* Yes, this will skip the first waypoint and that is intentional as
|
||||
* the first waypoint holds the stats for the track.
|
||||
*/
|
||||
while (cursor.moveToNext()) {
|
||||
for (int i = 0; i < cursor.getCount(); i++) {
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
@@ -115,6 +111,8 @@ public class KmzTrackExporter implements TrackExporter {
|
||||
if (waypoint.hasPhoto()) {
|
||||
addImage(context, zipOutputStream, waypoint.getPhotoUrl());
|
||||
}
|
||||
|
||||
cursor.moveToNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user