mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-20 05:30:40 +01: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:
commit
c7631bfee8
@ -452,20 +452,22 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
||||
val startDayCode = Formatter.getDayCodeFromDateTime(startDateTime)
|
||||
val endDateTime = Formatter.getDateTimeFromTS(event.endTS)
|
||||
val endDayCode = Formatter.getDayCodeFromDateTime(endDateTime)
|
||||
val isAllDay = event.getIsAllDay()
|
||||
|
||||
if ((event.getIsAllDay() || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
|
||||
if ((isAllDay || (startDayCode != endDayCode)) && config.showMidnightSpanningEventsAtTop) {
|
||||
continue
|
||||
}
|
||||
|
||||
var currentDateTime = startDateTime
|
||||
var currentDayCode = Formatter.getDayCodeFromDateTime(currentDateTime)
|
||||
do {
|
||||
val startMinutes = when (currentDayCode == startDayCode) {
|
||||
true -> (startDateTime.minuteOfDay)
|
||||
// all-day events always start at the 0 minutes and end at the end of the day (1440 minutes)
|
||||
val startMinutes = when {
|
||||
currentDayCode == startDayCode && !isAllDay -> (startDateTime.minuteOfDay)
|
||||
else -> 0
|
||||
}
|
||||
val duration = when (currentDayCode == endDayCode) {
|
||||
true -> (endDateTime.minuteOfDay - startMinutes)
|
||||
val duration = when {
|
||||
currentDayCode == endDayCode && !isAllDay -> (endDateTime.minuteOfDay - startMinutes)
|
||||
else -> 1440
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user