dont count event reminders as a jerk

This commit is contained in:
tibbi 2017-02-06 21:10:39 +01:00
parent e4fe47f81b
commit b8c2103431
2 changed files with 5 additions and 11 deletions

View File

@ -42,6 +42,9 @@ fun Context.updateListWidget() {
}
fun Context.scheduleNextEventReminder(event: Event) {
if (event.getReminders().isEmpty())
return
var startTS = event.startTS - event.reminder1Minutes * 60
var newTS = startTS
if (event.repeatInterval == DAY || event.repeatInterval == WEEK || event.repeatInterval == BIWEEK) {

View File

@ -31,16 +31,7 @@ data class Event(var id: Int = 0, var startTS: Int = 0, var endTS: Int = 0, var
val isAllDay = flags and FLAG_ALL_DAY != 0
fun getRemindersCount(): Int {
var cnt = 0
if (reminder1Minutes != REMINDER_OFF)
cnt++
if (reminder2Minutes != REMINDER_OFF)
cnt++
if (reminder3Minutes != REMINDER_OFF)
cnt++
return cnt
}
fun getRemindersCount() = getReminders().count()
fun getReminders() = arrayOf(reminder1Minutes, reminder2Minutes, reminder3Minutes).filter { it != REMINDER_OFF }
fun getReminders() = setOf(reminder1Minutes, reminder2Minutes, reminder3Minutes).filter { it != REMINDER_OFF }
}