properly select default reminder in settings

This commit is contained in:
tibbi 2017-01-07 11:20:28 +01:00
parent 33d04cd5e7
commit 99eae5edda

View File

@ -88,11 +88,11 @@ class SettingsActivity : SimpleActivity() {
private fun setupEventReminder() {
val reminderType = config.defaultReminderType
val reminderMinutes = config.defaultReminderMinutes
settings_default_reminder.setSelection(reminderType)
settings_default_reminder.setSelection(getDefaultReminderTypeIndex(reminderType))
custom_reminder_save.setTextColor(custom_reminder_other_val.currentTextColor)
setupReminderPeriod(reminderMinutes)
settings_custom_reminder_holder.beVisibleIf(reminderType == 2)
settings_custom_reminder_holder.beVisibleIf(reminderType == REMINDER_CUSTOM)
custom_reminder_save.setOnClickListener { saveReminder() }
settings_default_reminder.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
@ -113,6 +113,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun getDefaultReminderTypeIndex(type: Int): Int {
return when (type) {
REMINDER_OFF -> 0
REMINDER_AT_START -> 1
else -> 2
}
}
private fun getDefaultReminderValue(index: Int): Int {
return when (index) {
0 -> REMINDER_OFF