Skip to content

Commit

Permalink
properly select default reminder in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed Jan 7, 2017
1 parent 33d04cd commit 99eae5e
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down

0 comments on commit 99eae5e

Please sign in to comment.