mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 17:45:50 +01:00
Properly format the sleep goal as a duration, not as a time
Also suppress trailing zeros, e.g. display 8h instead of 8h 0m
This commit is contained in:
parent
155ce5be02
commit
4a4a1e25df
@ -44,7 +44,7 @@ public class WeekSleepChartFragment extends AbstractWeekChartFragment {
|
||||
|
||||
@Override
|
||||
String getPieDescription(int targetValue) {
|
||||
return getString(R.string.weeksleepchart_today_sleep_description, DateTimeUtils.minutesToHHMM(targetValue));
|
||||
return getString(R.string.weeksleepchart_today_sleep_description, DateTimeUtils.formatDurationHoursMinutes(targetValue, TimeUnit.MINUTES));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class DateTimeUtils {
|
||||
DurationFormatter df = DurationFormatter.Builder.SYMBOLS
|
||||
.maximum(TimeUnit.DAYS)
|
||||
.minimum(TimeUnit.MINUTES)
|
||||
.suppressZeros(DurationFormatter.SuppressZeros.LEADING)
|
||||
.suppressZeros(DurationFormatter.SuppressZeros.LEADING, DurationFormatter.SuppressZeros.TRAILING)
|
||||
.maximumAmountOfUnitsToShow(2)
|
||||
.build();
|
||||
return df.format(duration, unit);
|
||||
|
Loading…
Reference in New Issue
Block a user