forked from upstream-mirrors/OpenTracks
Fix total time stats when stopping a track during a pause.
This commit is contained in:
@@ -692,13 +692,14 @@ public class TrackRecordingService extends Service {
|
|||||||
|
|
||||||
// Need to remember the recordingTrackId before setting it to -1L
|
// Need to remember the recordingTrackId before setting it to -1L
|
||||||
long trackId = recordingTrackId;
|
long trackId = recordingTrackId;
|
||||||
|
boolean paused = recordingTrackPaused;
|
||||||
|
|
||||||
// Update shared preferences
|
// Update shared preferences
|
||||||
updateRecordingState(PreferencesUtils.RECORDING_TRACK_ID_DEFAULT, true);
|
updateRecordingState(PreferencesUtils.RECORDING_TRACK_ID_DEFAULT, true);
|
||||||
|
|
||||||
// Update database
|
// Update database
|
||||||
Track track = myTracksProviderUtils.getTrack(trackId);
|
Track track = myTracksProviderUtils.getTrack(trackId);
|
||||||
if (track != null) {
|
if (track != null && !paused) {
|
||||||
insertLocation(track, lastLocation, getLastValidTrackPointInCurrentSegment(trackId));
|
insertLocation(track, lastLocation, getLastValidTrackPointInCurrentSegment(trackId));
|
||||||
updateRecordingTrack(track, myTracksProviderUtils.getLastTrackPointId(trackId), false);
|
updateRecordingTrack(track, myTracksProviderUtils.getLastTrackPointId(trackId), false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user