forked from upstream-mirrors/OpenTracks
Fixing clearing of stats at the start of recording.
This commit is contained in:
@@ -83,6 +83,8 @@ public class StatsUtilities {
|
|||||||
public void setText(int id, double d, NumberFormat format) {
|
public void setText(int id, double d, NumberFormat format) {
|
||||||
if (!Double.isNaN(d) && !Double.isInfinite(d)) {
|
if (!Double.isNaN(d) && !Double.isInfinite(d)) {
|
||||||
setText(id, format.format(d));
|
setText(id, format.format(d));
|
||||||
|
} else {
|
||||||
|
setUnknown(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,6 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
// Transient state about the selected track
|
// Transient state about the selected track
|
||||||
private long selectedTrackId;
|
private long selectedTrackId;
|
||||||
private long recordingTrackId;
|
|
||||||
private long firstSeenLocationId;
|
private long firstSeenLocationId;
|
||||||
private long lastSeenLocationId;
|
private long lastSeenLocationId;
|
||||||
private int numLoadedPoints;
|
private int numLoadedPoints;
|
||||||
@@ -239,7 +238,6 @@ public class TrackDataHub {
|
|||||||
|
|
||||||
private void loadSharedPreferences() {
|
private void loadSharedPreferences() {
|
||||||
selectedTrackId = preferences.getLong(SELECTED_TRACK_KEY, -1);
|
selectedTrackId = preferences.getLong(SELECTED_TRACK_KEY, -1);
|
||||||
recordingTrackId = preferences.getLong(RECORDING_TRACK_KEY, -1);
|
|
||||||
useMetricUnits = preferences.getBoolean(METRIC_UNITS_KEY, true);
|
useMetricUnits = preferences.getBoolean(METRIC_UNITS_KEY, true);
|
||||||
reportSpeed = preferences.getBoolean(SPEED_REPORTING_KEY, true);
|
reportSpeed = preferences.getBoolean(SPEED_REPORTING_KEY, true);
|
||||||
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
||||||
@@ -340,7 +338,7 @@ public class TrackDataHub {
|
|||||||
if (!started) {
|
if (!started) {
|
||||||
loadSharedPreferences();
|
loadSharedPreferences();
|
||||||
}
|
}
|
||||||
return recordingTrackId > 0;
|
return preferences.getLong(RECORDING_TRACK_KEY, -1) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns whether the selected track is still being recorded. */
|
/** Returns whether the selected track is still being recorded. */
|
||||||
@@ -348,6 +346,7 @@ public class TrackDataHub {
|
|||||||
if (!started) {
|
if (!started) {
|
||||||
loadSharedPreferences();
|
loadSharedPreferences();
|
||||||
}
|
}
|
||||||
|
long recordingTrackId = preferences.getLong(RECORDING_TRACK_KEY, -1);
|
||||||
return recordingTrackId > 0 && recordingTrackId == selectedTrackId;
|
return recordingTrackId > 0 && recordingTrackId == selectedTrackId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,9 +548,7 @@ public class TrackDataHub {
|
|||||||
* @param key the key to the preference that changed
|
* @param key the key to the preference that changed
|
||||||
*/
|
*/
|
||||||
private void notifyPreferenceChanged(String key) {
|
private void notifyPreferenceChanged(String key) {
|
||||||
if (RECORDING_TRACK_KEY.equals(key)) {
|
if (MIN_REQUIRED_ACCURACY_KEY.equals(key)) {
|
||||||
recordingTrackId = preferences.getLong(RECORDING_TRACK_KEY, -1);
|
|
||||||
} else if (MIN_REQUIRED_ACCURACY_KEY.equals(key)) {
|
|
||||||
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
minRequiredAccuracy = preferences.getInt(MIN_REQUIRED_ACCURACY_KEY,
|
||||||
Constants.DEFAULT_MIN_REQUIRED_ACCURACY);
|
Constants.DEFAULT_MIN_REQUIRED_ACCURACY);
|
||||||
} else if (METRIC_UNITS_KEY.equals(key)) {
|
} else if (METRIC_UNITS_KEY.equals(key)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user