forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -579,24 +579,6 @@ public class ContentProviderUtils {
|
|||||||
return contentResolver.bulkInsert(TrackPointsColumns.CONTENT_URI_BY_ID, values);
|
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.
|
* Gets the last location id for a track.
|
||||||
* Returns -1L if it doesn't exist.
|
* Returns -1L if it doesn't exist.
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class GPXTrackExporter implements TrackExporter {
|
|||||||
TrackPoint trackPoint = trackPointIterator.next();
|
TrackPoint trackPoint = trackPointIterator.next();
|
||||||
|
|
||||||
if (!wroteTrack) {
|
if (!wroteTrack) {
|
||||||
writeBeginTrack(track, trackPoint);
|
writeBeginTrack(track);
|
||||||
wroteTrack = true;
|
wroteTrack = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,14 +162,12 @@ public class GPXTrackExporter implements TrackExporter {
|
|||||||
writeCloseSegment();
|
writeCloseSegment();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wroteTrack) {
|
if (!wroteTrack) {
|
||||||
TrackPoint lastValidTrackPoint = contentProviderUtils.getLastValidTrackPoint(track.getId());
|
|
||||||
writeEndTrack(track, lastValidTrackPoint);
|
|
||||||
} else {
|
|
||||||
// Write an empty track
|
// Write an empty track
|
||||||
writeBeginTrack(track, null);
|
writeBeginTrack(track);
|
||||||
writeEndTrack(track, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
if (printWriter != null) {
|
||||||
printWriter.println("<trk>");
|
printWriter.println("<trk>");
|
||||||
printWriter.println("<name>" + StringUtils.formatCData(track.getName()) + "</name>");
|
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) {
|
if (printWriter != null) {
|
||||||
printWriter.println("</trk>");
|
printWriter.println("</trk>");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user