mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
show all-day events above others on some views in some cases
This commit is contained in:
@@ -123,7 +123,7 @@ class DayFragment : Fragment() {
|
|||||||
lastHash = newHash
|
lastHash = newHash
|
||||||
|
|
||||||
val replaceDescription = context!!.config.replaceDescription
|
val replaceDescription = context!!.config.replaceDescription
|
||||||
val sorted = ArrayList<Event>(filtered.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, {
|
val sorted = ArrayList<Event>(filtered.sortedWith(compareBy({ !it.getIsAllDay() }, { it.startTS }, { it.endTS }, { it.title }, {
|
||||||
if (replaceDescription) it.location else it.description
|
if (replaceDescription) it.location else it.description
|
||||||
})))
|
})))
|
||||||
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
package com.simplemobiletools.calendar.models
|
package com.simplemobiletools.calendar.models
|
||||||
|
|
||||||
data class MonthViewEvent(val id: Int, val title: String, val startTS: Int, val color: Int, val startDayIndex: Int, val daysCnt: Int, val originalStartDayIndex: Int)
|
data class MonthViewEvent(val id: Int, val title: String, val startTS: Int, val color: Int, val startDayIndex: Int, val daysCnt: Int, val originalStartDayIndex: Int,
|
||||||
|
val isAllDay: Boolean)
|
||||||
|
@@ -87,13 +87,14 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||||||
day.dayEvents.forEach {
|
day.dayEvents.forEach {
|
||||||
val event = it
|
val event = it
|
||||||
if (allEvents.firstOrNull { it.id == event.id } == null) {
|
if (allEvents.firstOrNull { it.id == event.id } == null) {
|
||||||
val monthViewEvent = MonthViewEvent(event.id, event.title, event.startTS, event.color, day.indexOnMonthView, getEventLastingDaysCount(event), day.indexOnMonthView)
|
val monthViewEvent = MonthViewEvent(event.id, event.title, event.startTS, event.color, day.indexOnMonthView,
|
||||||
|
getEventLastingDaysCount(event), day.indexOnMonthView, event.getIsAllDay())
|
||||||
allEvents.add(monthViewEvent)
|
allEvents.add(monthViewEvent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allEvents = allEvents.sortedWith(compareBy({ -it.daysCnt }, { it.startTS }, { it.startDayIndex }, { it.title })).toMutableList() as ArrayList<MonthViewEvent>
|
allEvents = allEvents.sortedWith(compareBy({ -it.daysCnt }, { !it.isAllDay }, { it.startTS }, { it.startDayIndex }, { it.title })).toMutableList() as ArrayList<MonthViewEvent>
|
||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user