diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt index c71f0b16c..86890e500 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/adapters/EventListWidgetAdapter.kt @@ -105,16 +105,14 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV val sublist = sorted.subList(0, Math.min(sorted.size, 100)) var prevCode = "" sublist.forEach { - if (!it.ignoreEventOccurrences.contains(it.startTS)) { - val code = Formatter.getDayCodeFromTS(it.startTS) - if (code != prevCode) { - val day = Formatter.getDayTitle(context, code) - if (day != todayDate) - listItems.add(ListSection(day)) - prevCode = code - } - listItems.add(ListEvent(it.id, it.startTS, it.endTS, it.title, it.description, it.isAllDay)) + val code = Formatter.getDayCodeFromTS(it.startTS) + if (code != prevCode) { + val day = Formatter.getDayTitle(context, code) + if (day != todayDate) + listItems.add(ListSection(day)) + prevCode = code } + listItems.add(ListEvent(it.id, it.startTS, it.endTS, it.title, it.description, it.isAllDay)) } this@EventListWidgetAdapter.events = listItems diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt index 3e5b2350e..8c0db3f8e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/DayFragment.kt @@ -162,10 +162,9 @@ class DayFragment : Fragment(), DBHelper.EventUpdateListener, DBHelper.GetEvents override fun gotEvents(events: MutableList) { val sorted = ArrayList(events.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { it.description }))) val filtered = context.getFilteredEvents(sorted) - val notIgnored = filtered.filterNot { it.ignoreEventOccurrences.contains(it.startTS) } activity?.runOnUiThread { - updateEvents(notIgnored) + updateEvents(filtered) } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt index 7a7197bbc..c15f557fb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/EventListFragment.kt @@ -68,15 +68,13 @@ class EventListFragment : Fragment(), DBHelper.GetEventsListener, DBHelper.Event val sublist = sorted.subList(0, Math.min(sorted.size, 100)) var prevCode = "" sublist.forEach { - if (!it.ignoreEventOccurrences.contains(it.startTS)) { - val code = Formatter.getDayCodeFromTS(it.startTS) - if (code != prevCode) { - val day = Formatter.getDayTitle(context, code) - listItems.add(ListSection(day)) - prevCode = code - } - listItems.add(ListEvent(it.id, it.startTS, it.endTS, it.title, it.description, it.isAllDay)) + val code = Formatter.getDayCodeFromTS(it.startTS) + if (code != prevCode) { + val day = Formatter.getDayTitle(context, code) + listItems.add(ListSection(day)) + prevCode = code } + listItems.add(ListEvent(it.id, it.startTS, it.endTS, it.title, it.description, it.isAllDay)) } val eventsAdapter = EventListAdapter(activity as SimpleActivity, listItems, this) { eventId, eventTS -> diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt index e0b94e62c..f6c2d6aee 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/WeekFragment.kt @@ -232,9 +232,6 @@ class WeekFragment : Fragment(), WeeklyCalendar { var hadAllDayEvent = false val sorted = filtered.sortedWith(compareBy({ it.startTS }, { it.endTS }, { it.title }, { it.description })) for (event in sorted) { - if (event.ignoreEventOccurrences.contains(event.startTS)) - continue - if (event.isAllDay || Formatter.getDayCodeFromTS(event.startTS) != Formatter.getDayCodeFromTS(event.endTS)) { hadAllDayEvent = true addAllDayEvent(event) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt index 7e35f9827..49e355728 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/DBHelper.kt @@ -367,7 +367,9 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont val selectionArgs = arrayOf(toTS.toString(), fromTS.toString()) val cursor = getEventsCursor(selection, selectionArgs) events.addAll(fillEvents(cursor)) - callback?.gotEvents(events) + + val filtered = events.filterNot { it.ignoreEventOccurrences.contains(it.startTS) } as MutableList + callback?.gotEvents(filtered) } private fun getEventsFor(fromTS: Int, toTS: Int): List { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt index 7ef17ede3..ded2c98a0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/MonthlyCalendarImpl.kt @@ -85,12 +85,9 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context) // it works more often than not, dont touch private fun markDaysWithEvents(days: ArrayList) { val eventCodes = ArrayList() - for (event in mEvents) { - if (event.ignoreEventOccurrences.contains(event.startTS)) - continue - - val startDateTime = Formatter.getDateTimeFromTS(event.startTS) - val endDateTime = Formatter.getDateTimeFromTS(event.endTS) + for ((id, startTS, endTS) in mEvents) { + val startDateTime = Formatter.getDateTimeFromTS(startTS) + val endDateTime = Formatter.getDateTimeFromTS(endTS) val endCode = Formatter.getDayCodeFromDateTime(endDateTime) var currDay = startDateTime diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/YearlyCalendarImpl.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/YearlyCalendarImpl.kt index 5b86acc79..da02ed612 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/YearlyCalendarImpl.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/helpers/YearlyCalendarImpl.kt @@ -20,10 +20,9 @@ class YearlyCalendarImpl(val callback: YearlyCalendar, val context: Context, val override fun gotEvents(events: MutableList) { val filtered = context.getFilteredEvents(events) - val notIgnored = filtered.filterNot { it.ignoreEventOccurrences.contains(it.startTS) } val arr = SparseArray>(12) - for ((id, startTS, endTS) in notIgnored) { + for ((id, startTS, endTS) in filtered) { val startDateTime = Formatter.getDateTimeFromTS(startTS) markDay(arr, startDateTime)