forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -77,20 +77,6 @@ public class ContentProviderUtils {
|
|||||||
this.contentResolver = contentResolver;
|
this.contentResolver = contentResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears a track: removes markers and trackPoints.
|
|
||||||
* Only keeps the track id.
|
|
||||||
*
|
|
||||||
* @param trackId the track id
|
|
||||||
*/
|
|
||||||
@Deprecated //TODO Figure out why we need this.
|
|
||||||
public void clearTrack(Track.Id trackId) {
|
|
||||||
deleteTrackPointsAndMarkers(trackId);
|
|
||||||
Track track = new Track();
|
|
||||||
track.setId(trackId);
|
|
||||||
updateTrack(track);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link Track} from a cursor.
|
* Creates a {@link Track} from a cursor.
|
||||||
*
|
*
|
||||||
@@ -197,13 +183,7 @@ public class ContentProviderUtils {
|
|||||||
contentResolver.delete(TracksColumns.CONTENT_URI, TracksColumns._ID + "=?", new String[]{Long.toString(trackId.getId())});
|
contentResolver.delete(TracksColumns.CONTENT_URI, TracksColumns._ID + "=?", new String[]{Long.toString(trackId.getId())});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteTrackPointsAndMarkers(@NonNull Track.Id trackId) {
|
//TODO Only use for tests; also move to tests.
|
||||||
String[] selectionArgs = new String[]{Long.toString(trackId.getId())};
|
|
||||||
|
|
||||||
contentResolver.delete(TrackPointsColumns.CONTENT_URI_BY_ID, TrackPointsColumns.TRACKID + "=?", selectionArgs);
|
|
||||||
contentResolver.delete(MarkerColumns.CONTENT_URI, MarkerColumns.TRACKID + "=?", selectionArgs);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Track> getTracks() {
|
public List<Track> getTracks() {
|
||||||
ArrayList<Track> tracks = new ArrayList<>();
|
ArrayList<Track> tracks = new ArrayList<>();
|
||||||
try (Cursor cursor = getTrackCursor(null, null, TracksColumns._ID)) {
|
try (Cursor cursor = getTrackCursor(null, null, TracksColumns._ID)) {
|
||||||
@@ -437,7 +417,8 @@ public class ContentProviderUtils {
|
|||||||
return markers;
|
return markers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated //TODO TracksColumns.MARKER_COUNT while querying for tracks
|
//TODO Move to testing package
|
||||||
|
@Deprecated
|
||||||
public int getMarkerCount(Track.Id trackId) {
|
public int getMarkerCount(Track.Id trackId) {
|
||||||
String[] projection = new String[]{"count(*) AS count"};
|
String[] projection = new String[]{"count(*) AS count"};
|
||||||
String selection = MarkerColumns.TRACKID + "=?";
|
String selection = MarkerColumns.TRACKID + "=?";
|
||||||
|
|||||||
Reference in New Issue
Block a user