forked from upstream-mirrors/OpenTracks
Cleanup: removed unnecessary interface from ContentProviderUtils.
This commit is contained in:
@@ -72,11 +72,6 @@ public class ContentProviderUtils {
|
|||||||
|
|
||||||
private final ContentResolver contentResolver;
|
private final ContentResolver contentResolver;
|
||||||
|
|
||||||
//TODO Check if this can be used in more than one place. If not remove.
|
|
||||||
public interface ContentProviderSelectionInterface {
|
|
||||||
SelectionData buildSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContentProviderUtils(Context context) {
|
public ContentProviderUtils(Context context) {
|
||||||
contentResolver = context.getContentResolver();
|
contentResolver = context.getContentResolver();
|
||||||
}
|
}
|
||||||
@@ -746,7 +741,7 @@ public class ContentProviderUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public List<AggregatedStatistic> getAggregatedStatisticsForTracks(ContentProviderSelectionInterface selection) {
|
public List<AggregatedStatistic> getAggregatedStatisticsForTracks(TrackSelection selection) {
|
||||||
SelectionData data = selection.buildSelection();
|
SelectionData data = selection.buildSelection();
|
||||||
try (Cursor cursor = contentResolver.query(TracksColumns.CONTENT_URI_AGGREGATED_STATISTICS, null, data.selection(), data.getSelectionArgs(), null)) {
|
try (Cursor cursor = contentResolver.query(TracksColumns.CONTENT_URI_AGGREGATED_STATISTICS, null, data.selection(), data.getSelectionArgs(), null)) {
|
||||||
ArrayList<AggregatedStatistic> aggregatedStatistics = new ArrayList<>(cursor.getCount());
|
ArrayList<AggregatedStatistic> aggregatedStatistics = new ArrayList<>(cursor.getCount());
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
import de.dennisguse.opentracks.data.models.Track;
|
import de.dennisguse.opentracks.data.models.Track;
|
||||||
import de.dennisguse.opentracks.data.tables.TracksColumns;
|
import de.dennisguse.opentracks.data.tables.TracksColumns;
|
||||||
|
|
||||||
public class TrackSelection implements ContentProviderUtils.ContentProviderSelectionInterface {
|
public class TrackSelection {
|
||||||
private final List<Track.Id> trackIds = new ArrayList<>();
|
private final List<Track.Id> trackIds = new ArrayList<>();
|
||||||
private final List<String> categories = new ArrayList<>();
|
private final List<String> categories = new ArrayList<>();
|
||||||
private Instant from;
|
private Instant from;
|
||||||
@@ -40,7 +40,6 @@ public class TrackSelection implements ContentProviderUtils.ContentProviderSelec
|
|||||||
return trackIds.isEmpty() && categories.isEmpty() && from == null && to == null;
|
return trackIds.isEmpty() && categories.isEmpty() && from == null && to == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ContentProviderUtils.SelectionData buildSelection() {
|
public ContentProviderUtils.SelectionData buildSelection() {
|
||||||
String selection = "";
|
String selection = "";
|
||||||
List<String> selectionArgs = new ArrayList<>();
|
List<String> selectionArgs = new ArrayList<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user