TrackRecordingManager: do not store sensor distance twice (previous TrackPoint's storage was delayed).

Fixes #969.
This commit is contained in:
Dennis Guse
2021-10-07 22:51:06 +02:00
parent f6b994572a
commit 90493ae498
4 changed files with 17 additions and 8 deletions
@@ -349,6 +349,13 @@ public class TrackPoint {
return this;
}
public TrackPoint minusSensorDistance(@NonNull TrackPoint lastTrackPoint) {
if (hasSensorDistance() && lastTrackPoint.hasSensorDistance()) {
setSensorDistance(getSensorDistance().minus(lastTrackPoint.getSensorDistance()));
}
return this;
}
public boolean hasSensorData() {
return hasHeartRate() || hasCyclingCadence() || hasPower();
}
@@ -396,10 +403,9 @@ public class TrackPoint {
@Override
public String toString() {
String result = "time=" + getTime() + " (type=" + getType() + ")";
if (!hasLocation()) {
return result;
if (hasLocation()) {
result += ": lat=" + getLatitude() + " lng=" + getLongitude();
}
result += ": lat=" + getLatitude() + " lng=" + getLongitude();
if (hasHorizontalAccuracy()) {
result += " acc=" + getHorizontalAccuracy();
}