mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-16 15:53:07 +02:00
Workaround for no barometric sensor: intervals shows dashes (-) for gain and loss. Fixes #791.
This commit is contained in:
@@ -59,8 +59,9 @@ public class IntervalStatisticsAdapter extends RecyclerView.Adapter<RecyclerView
|
|||||||
|
|
||||||
viewHolder.rate.setText(StringUtils.formatSpeed(context, interval.getSpeed(), metricUnits, isReportSpeed));
|
viewHolder.rate.setText(StringUtils.formatSpeed(context, interval.getSpeed(), metricUnits, isReportSpeed));
|
||||||
|
|
||||||
viewHolder.gain.setText(StringUtils.formatDistance(context, Distance.of(interval.getGain_m()), metricUnits));
|
viewHolder.gain.setText(interval.hasGain() ? StringUtils.formatDistance(context, Distance.of(interval.getGain_m()), metricUnits) : context.getString(R.string.value_unknown));
|
||||||
viewHolder.loss.setText(StringUtils.formatDistance(context, Distance.of(interval.getLoss_m()), metricUnits));
|
viewHolder.loss.setText(interval.hasLoss() ? StringUtils.formatDistance(context, Distance.of(interval.getLoss_m()), metricUnits) : context.getString(R.string.value_unknown));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -104,8 +104,8 @@ public class IntervalStatistics {
|
|||||||
public static class Interval {
|
public static class Interval {
|
||||||
private Distance distance = Distance.of(0);
|
private Distance distance = Distance.of(0);
|
||||||
private Duration time = Duration.ofSeconds(0);
|
private Duration time = Duration.ofSeconds(0);
|
||||||
private float gain_m;
|
private Float gain_m;
|
||||||
private float loss_m;
|
private Float loss_m;
|
||||||
|
|
||||||
public Interval() {
|
public Interval() {
|
||||||
}
|
}
|
||||||
@@ -143,10 +143,18 @@ public class IntervalStatistics {
|
|||||||
return Speed.of(distance, time);
|
return Speed.of(distance, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasGain() {
|
||||||
|
return gain_m != null;
|
||||||
|
}
|
||||||
|
|
||||||
public float getGain_m() {
|
public float getGain_m() {
|
||||||
return gain_m;
|
return gain_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasLoss() {
|
||||||
|
return loss_m != null;
|
||||||
|
}
|
||||||
|
|
||||||
public float getLoss_m() {
|
public float getLoss_m() {
|
||||||
return loss_m;
|
return loss_m;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user