summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2024-09-08 15:55:21 +0200
committerGitHub <noreply@github.com>2024-09-08 15:55:21 +0200
commit5ac3185605bb6bf3dd709513bd4ac84994aab386 (patch)
tree9a4a10c6d8f4b04031dca33d945f9b42ed8b5f46
parent7e449484a78d828c4f39c7d6b7e973e1eb1068e3 (diff)
downloadAntennaPod-5ac3185605bb6bf3dd709513bd4ac84994aab386.zip
Multi-line sleep timer time range for 12 hour locales (#7393)
-rw-r--r--app/src/main/java/de/danoeh/antennapod/ui/screen/playback/TimeRangeDialog.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/TimeRangeDialog.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/TimeRangeDialog.java
index 683c162fc..c962a455e 100644
--- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/TimeRangeDialog.java
+++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/TimeRangeDialog.java
@@ -126,16 +126,20 @@ public class TimeRangeDialog extends MaterialAlertDialogBuilder {
canvas.drawCircle(p2.x, p2.y, padding / 2, paintSelected);
paintText.setTextSize(0.6f * padding);
- String timeRange;
+ float textBaseY = (size - paintText.descent() - paintText.ascent()) / 2;
if (from == to) {
- timeRange = getContext().getString(R.string.sleep_timer_always);
+ String timeRange = getContext().getString(R.string.sleep_timer_always);
+ canvas.drawText(timeRange, size / 2, textBaseY, paintText);
} else if (DateFormat.is24HourFormat(getContext())) {
- timeRange = String.format(Locale.getDefault(), "%02d:00 - %02d:00", from, to);
+ String timeRange = String.format(Locale.getDefault(), "%02d:00 - %02d:00", from, to);
+ canvas.drawText(timeRange, size / 2, textBaseY, paintText);
} else {
- timeRange = String.format(Locale.getDefault(), "%02d:00 %s - %02d:00 %s", from % 12,
- from >= 12 ? "PM" : "AM", to % 12, to >= 12 ? "PM" : "AM");
+ String timeFrom = String.format(Locale.getDefault(), "%02d:00 %s", from % 12, from >= 12 ? "PM" : "AM");
+ String timeTo = String.format(Locale.getDefault(), "%02d:00 %s", to % 12, to >= 12 ? "PM" : "AM");
+ canvas.drawText(timeFrom, size / 2, textBaseY - paintText.getTextSize(), paintText);
+ canvas.drawText("-", size / 2, textBaseY, paintText);
+ canvas.drawText(timeTo, size / 2, textBaseY + paintText.getTextSize(), paintText);
}
- canvas.drawText(timeRange, size / 2, (size - paintText.descent() - paintText.ascent()) / 2, paintText);
}
protected Point radToPoint(float angle, float radius) {