mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Rearrange settings based on player backend
This commit is contained in:
parent
adbbd1c648
commit
24e4acec11
4 changed files with 35 additions and 11 deletions
|
|
@ -2,6 +2,7 @@ package com.github.damontecres.wholphin.ui.preferences
|
|||
|
||||
import androidx.annotation.StringRes
|
||||
import com.github.damontecres.wholphin.preferences.AppPreference
|
||||
import com.github.damontecres.wholphin.preferences.AppPreferences
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
|
|
@ -10,6 +11,12 @@ import kotlinx.serialization.Serializable
|
|||
data class PreferenceGroup(
|
||||
@param:StringRes val title: Int,
|
||||
val preferences: List<AppPreference<out Any?>>,
|
||||
val conditionalPreferences: List<ConditionalPreferences> = listOf(),
|
||||
)
|
||||
|
||||
data class ConditionalPreferences(
|
||||
val condition: (AppPreferences) -> Boolean,
|
||||
val preferences: List<AppPreference<out Any?>>,
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -175,7 +175,13 @@ fun PreferencesContent(
|
|||
.padding(top = 8.dp, bottom = 4.dp),
|
||||
)
|
||||
}
|
||||
group.preferences.forEachIndexed { prefIndex, pref ->
|
||||
val groupPreferences =
|
||||
group.preferences +
|
||||
group.conditionalPreferences
|
||||
.filter { it.condition.invoke(preferences) }
|
||||
.map { it.preferences }
|
||||
.flatten()
|
||||
groupPreferences.forEachIndexed { prefIndex, pref ->
|
||||
pref as AppPreference<Any>
|
||||
item {
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue