This commit is contained in:
Pavol Franek
2020-03-08 10:47:42 +01:00
parent c3ab1f9330
commit ed18715b39
4 changed files with 98 additions and 80 deletions

View File

@ -5,7 +5,6 @@ import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
import com.simplemobiletools.commons.extensions.getDefaultAlarmUri
import com.simplemobiletools.commons.helpers.ALARM_SOUND_TYPE_ALARM
import com.simplemobiletools.commons.helpers.BaseConfig
import java.util.concurrent.TimeUnit
class Config(context: Context) : BaseConfig(context) {
companion object {
@ -28,9 +27,13 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(TIMER_SECONDS, 300)
set(lastTimerSeconds) = prefs.edit().putInt(TIMER_SECONDS, lastTimerSeconds).apply()
var timerTimeStamp: Long
get() = prefs.getLong(TIMER_TIMESTAMP, System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(timerSeconds.toLong()))
set(timestamp) = prefs.edit().putLong(TIMER_TIMESTAMP, timestamp).apply()
var timerStartStamp: Long
get() = prefs.getLong(TIMER_START_TIMESTAMP, 0L)
set(timestamp) = prefs.edit().putLong(TIMER_START_TIMESTAMP, timestamp).apply()
var timerTickStamp: Long
get() = prefs.getLong(TIMER_TICK_TIMESTAMP, 0L)
set(timestamp) = prefs.edit().putLong(TIMER_TICK_TIMESTAMP, timestamp).apply()
var timerVibrate: Boolean
get() = prefs.getBoolean(TIMER_VIBRATE, false)