forked from upstream-mirrors/OpenTracks
Bugfix: GPS-based data in UI should not drop back to zero.
Likely introduced b9ed5e28e0.
This commit is contained in:
@@ -107,7 +107,9 @@ public class TrackPointCreator implements SharedPreferences.OnSharedPreferenceCh
|
||||
public Pair<TrackPoint, SensorDataSet> createCurrentTrackPoint(@Nullable TrackPoint lastTrackPointUISpeed, @Nullable TrackPoint lastTrackPointUIAltitude, @Nullable TrackPoint lastStoredTrackPointWithLocation) {
|
||||
TrackPoint currentTrackPoint = new TrackPoint(TrackPoint.Type.TRACKPOINT, createNow());
|
||||
|
||||
if (lastStoredTrackPointWithLocation != null && lastStoredTrackPointWithLocation.hasLocation()) {
|
||||
SensorDataSet sensorDataSet = addSensorData(currentTrackPoint);
|
||||
|
||||
if (!currentTrackPoint.hasLocation() && lastStoredTrackPointWithLocation != null && lastStoredTrackPointWithLocation.hasLocation()) {
|
||||
//We are taking the coordinates from the last stored TrackPoint, so the distance is monotonously increasing.
|
||||
currentTrackPoint.setPosition(lastStoredTrackPointWithLocation.getPosition());
|
||||
}
|
||||
@@ -120,8 +122,6 @@ public class TrackPointCreator implements SharedPreferences.OnSharedPreferenceCh
|
||||
currentTrackPoint.setAltitude(lastTrackPointUIAltitude.getAltitude());
|
||||
}
|
||||
|
||||
SensorDataSet sensorDataSet = addSensorData(currentTrackPoint);
|
||||
|
||||
return new Pair<>(currentTrackPoint, sensorDataSet);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user