feat: Add option to sort alarms

This commit is contained in:
jkemming
2020-12-26 14:09:14 +01:00
committed by jkemming
parent 6c91e072cc
commit 12ee706b4e
37 changed files with 198 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.clock.helpers
import android.content.Context
import com.simplemobiletools.clock.models.AlarmSort
import com.simplemobiletools.clock.extensions.gson.gson
import com.simplemobiletools.clock.models.Alarm
import com.simplemobiletools.clock.models.StateWrapper
@ -57,6 +58,11 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getString(TIMER_LABEL, null)
set(label) = prefs.edit().putString(TIMER_LABEL, label).apply()
var alarmSort: AlarmSort
get() = AlarmSort.valueOf(prefs.getInt(ALARM_SORT, AlarmSort.default().value))
?: AlarmSort.default()
set(alarmSort) = prefs.edit().putInt(ALARM_SORT, alarmSort.value).apply()
var alarmMaxReminderSecs: Int
get() = prefs.getInt(ALARM_MAX_REMINDER_SECS, DEFAULT_MAX_ALARM_REMINDER_SECS)
set(alarmMaxReminderSecs) = prefs.edit().putInt(ALARM_MAX_REMINDER_SECS, alarmMaxReminderSecs).apply()