diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt index 279d7f5ac..bfd4631da 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/SettingsActivity.kt @@ -572,13 +572,13 @@ class SettingsActivity : SimpleActivity() { private fun setupDefaultStartTime() { updateDefaultStartTimeText() settings_default_start_time_holder.setOnClickListener { - val currentDefaultTime = if (config.defaultStartTime == -1) -1 else 0 + val currentDefaultTime = if (config.defaultStartTime == DEFAULT_START_TIME_NEXT_FULL_HOUR) DEFAULT_START_TIME_NEXT_FULL_HOUR else 0 val items = ArrayList() - items.add(RadioItem(-1, getString(R.string.next_full_hour))) + items.add(RadioItem(DEFAULT_START_TIME_NEXT_FULL_HOUR, getString(R.string.next_full_hour))) items.add(RadioItem(0, getString(R.string.other_time))) RadioGroupDialog(this@SettingsActivity, items, currentDefaultTime) { - if (it as Int == -1) { + if (it as Int == DEFAULT_START_TIME_NEXT_FULL_HOUR) { config.defaultStartTime = it updateDefaultStartTimeText() } else { @@ -595,7 +595,7 @@ class SettingsActivity : SimpleActivity() { } private fun updateDefaultStartTimeText() { - if (config.defaultStartTime == -1) { + if (config.defaultStartTime == DEFAULT_START_TIME_NEXT_FULL_HOUR) { settings_default_start_time.text = getString(R.string.next_full_hour) } else { val hours = config.defaultStartTime / 60 diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt index a2f1e9723..bb7f963f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt @@ -155,7 +155,7 @@ class Config(context: Context) : BaseConfig(context) { set(lastVibrateOnReminder) = prefs.edit().putBoolean(LAST_VIBRATE_ON_REMINDER, lastVibrateOnReminder).apply() var defaultStartTime: Int - get() = prefs.getInt(DEFAULT_START_TIME, -1) + get() = prefs.getInt(DEFAULT_START_TIME, DEFAULT_START_TIME_NEXT_FULL_HOUR) set(defaultStartTime) = prefs.edit().putInt(DEFAULT_START_TIME, defaultStartTime).apply() var defaultDuration: Int diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index c62498e84..1a30e347a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -34,6 +34,8 @@ const val ITEM_EVENT = 0 const val ITEM_EVENT_SIMPLE = 1 const val ITEM_HEADER = 2 +const val DEFAULT_START_TIME_NEXT_FULL_HOUR = -1 + const val DAY = 86400 const val WEEK = 604800 const val MONTH = 2592001 // exact value not taken into account, Joda is used for adding months and years