mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
Merge pull request #1875 from Naveen3Singh/bug_fix_all_day_events
Ignore stored hour for all-day events in weekly view
This commit is contained in:
@ -452,20 +452,22 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||||||
val startDayCode = Formatter.getDayCodeFromDateTime(startDateTime)
|
val startDayCode = Formatter.getDayCodeFromDateTime(startDateTime)
|
||||||
val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
|
val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
|
||||||
val endDayCode = Formatter.getDayCodeFromDateTime(endDateTime)
|
val endDayCode = Formatter.getDayCodeFromDateTime(endDateTime)
|
||||||
|
val isAllDay = event.getIsAllDay()
|
||||||
|
|
||||||
if ((event.getIsAllDay() || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
|
if ((isAllDay || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentDateTime = startDateTime
|
var currentDateTime = startDateTime
|
||||||
var currentDayCode = Formatter.getDayCodeFromDateTime(currentDateTime)
|
var currentDayCode = Formatter.getDayCodeFromDateTime(currentDateTime)
|
||||||
do {
|
do {
|
||||||
val startMinutes = when (currentDayCode == startDayCode) {
|
// all-day events always start at the 0 minutes and end at the end of the day (1440 minutes)
|
||||||
true -> (startDateTime.minuteOfDay)
|
val startMinutes = when {
|
||||||
|
currentDayCode == startDayCode && !isAllDay -> (startDateTime.minuteOfDay)
|
||||||
else -> 0
|
else -> 0
|
||||||
}
|
}
|
||||||
val duration = when (currentDayCode == endDayCode) {
|
val duration = when {
|
||||||
true -> (endDateTime.minuteOfDay - startMinutes)
|
currentDayCode == endDayCode && !isAllDay -> (endDateTime.minuteOfDay - startMinutes)
|
||||||
else -> 1440
|
else -> 1440
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user