lets use a simple return time at getting running events

This commit is contained in:
tibbi 2017-04-03 19:49:14 +02:00
parent d9f7707d3f
commit 33d8da8919
2 changed files with 3 additions and 6 deletions

View File

@ -153,9 +153,7 @@ fun Context.getFilteredEvents(events: List<Event>): List<Event> {
}
fun Context.notifyRunningEvents() {
dbHelper.getRunningEvents {
it.forEach { notifyEvent(it) }
}
dbHelper.getRunningEvents().forEach { notifyEvent(it) }
}
fun Context.notifyEvent(event: Event) {

View File

@ -393,7 +393,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
return newEvents
}
fun getRunningEvents(callback: (events: ArrayList<Event>) -> Unit) {
fun getRunningEvents(): List<Event> {
val events = ArrayList<Event>()
val ts = (System.currentTimeMillis() / 1000).toInt()
@ -403,8 +403,7 @@ class DBHelper private constructor(val context: Context) : SQLiteOpenHelper(cont
events.addAll(fillEvents(cursor))
events.addAll(getRepeatableEventsFor(ts, ts, true))
callback(events)
return events
}
private fun getEvents(selection: String): List<Event> {