forked from upstream-mirrors/OpenTracks
Cleanup: ContentProviderUtils.getMarkerCursor() had an unused parameter.
This commit is contained in:
@@ -25,7 +25,6 @@ import android.net.Uri;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -434,20 +433,16 @@ public class ContentProviderUtils {
|
|||||||
/**
|
/**
|
||||||
* The caller owns the returned cursor and is responsible for closing it.
|
* The caller owns the returned cursor and is responsible for closing it.
|
||||||
*
|
*
|
||||||
* @param trackId the track id
|
* @param trackId the track id
|
||||||
* @param minMarkerId the minimum marker id. null to ignore
|
* @param maxCount the maximum number of markers to return. -1 for no limit
|
||||||
* @param maxCount the maximum number of markers to return. -1 for no limit
|
|
||||||
*/
|
*/
|
||||||
public Cursor getMarkerCursor(@NonNull Track.Id trackId, @Nullable Marker.Id minMarkerId, int maxCount) {
|
public Cursor getMarkerCursor(@NonNull Track.Id trackId, int maxCount) {
|
||||||
String selection;
|
String selection;
|
||||||
String[] selectionArgs;
|
String[] selectionArgs;
|
||||||
if (minMarkerId != null) {
|
|
||||||
selection = MarkerColumns.TRACKID + "=? AND " + MarkerColumns._ID + ">=?";
|
selection = MarkerColumns.TRACKID + "=?";
|
||||||
selectionArgs = new String[]{Long.toString(trackId.id()), Long.toString(minMarkerId.id())};
|
selectionArgs = new String[]{Long.toString(trackId.id())};
|
||||||
} else {
|
|
||||||
selection = MarkerColumns.TRACKID + "=?";
|
|
||||||
selectionArgs = new String[]{Long.toString(trackId.id())};
|
|
||||||
}
|
|
||||||
return getMarkerCursor(null, selection, selectionArgs, MarkerColumns._ID, maxCount);
|
return getMarkerCursor(null, selection, selectionArgs, MarkerColumns._ID, maxCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +450,7 @@ public class ContentProviderUtils {
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public List<Marker> getMarkers(Track.Id trackId) {
|
public List<Marker> getMarkers(Track.Id trackId) {
|
||||||
ArrayList<Marker> markers = new ArrayList<>();
|
ArrayList<Marker> markers = new ArrayList<>();
|
||||||
try (Cursor cursor = getMarkerCursor(trackId, null, -1)) {
|
try (Cursor cursor = getMarkerCursor(trackId, -1)) {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
markers.add(createMarker(cursor));
|
markers.add(createMarker(cursor));
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public class TrackDataHub {
|
|||||||
trackDataListener.clearMarkers();
|
trackDataListener.clearMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
try (Cursor cursor = contentProviderUtils.getMarkerCursor(selectedTrackId, null, MAX_DISPLAYED_MARKERS)) {
|
try (Cursor cursor = contentProviderUtils.getMarkerCursor(selectedTrackId, MAX_DISPLAYED_MARKERS)) {
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
Marker marker = contentProviderUtils.createMarker(cursor);
|
Marker marker = contentProviderUtils.createMarker(cursor);
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ public class GPXTrackExporter implements TrackExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void writeMarkers(Track track) throws InterruptedException {
|
private void writeMarkers(Track track) throws InterruptedException {
|
||||||
try (Cursor cursor = contentProviderUtils.getMarkerCursor(track.getId(), null, -1)) {
|
try (Cursor cursor = contentProviderUtils.getMarkerCursor(track.getId(), -1)) {
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
for (int i = 0; i < cursor.getCount(); i++) {
|
for (int i = 0; i < cursor.getCount(); i++) {
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class KMLTrackExporter implements TrackExporter {
|
|||||||
|
|
||||||
private void writeMarkers(Track track) throws InterruptedException {
|
private void writeMarkers(Track track) throws InterruptedException {
|
||||||
boolean hasMarkers = false;
|
boolean hasMarkers = false;
|
||||||
try (Cursor cursor = contentProviderUtils.getMarkerCursor(track.getId(), null, -1)) {
|
try (Cursor cursor = contentProviderUtils.getMarkerCursor(track.getId(), -1)) {
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
for (int i = 0; i < cursor.getCount(); i++) {
|
for (int i = 0; i < cursor.getCount(); i++) {
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class KMZTrackExporter implements TrackExporter {
|
|||||||
|
|
||||||
private void addImages(Context context, List<Track> tracks, ZipOutputStream zipOutputStream) throws InterruptedException, IOException {
|
private void addImages(Context context, List<Track> tracks, ZipOutputStream zipOutputStream) throws InterruptedException, IOException {
|
||||||
for (Track track : tracks) {
|
for (Track track : tracks) {
|
||||||
try (Cursor cursor = contentProviderUtils.getMarkerCursor(track.getId(), null, -1)) {
|
try (Cursor cursor = contentProviderUtils.getMarkerCursor(track.getId(), -1)) {
|
||||||
if (cursor != null && cursor.moveToFirst()) {
|
if (cursor != null && cursor.moveToFirst()) {
|
||||||
for (int i = 0; i < cursor.getCount(); i++) {
|
for (int i = 0; i < cursor.getCount(); i++) {
|
||||||
if (Thread.interrupted()) {
|
if (Thread.interrupted()) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class MarkerDetailActivity extends AbstractActivity implements DeleteMark
|
|||||||
Marker marker = contentProviderUtils.getMarker(markerId);
|
Marker marker = contentProviderUtils.getMarker(markerId);
|
||||||
|
|
||||||
//TODO only load used data: ID + name
|
//TODO only load used data: ID + name
|
||||||
cursor = contentProviderUtils.getMarkerCursor(marker.getTrackId(), null, -1);
|
cursor = contentProviderUtils.getMarkerCursor(marker.getTrackId(), -1);
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user