properly select default reminder in settings
This commit is contained in:
parent
33d04cd5e7
commit
99eae5edda
|
@ -88,11 +88,11 @@ class SettingsActivity : SimpleActivity() {
|
||||||
private fun setupEventReminder() {
|
private fun setupEventReminder() {
|
||||||
val reminderType = config.defaultReminderType
|
val reminderType = config.defaultReminderType
|
||||||
val reminderMinutes = config.defaultReminderMinutes
|
val reminderMinutes = config.defaultReminderMinutes
|
||||||
settings_default_reminder.setSelection(reminderType)
|
settings_default_reminder.setSelection(getDefaultReminderTypeIndex(reminderType))
|
||||||
custom_reminder_save.setTextColor(custom_reminder_other_val.currentTextColor)
|
custom_reminder_save.setTextColor(custom_reminder_other_val.currentTextColor)
|
||||||
setupReminderPeriod(reminderMinutes)
|
setupReminderPeriod(reminderMinutes)
|
||||||
|
|
||||||
settings_custom_reminder_holder.beVisibleIf(reminderType == 2)
|
settings_custom_reminder_holder.beVisibleIf(reminderType == REMINDER_CUSTOM)
|
||||||
custom_reminder_save.setOnClickListener { saveReminder() }
|
custom_reminder_save.setOnClickListener { saveReminder() }
|
||||||
|
|
||||||
settings_default_reminder.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
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 {
|
private fun getDefaultReminderValue(index: Int): Int {
|
||||||
return when (index) {
|
return when (index) {
|
||||||
0 -> REMINDER_OFF
|
0 -> REMINDER_OFF
|
||||||
|
|
Loading…
Reference in New Issue