fix the spinner at settings
This commit is contained in:
parent
9a5aff5116
commit
18c4d4a773
|
@ -10,7 +10,9 @@ import android.view.View
|
||||||
import android.widget.AdapterView
|
import android.widget.AdapterView
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.extensions.beVisibleIf
|
import com.simplemobiletools.calendar.extensions.beVisibleIf
|
||||||
import com.simplemobiletools.calendar.helpers.*
|
import com.simplemobiletools.calendar.helpers.DAY_MINS
|
||||||
|
import com.simplemobiletools.calendar.helpers.HOUR_MINS
|
||||||
|
import com.simplemobiletools.calendar.helpers.REMINDER_CUSTOM
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
import kotlinx.android.synthetic.main.activity_settings.*
|
import kotlinx.android.synthetic.main.activity_settings.*
|
||||||
|
|
||||||
|
@ -75,15 +77,13 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupEventReminder() {
|
private fun setupEventReminder() {
|
||||||
|
var isInitialSetup = true
|
||||||
val reminderType = config.defaultReminderType
|
val reminderType = config.defaultReminderType
|
||||||
val reminderMinutes = config.defaultReminderMinutes
|
val reminderMinutes = config.defaultReminderMinutes
|
||||||
settings_default_reminder.setSelection(when (reminderType) {
|
settings_default_reminder.setSelection(reminderType)
|
||||||
REMINDER_OFF -> 0
|
|
||||||
REMINDER_AT_START -> 1
|
|
||||||
else -> 2
|
|
||||||
})
|
|
||||||
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 == 2)
|
||||||
custom_reminder_save.setOnClickListener { saveReminder() }
|
custom_reminder_save.setOnClickListener { saveReminder() }
|
||||||
|
|
||||||
|
@ -92,19 +92,20 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, itemIndex: Int, p3: Long) {
|
override fun onItemSelected(p0: AdapterView<*>?, p1: View?, itemIndex: Int, p3: Long) {
|
||||||
if (itemIndex == 2) {
|
if (isInitialSetup)
|
||||||
settings_custom_reminder_holder.visibility = View.VISIBLE
|
settings_default_reminder.setSelection(reminderType)
|
||||||
showKeyboard(custom_reminder_value)
|
else {
|
||||||
} else {
|
if (itemIndex == 2) {
|
||||||
hideKeyboard()
|
settings_custom_reminder_holder.visibility = View.VISIBLE
|
||||||
settings_custom_reminder_holder.visibility = View.GONE
|
showKeyboard(custom_reminder_value)
|
||||||
}
|
} else {
|
||||||
|
hideKeyboard()
|
||||||
|
settings_custom_reminder_holder.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
config.defaultReminderType = when (itemIndex) {
|
config.defaultReminderType = itemIndex
|
||||||
0 -> REMINDER_OFF
|
|
||||||
1 -> REMINDER_AT_START
|
|
||||||
else -> REMINDER_CUSTOM
|
|
||||||
}
|
}
|
||||||
|
isInitialSetup = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ val MONTHLY_VIEW = 1
|
||||||
val YEARLY_VIEW = 2
|
val YEARLY_VIEW = 2
|
||||||
val EVENTS_LIST_VIEW = 3
|
val EVENTS_LIST_VIEW = 3
|
||||||
|
|
||||||
val REMINDER_OFF = -1
|
val REMINDER_OFF = 0
|
||||||
val REMINDER_AT_START = 0
|
val REMINDER_AT_START = 1
|
||||||
val REMINDER_CUSTOM = 1
|
val REMINDER_CUSTOM = 2
|
||||||
|
|
||||||
val DAY = 86400
|
val DAY = 86400
|
||||||
val WEEK = 604800
|
val WEEK = 604800
|
||||||
|
|
Loading…
Reference in New Issue