Skip to content

Commit

Permalink
Merge pull request #16 from OmniaAlam/dev/Rakibul
Browse files Browse the repository at this point in the history
#14 Refactored updateRecordingDataWhileRecording method for encapsula…
  • Loading branch information
OmniaAlam authored Feb 14, 2024
2 parents f7e2b78 + 5d56e8a commit 5bb94f6
Showing 1 changed file with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Track, Pair<TrackPoint, SensorDataSet>> 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());
}
Expand Down Expand Up @@ -305,20 +315,6 @@ public LiveData<RecordingData> 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<Track, Pair<TrackPoint, SensorDataSet>> data = trackRecordingManager.getDataForUI();

voiceAnnouncementManager.announceStatisticsIfNeeded(data.first);

recordingDataObservable.postValue(new RecordingData(data.first, data.second.first, data.second.second));
}

public void onIdle() {
voiceAnnouncementManager.announceIdle();
}
Expand Down

0 comments on commit 5bb94f6

Please sign in to comment.