show proper duration text on event list widget

This commit is contained in:
tibbi 2021-11-27 11:20:47 +01:00
parent e507fecd1b
commit 27150d8802
1 changed files with 9 additions and 7 deletions

View File

@ -77,14 +77,16 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
var timeText = if (item.isAllDay) allDayString else Formatter.getTimeFromTS(context, item.startTS)
val endText = Formatter.getTimeFromTS(context, item.endTS)
if (!item.isAllDay && timeText != endText) {
timeText += " - $endText"
}
if (item.startTS != item.endTS) {
if (!item.isAllDay) {
timeText += " - $endText"
}
val startCode = Formatter.getDayCodeFromTS(item.startTS)
val endCode = Formatter.getDayCodeFromTS(item.endTS)
if (startCode != endCode) {
timeText += " (${Formatter.getDateDayTitle(endCode)})"
val startCode = Formatter.getDayCodeFromTS(item.startTS)
val endCode = Formatter.getDayCodeFromTS(item.endTS)
if (startCode != endCode) {
timeText += " (${Formatter.getDateDayTitle(endCode)})"
}
}
setText(R.id.event_item_time, timeText)