mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor: Change Page.State to sealed interface
This commit is contained in:
parent
18528fbd92
commit
370bb62ef9
14 changed files with 63 additions and 66 deletions
|
@ -19,7 +19,7 @@ open class Page(
|
|||
get() = index + 1
|
||||
|
||||
@Transient
|
||||
private val _statusFlow = MutableStateFlow(State.QUEUE)
|
||||
private val _statusFlow = MutableStateFlow<State>(State.Queue)
|
||||
|
||||
@Transient
|
||||
val statusFlow = _statusFlow.asStateFlow()
|
||||
|
@ -48,11 +48,11 @@ open class Page(
|
|||
}
|
||||
}
|
||||
|
||||
enum class State {
|
||||
QUEUE,
|
||||
LOAD_PAGE,
|
||||
DOWNLOAD_IMAGE,
|
||||
READY,
|
||||
ERROR,
|
||||
sealed interface State {
|
||||
data object Queue : State
|
||||
data object LoadPage : State
|
||||
data object DownloadImage : State
|
||||
data object Ready : State
|
||||
data object Error : State
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue