Merge pull request #1443 from KryptKode/fix-month-view-sorting
Fix sorting in month view to startTS -> endTS -> title
This commit is contained in:
commit
1f4a879f11
|
@ -1,4 +1,4 @@
|
|||
package com.simplemobiletools.calendar.pro.models
|
||||
|
||||
data class MonthViewEvent(val id: Long, val title: String, val startTS: Long, val color: Int, val startDayIndex: Int, val daysCnt: Int, val originalStartDayIndex: Int,
|
||||
data class MonthViewEvent(val id: Long, val title: String, val startTS: Long, val endTS: Long, val color: Int, val startDayIndex: Int, val daysCnt: Int, val originalStartDayIndex: Int,
|
||||
val isAllDay: Boolean, val isPastEvent: Boolean)
|
||||
|
|
|
@ -121,14 +121,14 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
|
|||
val daysCnt = getEventLastingDaysCount(event)
|
||||
val validDayEvent = isDayValid(event, day.code)
|
||||
if ((lastEvent == null || lastEvent.startDayIndex + daysCnt <= day.indexOnMonthView) && !validDayEvent) {
|
||||
val monthViewEvent = MonthViewEvent(event.id!!, event.title, event.startTS, event.color, day.indexOnMonthView,
|
||||
val monthViewEvent = MonthViewEvent(event.id!!, event.title, event.startTS, event.endTS, event.color, day.indexOnMonthView,
|
||||
daysCnt, day.indexOnMonthView, event.getIsAllDay(), event.isPastEvent)
|
||||
allEvents.add(monthViewEvent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allEvents = allEvents.asSequence().sortedWith(compareBy({ -it.daysCnt }, { !it.isAllDay }, { it.startTS }, { it.startDayIndex }, { it.title }))
|
||||
allEvents = allEvents.asSequence().sortedWith(compareBy({ -it.daysCnt }, { !it.isAllDay }, { it.startTS }, { it.endTS }, { it.startDayIndex }, { it.title }))
|
||||
.toMutableList() as ArrayList<MonthViewEvent>
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue