forked from upstream-mirrors/OpenTracks
Bug fixing and refactoring:
1) Make sure no one but service changes recordingTrackId (which is owned by it) 2) Cache sharedPreferences 3) Clear recordingTrackId if it doesn't correspond to a valid track or the service is not recording 4) More unit tests
This commit is contained in:
@@ -702,7 +702,7 @@ public class MyTracksMap extends MapActivity
|
||||
*/
|
||||
public void setSelectedTrack(final long trackId) {
|
||||
Log.d(MyTracksConstants.TAG, "MyTracksMap.setSelectedTrack: "
|
||||
+ "id = " + trackId + ", selectedTrackId = " + selectedTrackId);
|
||||
+ selectedTrackId + " -> " + trackId);
|
||||
|
||||
if (selectedTrackId == trackId) {
|
||||
// Selected track did not change, nothing to do.
|
||||
@@ -1000,15 +1000,18 @@ public class MyTracksMap extends MapActivity
|
||||
if (key == null || key.equals(getString(R.string.recording_track_key))) {
|
||||
recordingTrackId = sharedPreferences.getLong(
|
||||
getString(R.string.recording_track_key), -1);
|
||||
if (isATrackSelected()) {
|
||||
mapOverlay.setShowEndMarker(!isRecordingSelected());
|
||||
mapView.postInvalidate();
|
||||
}
|
||||
}
|
||||
if (key == null || key.equals(getString(R.string.selected_track_key))) {
|
||||
setSelectedTrack(sharedPreferences.getLong(
|
||||
getString(R.string.selected_track_key), -1));
|
||||
}
|
||||
|
||||
// Show end marker if the track has been selected and is no recording.
|
||||
// Note: This check must be *after* a call to setSelectedTrack(...) above.
|
||||
if (isATrackSelected()) {
|
||||
mapOverlay.setShowEndMarker(!isRecordingSelected());
|
||||
mapView.postInvalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void readAllNewTrackPoints() {
|
||||
|
||||
Reference in New Issue
Block a user