forked from upstream-mirrors/OpenTracks
Update TrackRecordingService.
This commit is contained in:
@@ -174,6 +174,13 @@ public interface MyTracksProviderUtils {
|
||||
*/
|
||||
public long getLastWaypointId(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the last statistics waypoint for a track. Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
public Waypoint getLastStatisticsWaypoint(long trackId);
|
||||
|
||||
/**
|
||||
* Gets the next marker number. Returns -1 if not able to get the next marker
|
||||
* number.
|
||||
|
||||
+23
@@ -443,6 +443,29 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
|
||||
return -1L;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Waypoint getLastStatisticsWaypoint(long trackId) {
|
||||
if (trackId < 0) {
|
||||
return null;
|
||||
}
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
String selection = WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns.TYPE + "="
|
||||
+ Waypoint.TYPE_STATISTICS;
|
||||
String[] selectionArgs = new String[] { Long.toString(trackId) };
|
||||
cursor = getWaypointsCursor(
|
||||
null, selection, selectionArgs, WaypointsColumns._ID + " DESC", 1);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
return createWaypoint(cursor);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNextMarkerNumber(long trackId, boolean statistics) {
|
||||
if (trackId < 0) {
|
||||
|
||||
Reference in New Issue
Block a user