do not limit event list items to 100

This commit is contained in:
tibbi 2018-05-06 09:58:28 +02:00
parent f8e316e1cc
commit 857854632b
2 changed files with 2 additions and 4 deletions

View File

@ -136,12 +136,11 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
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({ it.startTS }, { it.endTS }, { it.title }, { if (replaceDescription) it.location else it.description }))
val sublist = sorted.subList(0, Math.min(sorted.size, 100))
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))
sublist.forEach { sorted.forEach {
val code = Formatter.getDayCodeFromTS(it.startTS) val code = Formatter.getDayCodeFromTS(it.startTS)
if (code != prevCode) { if (code != prevCode) {
val day = Formatter.getDayTitle(context, code) val day = Formatter.getDayTitle(context, code)

View File

@ -397,12 +397,11 @@ 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 })) val sorted = events.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { if (replaceDescription) it.location else it.description }))
val sublist = sorted.subList(0, Math.min(sorted.size, 100))
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))
sublist.forEach { sorted.forEach {
val code = Formatter.getDayCodeFromTS(it.startTS) val code = Formatter.getDayCodeFromTS(it.startTS)
if (code != prevCode) { if (code != prevCode) {
val day = Formatter.getDayTitle(this, code) val day = Formatter.getDayTitle(this, code)