forked from upstream-mirrors/OpenTracks
Cleanup: removed method that was only used for testing in ContentProviderUtils.
This commit is contained in:
@@ -634,32 +634,13 @@ public class ContentProviderUtils {
|
||||
return contentResolver.bulkInsert(MarkerColumns.CONTENT_URI, values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last valid location for a track.
|
||||
* Returns null if it doesn't exist.
|
||||
*
|
||||
* @param trackId the track id
|
||||
*/
|
||||
@VisibleForTesting
|
||||
@Deprecated // Use TrackPointIterator to fetch all TrackPoints and use the last.
|
||||
public TrackPoint getLastValidTrackPoint(Track.Id trackId) {
|
||||
String selection = TrackPointsColumns._ID + "=(SELECT MAX(" + TrackPointsColumns._ID + ") FROM " + TrackPointsColumns.TABLE_NAME + " WHERE " + TrackPointsColumns.TRACKID + "=? AND " + TrackPointsColumns.TYPE + " IN (" + TrackPoint.Type.SEGMENT_START_AUTOMATIC.type_db + "," + TrackPoint.Type.TRACKPOINT.type_db + "))";
|
||||
String[] selectionArgs = new String[]{Long.toString(trackId.id())};
|
||||
|
||||
try (Cursor cursor = getTrackPointCursor(null, selection, selectionArgs, TrackPointsColumns._ID)) {
|
||||
if (cursor != null && cursor.moveToNext()) {
|
||||
return createTrackPoint(cursor);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link TrackPoint} object from a cursor.
|
||||
*
|
||||
* @param cursor the cursor pointing to the location
|
||||
*/
|
||||
public TrackPoint createTrackPoint(Cursor cursor) {
|
||||
@VisibleForTesting
|
||||
TrackPoint createTrackPoint(Cursor cursor) {
|
||||
return fillTrackPoint(cursor, new CachedTrackPointsIndexes(cursor));
|
||||
}
|
||||
|
||||
@@ -670,7 +651,7 @@ public class ContentProviderUtils {
|
||||
* @param startTrackPointId the starting trackPoint id. `null` to ignore
|
||||
*/
|
||||
@NonNull
|
||||
public Cursor getTrackPointCursor(@NonNull Track.Id trackId, TrackPoint.Id startTrackPointId) {
|
||||
Cursor getTrackPointCursor(@NonNull Track.Id trackId, TrackPoint.Id startTrackPointId) {
|
||||
String selection;
|
||||
String[] selectionArgs;
|
||||
if (startTrackPointId != null) {
|
||||
|
||||
@@ -130,6 +130,7 @@ public class TrackPoint {
|
||||
return type == Type.SEGMENT_END_MANUAL;
|
||||
}
|
||||
|
||||
//TODO Check if naming is correct.
|
||||
public boolean wasCreatedManually() {
|
||||
return hasLocation() || hasSpeed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user