mirror of
https://github.com/mihonapp/mihon.git
synced 2024-10-31 21:20:59 -04:00
92e83f702c
TODO: - Global search should launch a controller with the search textfield focused. This is pending a Compose rewrite of that screen. - Better migrate sort UI - Extensions search
28 lines
1.1 KiB
Kotlin
28 lines
1.1 KiB
Kotlin
package eu.kanade.presentation.browse
|
|
|
|
import androidx.compose.runtime.derivedStateOf
|
|
import androidx.compose.runtime.getValue
|
|
import androidx.compose.runtime.mutableStateOf
|
|
import androidx.compose.runtime.setValue
|
|
import eu.kanade.domain.source.interactor.SetMigrateSorting
|
|
import eu.kanade.domain.source.model.Source
|
|
|
|
interface MigrateSourceState {
|
|
val isLoading: Boolean
|
|
val items: List<Pair<Source, Long>>
|
|
val isEmpty: Boolean
|
|
val sortingMode: SetMigrateSorting.Mode
|
|
val sortingDirection: SetMigrateSorting.Direction
|
|
}
|
|
|
|
fun MigrateSourceState(): MigrateSourceState {
|
|
return MigrateSourceStateImpl()
|
|
}
|
|
|
|
class MigrateSourceStateImpl : MigrateSourceState {
|
|
override var isLoading: Boolean by mutableStateOf(true)
|
|
override var items: List<Pair<Source, Long>> by mutableStateOf(emptyList())
|
|
override val isEmpty: Boolean by derivedStateOf { items.isEmpty() }
|
|
override var sortingMode: SetMigrateSorting.Mode by mutableStateOf(SetMigrateSorting.Mode.ALPHABETICAL)
|
|
override var sortingDirection: SetMigrateSorting.Direction by mutableStateOf(SetMigrateSorting.Direction.ASCENDING)
|
|
}
|