This commit is contained in:
Tommaso Berlose
2020-10-02 15:00:37 +02:00
parent ec40a277d7
commit 59dc5de21a
174 changed files with 440 additions and 219 deletions

View File

@ -69,4 +69,15 @@ object CalendarHelper {
fun removeEventUpdatesAndroidN(context: Context) {
EventListenerJob.remove(context)
}
fun List<Event>.applyFilters() : List<Event> {
return this
.asSequence()
.filter { (Preferences.showDeclinedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED) }
.filter { (Preferences.showAcceptedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED) }
.filter { (Preferences.showInvitedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_INVITED) }
.filter { (Preferences.calendarAllDay || !it.allDay) }
.filter { (!Preferences.showOnlyBusyEvents || it.availability != CalendarContract.EventsEntity.AVAILABILITY_FREE) }
.toList()
}
}