forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -292,15 +292,9 @@ public class CustomContentProvider extends ContentProvider {
|
|||||||
public int update(@NonNull Uri url, ContentValues values, String where, String[] selectionArgs) {
|
public int update(@NonNull Uri url, ContentValues values, String where, String[] selectionArgs) {
|
||||||
String table;
|
String table;
|
||||||
switch (getUrlType(url)) {
|
switch (getUrlType(url)) {
|
||||||
case TRACKPOINTS -> {
|
case TRACKPOINTS -> table = TrackPointsColumns.TABLE_NAME;
|
||||||
table = TrackPointsColumns.TABLE_NAME;
|
case TRACKS -> table = TracksColumns.TABLE_NAME;
|
||||||
}
|
case MARKERS -> table = MarkerColumns.TABLE_NAME;
|
||||||
case TRACKS -> {
|
|
||||||
table = TracksColumns.TABLE_NAME;
|
|
||||||
}
|
|
||||||
case MARKERS -> {
|
|
||||||
table = MarkerColumns.TABLE_NAME;
|
|
||||||
}
|
|
||||||
default -> throw new IllegalArgumentException("Unknown url " + url);
|
default -> throw new IllegalArgumentException("Unknown url " + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import de.dennisguse.opentracks.settings.UnitSystem;
|
|||||||
|
|
||||||
public record Distance(double distance_m) {
|
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) {
|
public static Distance of(double distance_m) {
|
||||||
return new Distance(distance_m);
|
return new Distance(distance_m);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import de.dennisguse.opentracks.settings.UnitSystem;
|
|||||||
|
|
||||||
public record Speed(double speed_mps) {
|
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) {
|
public static Speed of(Distance distance, Duration duration) {
|
||||||
if (duration.isZero()) {
|
if (duration.isZero()) {
|
||||||
@@ -20,11 +20,6 @@ public record Speed(double speed_mps) {
|
|||||||
return new Speed(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) {
|
public static Speed ofKMH(double speed_kmh) {
|
||||||
return of(Distance.ofKilometer(speed_kmh), Duration.ofHours(1));
|
return of(Distance.ofKilometer(speed_kmh), Duration.ofHours(1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ public class GPXTrackImporter extends DefaultHandler implements XMLImporter.Trac
|
|||||||
|
|
||||||
if (speed != null) {
|
if (speed != null) {
|
||||||
try {
|
try {
|
||||||
speedParsed = Speed.of(speed);
|
speedParsed = Speed.of(Float.parseFloat(speed));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throw new ParsingException(createErrorMessage(String.format(Locale.US, "Unable to parse speed: %s", speed)), 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
|
// Store Markers
|
||||||
updateMarkers(trackId);
|
updateMarkers(trackId);
|
||||||
|
|
||||||
contentProviderUtils.bulkInsertMarkers(markers.stream().map(it -> it.getMarker()).toList(), trackId);
|
contentProviderUtils.bulkInsertMarkers(markers.stream().map(MarkerBuilder::getMarker).toList(), trackId);
|
||||||
|
|
||||||
//Clear up.
|
//Clear up.
|
||||||
trackPoints.clear();
|
trackPoints.clear();
|
||||||
@@ -248,7 +248,7 @@ public class TrackImporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class TrackData {
|
private static class TrackData {
|
||||||
private String name;
|
private String name;
|
||||||
private UUID uuid;
|
private UUID uuid;
|
||||||
private String description;
|
private String description;
|
||||||
|
|||||||
Reference in New Issue
Block a user