diff --git a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java index cbc6f8271..e471a9144 100644 --- a/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java +++ b/src/main/java/de/dennisguse/opentracks/services/TrackRecordingService.java @@ -75,7 +75,17 @@ public TrackRecordingService getService() { private final Runnable updateRecordingData = new Runnable() { @Override public void run() { - updateRecordingDataWhileRecording(); + if (!isRecording()) { + Log.w(TAG, "Currently not recording; cannot update data."); + return; + } + + // Compute temporary track statistics using sensorData and update time. + Pair> data = trackRecordingManager.getDataForUI(); + + voiceAnnouncementManager.announceStatisticsIfNeeded(data.first); + + recordingDataObservable.postValue(new RecordingData(data.first, data.second.first, data.second.second)); TrackRecordingService.this.handler.postDelayed(this, RECORDING_DATA_UPDATE_INTERVAL.toMillis()); } @@ -305,20 +315,6 @@ public LiveData getRecordingDataObservable() { return recordingDataObservable; } - private void updateRecordingDataWhileRecording() { - if (!isRecording()) { - Log.w(TAG, "Currently not recording; cannot update data."); - return; - } - - // Compute temporary track statistics using sensorData and update time. - Pair> data = trackRecordingManager.getDataForUI(); - - voiceAnnouncementManager.announceStatisticsIfNeeded(data.first); - - recordingDataObservable.postValue(new RecordingData(data.first, data.second.first, data.second.second)); - } - public void onIdle() { voiceAnnouncementManager.announceIdle(); }