mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 10:55:49 +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
|
@Override
|
||||||
String getPieDescription(int targetValue) {
|
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
|
@Override
|
||||||
|
@ -54,7 +54,7 @@ public class DateTimeUtils {
|
|||||||
DurationFormatter df = DurationFormatter.Builder.SYMBOLS
|
DurationFormatter df = DurationFormatter.Builder.SYMBOLS
|
||||||
.maximum(TimeUnit.DAYS)
|
.maximum(TimeUnit.DAYS)
|
||||||
.minimum(TimeUnit.MINUTES)
|
.minimum(TimeUnit.MINUTES)
|
||||||
.suppressZeros(DurationFormatter.SuppressZeros.LEADING)
|
.suppressZeros(DurationFormatter.SuppressZeros.LEADING, DurationFormatter.SuppressZeros.TRAILING)
|
||||||
.maximumAmountOfUnitsToShow(2)
|
.maximumAmountOfUnitsToShow(2)
|
||||||
.build();
|
.build();
|
||||||
return df.format(duration, unit);
|
return df.format(duration, unit);
|
||||||
|
Loading…
Reference in New Issue
Block a user