forked from upstream-mirrors/OpenTracks
Bugfix: interval recording fragment has to keep select interval.
This commit is contained in:
@@ -35,6 +35,7 @@ public class IntervalsRecordingFragment extends Fragment implements IntervalList
|
|||||||
|
|
||||||
private IntervalStatisticsModel viewModel;
|
private IntervalStatisticsModel viewModel;
|
||||||
private IntervalListView.IntervalReverseListView intervalListView;
|
private IntervalListView.IntervalReverseListView intervalListView;
|
||||||
|
private IntervalStatisticsModel.IntervalOption selectedInterval;
|
||||||
|
|
||||||
private Track.Id trackId;
|
private Track.Id trackId;
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@ public class IntervalsRecordingFragment extends Fragment implements IntervalList
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectedInterval = interval;
|
||||||
LiveData<IntervalStatistics> liveData = viewModel.getIntervalStats(trackId, interval);
|
LiveData<IntervalStatistics> liveData = viewModel.getIntervalStats(trackId, interval);
|
||||||
liveData.observe(getActivity(), intervalStatistics -> {
|
liveData.observe(getActivity(), intervalStatistics -> {
|
||||||
if (intervalStatistics != null) {
|
if (intervalStatistics != null) {
|
||||||
@@ -123,13 +125,13 @@ public class IntervalsRecordingFragment extends Fragment implements IntervalList
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateIntervals() {
|
private void updateIntervals() {
|
||||||
intervalChanged(null);
|
intervalChanged(selectedInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unitChanged() {
|
public void unitChanged() {
|
||||||
if (viewModel != null) {
|
if (viewModel != null) {
|
||||||
LiveData<IntervalStatistics> liveData = viewModel.getIntervalStats(trackId, null);
|
LiveData<IntervalStatistics> liveData = viewModel.getIntervalStats(trackId, selectedInterval);
|
||||||
liveData.observe(getActivity(), intervalStatistics -> {
|
liveData.observe(getActivity(), intervalStatistics -> {
|
||||||
if (intervalStatistics != null) {
|
if (intervalStatistics != null) {
|
||||||
intervalListView.display(intervalStatistics.getIntervalList());
|
intervalListView.display(intervalStatistics.getIntervalList());
|
||||||
|
|||||||
Reference in New Issue
Block a user