added new UI component which shows elapsed segment time

This commit is contained in:
Jeff Shelley
2025-10-28 09:44:34 -05:00
parent 832005565a
commit 023a5aa221
5 changed files with 25 additions and 6 deletions
@@ -829,7 +829,8 @@ public class PreferencesUtils {
R.array.stats_custom_layout_fields_default_value_16,
R.array.stats_custom_layout_fields_default_value_17,
R.array.stats_custom_layout_fields_default_value_18,
R.array.stats_custom_layout_fields_default_value_19
R.array.stats_custom_layout_fields_default_value_19,
R.array.stats_custom_layout_fields_default_value_20
).map(id -> resources.obtainTypedArray(id))
.toList();
}
@@ -216,6 +216,17 @@ public abstract class GenericStatisticsViewHolder extends StatisticViewHolder<St
}
}
public static class ElapsedSegmentTime extends GenericStatisticsViewHolder {
@Override
public void onChanged(UnitSystem unitSystem, RecordingData data) {
String value = StringUtils.formatElapsedTime(data.getStatisticsCurrentSegment().getTotalTime());
getBinding().statsValue.setText(value);
getBinding().statsDescriptionMain.setText(getContext().getString(R.string.stats_elapsed_segment_time));
}
}
public static class FastestPace extends GenericStatisticsViewHolder {
@Override
@@ -25,6 +25,7 @@ public class Mapping {
m.put(context.getString(R.string.stats_custom_layout_average_moving_pace_key), GenericStatisticsViewHolder.AverageMovingPace::new);
m.put(context.getString(R.string.stats_custom_layout_average_pace_key), GenericStatisticsViewHolder.AveragePace::new);
m.put(context.getString(R.string.stats_custom_layout_average_segment_pace_key), GenericStatisticsViewHolder.AverageSegmentPace::new);
m.put(context.getString(R.string.stats_custom_layout_elapsed_segment_time_key), GenericStatisticsViewHolder.ElapsedSegmentTime::new);
m.put(context.getString(R.string.stats_custom_layout_fastest_pace_key), GenericStatisticsViewHolder.FastestPace::new);
m.put(context.getString(R.string.stats_custom_layout_altitude_key), GenericStatisticsViewHolder.Altitude::new);