This commit is contained in:
Dennis Guse
2021-03-05 18:46:17 +01:00
parent 815b6a3cf1
commit 26e655d58f
2 changed files with 7 additions and 27 deletions
@@ -579,24 +579,6 @@ public class ContentProviderUtils {
return contentResolver.bulkInsert(TrackPointsColumns.CONTENT_URI_BY_ID, values);
}
/**
* Gets the first location id for a track.
* Returns null if it doesn't exist.
*
* @param trackId the track id
*/
@Deprecated
public Track.Id getFirstTrackPointId(Track.Id trackId) {
String selection = TrackPointsColumns._ID + "=(SELECT MIN(" + TrackPointsColumns._ID + ") FROM " + TrackPointsColumns.TABLE_NAME + " WHERE " + TrackPointsColumns.TRACKID + "=?)";
String[] selectionArgs = new String[]{Long.toString(trackId.getId())};
try (Cursor cursor = getTrackPointCursor(new String[]{TrackPointsColumns._ID}, selection, selectionArgs, TrackPointsColumns._ID)) {
if (cursor != null && cursor.moveToFirst()) {
return new Track.Id(cursor.getLong(cursor.getColumnIndexOrThrow(TrackPointsColumns._ID)));
}
}
return null;
}
/**
* Gets the last location id for a track.
* Returns -1L if it doesn't exist.
@@ -123,7 +123,7 @@ public class GPXTrackExporter implements TrackExporter {
TrackPoint trackPoint = trackPointIterator.next();
if (!wroteTrack) {
writeBeginTrack(track, trackPoint);
writeBeginTrack(track);
wroteTrack = true;
}
@@ -162,14 +162,12 @@ public class GPXTrackExporter implements TrackExporter {
writeCloseSegment();
}
if (wroteTrack) {
TrackPoint lastValidTrackPoint = contentProviderUtils.getLastValidTrackPoint(track.getId());
writeEndTrack(track, lastValidTrackPoint);
} else {
if (!wroteTrack) {
// Write an empty track
writeBeginTrack(track, null);
writeEndTrack(track, null);
writeBeginTrack(track);
}
writeEndTrack();
}
}
@@ -247,7 +245,7 @@ public class GPXTrackExporter implements TrackExporter {
}
}
public void writeBeginTrack(Track track, TrackPoint startTrackPoint) {
public void writeBeginTrack(Track track) {
if (printWriter != null) {
printWriter.println("<trk>");
printWriter.println("<name>" + StringUtils.formatCData(track.getName()) + "</name>");
@@ -261,7 +259,7 @@ public class GPXTrackExporter implements TrackExporter {
}
}
public void writeEndTrack(Track track, TrackPoint endTrackPoint) {
public void writeEndTrack() {
if (printWriter != null) {
printWriter.println("</trk>");
}