fix default reminder value

This commit is contained in:
tibbi 2017-01-02 23:16:29 +01:00
parent a4f98d8944
commit 82eb63ca69
2 changed files with 13 additions and 7 deletions

View File

@ -10,9 +10,7 @@ import android.view.View
import android.widget.AdapterView
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.extensions.beVisibleIf
import com.simplemobiletools.calendar.helpers.DAY_MINS
import com.simplemobiletools.calendar.helpers.HOUR_MINS
import com.simplemobiletools.calendar.helpers.REMINDER_CUSTOM
import com.simplemobiletools.calendar.helpers.*
import com.simplemobiletools.commons.extensions.*
import kotlinx.android.synthetic.main.activity_settings.*
@ -110,13 +108,21 @@ class SettingsActivity : SimpleActivity() {
settings_custom_reminder_holder.visibility = View.GONE
}
config.defaultReminderType = itemIndex
config.defaultReminderType = getDefaultReminderValue(itemIndex)
}
isInitialSetup = false
}
}
}
private fun getDefaultReminderValue(index: Int): Int {
return when (index) {
0 -> REMINDER_OFF
1 -> REMINDER_AT_START
else -> REMINDER_CUSTOM
}
}
private fun saveReminder() {
val value = custom_reminder_value.value
val multiplier = when (custom_reminder_other_period.selectedItemPosition) {

View File

@ -14,9 +14,9 @@ val MONTHLY_VIEW = 1
val YEARLY_VIEW = 2
val EVENTS_LIST_VIEW = 3
val REMINDER_OFF = -1
val REMINDER_AT_START = 0
val REMINDER_CUSTOM = 1
val REMINDER_OFF = 0
val REMINDER_AT_START = 1
val REMINDER_CUSTOM = 2
val DAY = 86400
val WEEK = 604800