This commit is contained in:
Dennis Guse
2025-12-06 08:45:52 +01:00
parent 2cab394d03
commit 2f90784442
5 changed files with 8 additions and 19 deletions
@@ -292,15 +292,9 @@ public class CustomContentProvider extends ContentProvider {
public int update(@NonNull Uri url, ContentValues values, String where, String[] selectionArgs) {
String table;
switch (getUrlType(url)) {
case TRACKPOINTS -> {
table = TrackPointsColumns.TABLE_NAME;
}
case TRACKS -> {
table = TracksColumns.TABLE_NAME;
}
case MARKERS -> {
table = MarkerColumns.TABLE_NAME;
}
case TRACKPOINTS -> table = TrackPointsColumns.TABLE_NAME;
case TRACKS -> table = TracksColumns.TABLE_NAME;
case MARKERS -> table = MarkerColumns.TABLE_NAME;
default -> throw new IllegalArgumentException("Unknown url " + url);
}
@@ -7,7 +7,7 @@ import de.dennisguse.opentracks.settings.UnitSystem;
public record Distance(double distance_m) {
public static Distance ZERO = Distance.of(0);
public static final Distance ZERO = Distance.of(0);
public static Distance of(double distance_m) {
return new Distance(distance_m);
@@ -6,7 +6,7 @@ import de.dennisguse.opentracks.settings.UnitSystem;
public record Speed(double speed_mps) {
public static Speed ZERO = Speed.of(0);
public static final Speed ZERO = Speed.of(0);
public static Speed of(Distance distance, Duration duration) {
if (duration.isZero()) {
@@ -20,11 +20,6 @@ public record Speed(double speed_mps) {
return new Speed(speed_mps);
}
@Deprecated //TODO Remove
public static Speed of(String speed_mps) {
return of(Float.parseFloat(speed_mps));
}
public static Speed ofKMH(double speed_kmh) {
return of(Distance.ofKilometer(speed_kmh), Duration.ofHours(1));
}
@@ -326,7 +326,7 @@ public class GPXTrackImporter extends DefaultHandler implements XMLImporter.Trac
if (speed != null) {
try {
speedParsed = Speed.of(speed);
speedParsed = Speed.of(Float.parseFloat(speed));
} catch (NumberFormatException e) {
throw new ParsingException(createErrorMessage(String.format(Locale.US, "Unable to parse speed: %s", speed)), e);
}
@@ -159,7 +159,7 @@ public class TrackImporter {
// Store Markers
updateMarkers(trackId);
contentProviderUtils.bulkInsertMarkers(markers.stream().map(it -> it.getMarker()).toList(), trackId);
contentProviderUtils.bulkInsertMarkers(markers.stream().map(MarkerBuilder::getMarker).toList(), trackId);
//Clear up.
trackPoints.clear();
@@ -248,7 +248,7 @@ public class TrackImporter {
}
private class TrackData {
private static class TrackData {
private String name;
private UUID uuid;
private String description;