Implement concise view for timer

- implement EditTimerDialog
- adding a new timer would show the dialog
- clicking on a timer item would show the dialog
This commit is contained in:
Paul Akhamiogu
2021-09-07 15:24:21 +01:00
parent bd05a41b35
commit e1357ecd8f
10 changed files with 330 additions and 239 deletions

View File

@ -5,6 +5,7 @@ import android.media.RingtoneManager
import com.simplemobiletools.clock.extensions.gson.gson
import com.simplemobiletools.clock.models.Alarm
import com.simplemobiletools.clock.models.StateWrapper
import com.simplemobiletools.clock.models.Timer
import com.simplemobiletools.clock.models.TimerState
import com.simplemobiletools.commons.extensions.getDefaultAlarmSound
import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
@ -79,6 +80,12 @@ class Config(context: Context) : BaseConfig(context) {
}
set(alarm) = prefs.edit().putString(ALARM_LAST_CONFIG, gson.toJson(alarm)).apply()
var timerLastConfig: Timer?
get() = prefs.getString(TIMER_LAST_CONFIG, null)?.let { lastAlarm ->
gson.fromJson(lastAlarm, Timer::class.java)
}
set(alarm) = prefs.edit().putString(TIMER_LAST_CONFIG, gson.toJson(alarm)).apply()
var timerChannelId: String?
get() = prefs.getString(TIMER_CHANNEL_ID, null)
set(id) = prefs.edit().putString(TIMER_CHANNEL_ID, id).apply()