show events lasting through midnight at top bar too

This commit is contained in:
tibbi 2017-02-03 23:05:50 +01:00
parent 5ea8d45bcf
commit 3493842a7f
1 changed files with 3 additions and 3 deletions

View File

@ -151,12 +151,12 @@ class WeekFragment : Fragment(), WeeklyCalendar {
val sorted = events.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { it.description })) val sorted = events.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { it.description }))
for (event in sorted) { for (event in sorted) {
if (event.isAllDay()) { if (event.isAllDay() || Formatter.getDayCodeFromTS(event.startTS) != Formatter.getDayCodeFromTS(event.endTS)) {
addAllDayEvent(event) addAllDayEvent(event)
} else { } else {
val startDateTime = Formatter.getDateTimeFromTS(event.startTS).plusDays(if (context.config.isSundayFirst) 1 else 0) val startDateTime = Formatter.getDateTimeFromTS(event.startTS)
val endDateTime = Formatter.getDateTimeFromTS(event.endTS) val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
val dayOfWeek = startDateTime.dayOfWeek - 1 val dayOfWeek = startDateTime.plusDays(if (context.config.isSundayFirst) 1 else 0).dayOfWeek - 1
val layout = getColumnWithId(dayOfWeek) val layout = getColumnWithId(dayOfWeek)
val startMinutes = startDateTime.minuteOfDay val startMinutes = startDateTime.minuteOfDay