Update TrackRecordingService.

This commit is contained in:
Jimmy Shih
2012-08-08 18:52:08 -07:00
parent 40e2aba739
commit dc9173e015
7 changed files with 938 additions and 1098 deletions
@@ -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.
@@ -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) {