Minor cleanup
This commit is contained in:
parent
526ee7dda9
commit
22d8711cee
@ -225,7 +225,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
||||
onDaysSelected: (Int) -> Unit,
|
||||
) {
|
||||
val selected = remember(initialSelection) {
|
||||
DayOption.values().filter { it.day and initialSelection == it.day }
|
||||
DayOption.entries.filter { it.day and initialSelection == it.day }
|
||||
.toMutableStateList()
|
||||
}
|
||||
AlertDialog(
|
||||
@ -233,7 +233,7 @@ object SettingsSecurityScreen : SearchableSettings {
|
||||
title = { Text(text = stringResource(SYMR.strings.biometric_lock_days)) },
|
||||
text = {
|
||||
LazyColumn {
|
||||
DayOption.values().forEach { day ->
|
||||
DayOption.entries.forEach { day ->
|
||||
item {
|
||||
val isSelected = selected.contains(day)
|
||||
val onSelectionChanged = {
|
||||
|
@ -862,7 +862,7 @@ class LibraryScreenModel(
|
||||
} else {
|
||||
categoryName
|
||||
}
|
||||
LibraryGroup.BY_TRACK_STATUS -> TrackStatus.values()
|
||||
LibraryGroup.BY_TRACK_STATUS -> TrackStatus.entries
|
||||
.find { it.int.toLong() == category?.id }
|
||||
.let { it ?: TrackStatus.OTHER }
|
||||
.let { context.stringResource(it.res) }
|
||||
@ -1171,11 +1171,11 @@ class LibraryScreenModel(
|
||||
}.mapKeys { (id) ->
|
||||
Category(
|
||||
id = id.toLong(),
|
||||
name = TrackStatus.values()
|
||||
name = TrackStatus.entries
|
||||
.find { it.int == id }
|
||||
.let { it ?: TrackStatus.OTHER }
|
||||
.let { context.stringResource(it.res) },
|
||||
order = TrackStatus.values().indexOfFirst {
|
||||
order = TrackStatus.entries.indexOfFirst {
|
||||
it.int == id
|
||||
}.takeUnless { it == -1 }?.toLong() ?: TrackStatus.OTHER.ordinal.toLong(),
|
||||
flags = 0,
|
||||
|
@ -52,6 +52,9 @@ import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
|
||||
import eu.kanade.presentation.more.settings.widget.TrailingWidgetBuffer
|
||||
import eu.kanade.presentation.util.Screen
|
||||
import exh.util.capitalize
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@ -77,7 +80,7 @@ class SettingsDebugScreen : Screen() {
|
||||
DisposableEffect(Unit) {
|
||||
onDispose { navigator.pop() }
|
||||
}
|
||||
val functions by produceState<List<Pair<KFunction<*>, String>>?>(initialValue = null) {
|
||||
val functions by produceState<ImmutableList<Pair<KFunction<*>, String>>?>(initialValue = null) {
|
||||
value = withContext(Dispatchers.Default) {
|
||||
DebugFunctions::class.declaredFunctions.filter {
|
||||
it.visibility == KVisibility.PUBLIC
|
||||
@ -85,12 +88,12 @@ class SettingsDebugScreen : Screen() {
|
||||
it to it.name.replace("(.)(\\p{Upper})".toRegex(), "$1 $2")
|
||||
.lowercase(Locale.getDefault())
|
||||
.capitalize(Locale.getDefault())
|
||||
}
|
||||
}.toImmutableList()
|
||||
}
|
||||
}
|
||||
val toggles by produceState(initialValue = emptyList()) {
|
||||
val toggles by produceState(initialValue = persistentListOf()) {
|
||||
value = withContext(Dispatchers.Default) {
|
||||
DebugToggles.values().map { DebugToggle(it.name, it.asPref(scope), it.default) }
|
||||
DebugToggles.entries.map { DebugToggle(it.name, it.asPref(scope), it.default) }.toImmutableList()
|
||||
}
|
||||
}
|
||||
Scaffold(
|
||||
@ -101,10 +104,10 @@ class SettingsDebugScreen : Screen() {
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
Crossfade(functions == null) {
|
||||
Crossfade(functions == null, label = "debug_functions") {
|
||||
when (it) {
|
||||
true -> LoadingScreen()
|
||||
false -> FunctionList(paddingValues, functions.orEmpty(), toggles, scope)
|
||||
false -> FunctionList(paddingValues, functions ?: persistentListOf(), toggles, scope)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,8 +116,8 @@ class SettingsDebugScreen : Screen() {
|
||||
@Composable
|
||||
fun FunctionList(
|
||||
paddingValues: PaddingValues,
|
||||
functions: List<Pair<KFunction<*>, String>>,
|
||||
toggles: List<DebugToggle>,
|
||||
functions: ImmutableList<Pair<KFunction<*>, String>>,
|
||||
toggles: ImmutableList<DebugToggle>,
|
||||
scope: CoroutineScope,
|
||||
) {
|
||||
Box(Modifier.fillMaxSize()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user