handle multiple timer states

- feat: separate timer actions from states by adding a new class TimerEvent to hold actions Reset, Start, Pause, Finish, Refesh that could be performed on a timer.
- feat: handle multiple countdown timers in the App file by creating a map of the timer id to the countdown timer.
- fix: use gson instance from  TypeAdapter in Room's Converters class
- ref: remove scroll view parent from each timer item, a fix for the keyboard obscuring a label will be implemented in a future commit
This commit is contained in:
Paul Akhamiogu
2021-09-01 19:58:38 +01:00
parent 921ca92885
commit 8474e6a800
15 changed files with 266 additions and 232 deletions

View File

@ -0,0 +1,9 @@
package com.simplemobiletools.clock.models
sealed class TimerEvent(open val timerId: Long) {
data class Reset(override val timerId: Long, val duration: Long) : TimerEvent(timerId)
data class Start(override val timerId: Long, val duration: Long) : TimerEvent(timerId)
data class Pause(override val timerId: Long, val duration: Long) : TimerEvent(timerId)
data class Finish(override val timerId: Long, val duration: Long) : TimerEvent(timerId)
data class Refresh(override val timerId: Long) : TimerEvent(timerId)
}