Always show single day all-day events at the top
ignoring the user preference `showMidnightSpanningEventsAtTop`
This commit is contained in:
parent
839bbd1fa9
commit
802db5f29a
|
@ -454,7 +454,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
val endDayCode = Formatter.getDayCodeFromDateTime(endDateTime)
|
||||
val isAllDay = event.getIsAllDay()
|
||||
|
||||
if ((isAllDay || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
|
||||
if (shouldAddEventOnTopBar(isAllDay, startDayCode, endDayCode)) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,8 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
val startDayCode = Formatter.getDayCodeFromDateTime(startDateTime)
|
||||
val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
|
||||
val endDayCode = Formatter.getDayCodeFromDateTime(endDateTime)
|
||||
if ((event.getIsAllDay() || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
|
||||
|
||||
if (shouldAddEventOnTopBar(event.getIsAllDay(), startDayCode, endDayCode)) {
|
||||
addAllDayEvent(event)
|
||||
} else {
|
||||
var currentDateTime = startDateTime
|
||||
|
@ -696,6 +697,12 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
private fun shouldAddEventOnTopBar(isAllDay: Boolean, startDayCode: String, endDayCode: String): Boolean {
|
||||
val spansMultipleDays = startDayCode != endDayCode
|
||||
val isSingleDayAllDayEvent = isAllDay && !spansMultipleDays
|
||||
return isSingleDayAllDayEvent || spansMultipleDays && config.showMidnightSpanningEventsAtTop
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private fun addAllDayEvent(event: Event) {
|
||||
(inflater.inflate(R.layout.week_all_day_event_marker, null, false) as ConstraintLayout).apply {
|
||||
|
|
Loading…
Reference in New Issue