In TrackRecordingService, fix the code on detecting if a location

is already inserted in the database.
In TripStatisticsUpdater, improve total distance accuracy by
taking into account the last point in a segment.
This commit is contained in:
Jimmy Shih
2012-08-24 17:46:16 -07:00
parent 41278eb137
commit 296cd81167
5 changed files with 47 additions and 55 deletions
@@ -211,13 +211,6 @@ public interface MyTracksProviderUtils {
*/
public Location createTrackPoint(Cursor cursor);
/**
* Gets the last location for a track. Returns null if it doesn't exist.
*
* @param trackId the track id
*/
public Location getLastTrackPoint(long trackId);
/**
* Gets the last location id for a track. Returns -1L if it doesn't exist.
*
@@ -697,17 +697,6 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils {
return location;
}
@Override
public Location getLastTrackPoint(long trackId) {
if (trackId < 0) {
return null;
}
String selection = TrackPointsColumns._ID + "=(select max(" + TrackPointsColumns._ID + ") from "
+ TrackPointsColumns.TABLE_NAME + " WHERE " + TrackPointsColumns.TRACKID + "=?)";
String[] selectionArgs = new String[] { Long.toString(trackId) };
return findTrackPointBy(selection, selectionArgs);
}
@Override
public long getLastTrackPointId(long trackId) {
if (trackId < 0) {