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

@ -5,6 +5,7 @@ import android.provider.CalendarContract
import android.util.Log
import com.chibatching.kotpref.bulk
import com.tommasoberlose.anotherwidget.global.Preferences
import com.tommasoberlose.anotherwidget.helpers.CalendarHelper.applyFilters
import com.tommasoberlose.anotherwidget.models.Event
import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver
import com.tommasoberlose.anotherwidget.ui.widgets.MainWidget
@ -131,8 +132,7 @@ class EventRepository(val context: Context) {
.where(Event::class.java)
.greaterThan("endDate", now)
.findAll()
.filter { (Preferences.showDeclinedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED) }
.filter { (Preferences.calendarAllDay || !it.allDay) }
.applyFilters()
}
private fun getEvents(): List<Event> {
@ -157,8 +157,7 @@ class EventRepository(val context: Context) {
.greaterThan("endDate", now)
.lessThanOrEqualTo("startDate", limit.timeInMillis)
.findAll()
.filter { (Preferences.showDeclinedEvents || it.selfAttendeeStatus != CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED) }
.filter { (Preferences.calendarAllDay || !it.allDay) }
.applyFilters()
}
fun getEventsCount(): Int = getEvents().size