mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
fix #726, move all-day events in fron of others at list views
This commit is contained in:
@@ -159,7 +159,14 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
|
|||||||
context.eventsHelper.getEventsSync(fromTS, toTS, applyTypeFilter = true) {
|
context.eventsHelper.getEventsSync(fromTS, toTS, applyTypeFilter = true) {
|
||||||
val listItems = ArrayList<ListItem>(it.size)
|
val listItems = ArrayList<ListItem>(it.size)
|
||||||
val replaceDescription = context.config.replaceDescription
|
val replaceDescription = context.config.replaceDescription
|
||||||
val sorted = it.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { if (replaceDescription) it.location else it.description }))
|
val sorted = it.sortedWith(compareBy({
|
||||||
|
if (it.getIsAllDay()) {
|
||||||
|
Formatter.getDayStartTS(Formatter.getDayCodeFromTS(it.startTS))
|
||||||
|
} else {
|
||||||
|
it.startTS
|
||||||
|
}
|
||||||
|
}, { it.endTS }, { it.title }, { if (replaceDescription) it.location else it.description }))
|
||||||
|
|
||||||
var prevCode = ""
|
var prevCode = ""
|
||||||
val now = getNowSeconds()
|
val now = getNowSeconds()
|
||||||
val today = Formatter.getDayTitle(context, Formatter.getDayCodeFromTS(now))
|
val today = Formatter.getDayTitle(context, Formatter.getDayCodeFromTS(now))
|
||||||
|
@@ -399,7 +399,16 @@ fun Context.addDayEvents(day: DayMonthly, linearLayout: LinearLayout, res: Resou
|
|||||||
fun Context.getEventListItems(events: List<Event>): ArrayList<ListItem> {
|
fun Context.getEventListItems(events: List<Event>): ArrayList<ListItem> {
|
||||||
val listItems = ArrayList<ListItem>(events.size)
|
val listItems = ArrayList<ListItem>(events.size)
|
||||||
val replaceDescription = config.replaceDescription
|
val replaceDescription = config.replaceDescription
|
||||||
val sorted = events.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { if (replaceDescription) it.location else it.description }))
|
|
||||||
|
// move all-day events in front of others
|
||||||
|
val sorted = events.sortedWith(compareBy({
|
||||||
|
if (it.getIsAllDay()) {
|
||||||
|
Formatter.getDayStartTS(Formatter.getDayCodeFromTS(it.startTS))
|
||||||
|
} else {
|
||||||
|
it.startTS
|
||||||
|
}
|
||||||
|
}, { it.endTS }, { it.title }, { if (replaceDescription) it.location else it.description }))
|
||||||
|
|
||||||
var prevCode = ""
|
var prevCode = ""
|
||||||
val now = getNowSeconds()
|
val now = getNowSeconds()
|
||||||
val today = Formatter.getDayTitle(this, Formatter.getDayCodeFromTS(now))
|
val today = Formatter.getDayTitle(this, Formatter.getDayCodeFromTS(now))
|
||||||
|
Reference in New Issue
Block a user