forked from upstream-mirrors/OpenTracks
Add settings toggles for chart series
Adds toggles to the User Interface section of the app Settings that allow the user to display or hide the three series available in the chart: Elevation, Speed/Pace, and Heart Rate. As a user of a heart rate monitor primarily during strength workouts and combat sports, the distance and elevation graphs are not helpful to me - in addition, their scale means that I am not able to easily see my exact heart rate. This should allow users in a similar situation to better determine exactly what is most helpful for them to be seen on the graph. Also updates heart rate series possible intervals - the smallest interval was 25, which was too low for most zone 1 cardio charts - if your heart rate goes from 70 to 125, with a 25 interval, most of the chart will be whitespace.
This commit is contained in:
@@ -86,6 +86,7 @@ public class ChartFragment extends Fragment implements TrackDataHub.Listener {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(R.string.stats_rate_key, key)) {
|
||||
boolean reportSpeed = PreferencesUtils.isReportSpeed(activityTypeLocalized);
|
||||
if (reportSpeed != viewBinding.chartView.getReportSpeed()) {
|
||||
@@ -99,6 +100,21 @@ public class ChartFragment extends Fragment implements TrackDataHub.Listener {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(R.string.chart_display_elevation_key, key)) {
|
||||
viewBinding.chartView.setShowElevation(PreferencesUtils.shouldShowElevation());
|
||||
refreshChart();
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(R.string.chart_display_pace_or_speed_key, key)) {
|
||||
viewBinding.chartView.setShowPaceOrSpeed(PreferencesUtils.shouldShowPaceOrSpeed());
|
||||
refreshChart();
|
||||
}
|
||||
|
||||
if (PreferencesUtils.isKey(R.string.chart_display_heart_rate_key, key)) {
|
||||
viewBinding.chartView.setShowHeartRate(PreferencesUtils.shouldShowHeartRate());
|
||||
refreshChart();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -273,4 +289,13 @@ public class ChartFragment extends Fragment implements TrackDataHub.Listener {
|
||||
fragmentActivity.runOnUiThread(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshChart() {
|
||||
runOnUiThread(() -> {
|
||||
if (isResumed()) {
|
||||
viewBinding.chartView.invalidate();
|
||||
viewBinding.chartView.requestLayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user