1
0
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:
cpfeiffer 2017-04-08 23:16:33 +02:00
parent 155ce5be02
commit 4a4a1e25df
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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);