Disable discover & use different settings for genre rows

This commit is contained in:
Damontecres 2026-01-29 16:56:11 -05:00
parent 44a08f27c1
commit 43fde88695
No known key found for this signature in database
3 changed files with 19 additions and 6 deletions

View file

@ -37,9 +37,11 @@ fun HomeRowSettings(
viewOptions: HomeRowViewOptions, viewOptions: HomeRowViewOptions,
onViewOptionsChange: (HomeRowViewOptions) -> Unit, onViewOptionsChange: (HomeRowViewOptions) -> Unit,
onApplyApplyAll: () -> Unit, onApplyApplyAll: () -> Unit,
userGenreSettings: Boolean,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
defaultViewOptions: HomeRowViewOptions = HomeRowViewOptions(), defaultViewOptions: HomeRowViewOptions = HomeRowViewOptions(),
) { ) {
val options = if (userGenreSettings) Options.GENRE_OPTIONS else Options.OPTIONS
val firstFocus = remember { FocusRequester() } val firstFocus = remember { FocusRequester() }
LaunchedEffect(Unit) { firstFocus.tryRequestFocus() } LaunchedEffect(Unit) { firstFocus.tryRequestFocus() }
Column(modifier = modifier) { Column(modifier = modifier) {
@ -49,7 +51,7 @@ fun HomeRowSettings(
color = MaterialTheme.colorScheme.onSurface, color = MaterialTheme.colorScheme.onSurface,
) )
LazyColumn { LazyColumn {
itemsIndexed(Options.OPTIONS) { index, pref -> itemsIndexed(options) { index, pref ->
pref as AppPreference<HomeRowViewOptions, Any> pref as AppPreference<HomeRowViewOptions, Any>
val interactionSource = remember { MutableInteractionSource() } val interactionSource = remember { MutableInteractionSource() }
val value = pref.getter.invoke(viewOptions) val value = pref.getter.invoke(viewOptions)
@ -82,7 +84,7 @@ fun HomeRowSettings(
} }
internal object Options { internal object Options {
val ViewOptionsColumns = val ViewOptionsCardHeight =
AppSliderPreference<HomeRowViewOptions>( AppSliderPreference<HomeRowViewOptions>(
title = R.string.height, title = R.string.height,
defaultValue = Cards.HEIGHT_2X3_DP.toLong(), defaultValue = Cards.HEIGHT_2X3_DP.toLong(),
@ -176,10 +178,17 @@ internal object Options {
// TODO // TODO
// ViewOptionsShowTitles, // ViewOptionsShowTitles,
ViewOptionsUseSeries, ViewOptionsUseSeries,
ViewOptionsColumns, ViewOptionsCardHeight,
ViewOptionsSpacing, ViewOptionsSpacing,
ViewOptionsContentScale, ViewOptionsContentScale,
// ViewOptionsApplyAll, // ViewOptionsApplyAll,
ViewOptionsReset, ViewOptionsReset,
) )
val GENRE_OPTIONS =
listOf(
ViewOptionsCardHeight,
ViewOptionsSpacing,
ViewOptionsReset,
)
} }

View file

@ -56,7 +56,7 @@ fun HomeSettingsFavoriteList(
} }
} }
val favoriteOptions = val favoriteOptions by lazy {
mapOf( mapOf(
BaseItemKind.MOVIE to R.string.movies, BaseItemKind.MOVIE to R.string.movies,
BaseItemKind.SERIES to R.string.tv_shows, BaseItemKind.SERIES to R.string.tv_shows,
@ -65,4 +65,5 @@ val favoriteOptions =
BaseItemKind.PLAYLIST to R.string.playlists, BaseItemKind.PLAYLIST to R.string.playlists,
BaseItemKind.PERSON to R.string.people, BaseItemKind.PERSON to R.string.people,
) )
val favoriteOptionsList = favoriteOptions.keys.toList() }
val favoriteOptionsList by lazy { favoriteOptions.keys.toList() }

View file

@ -28,6 +28,7 @@ import androidx.navigation3.ui.NavDisplay
import androidx.tv.material3.MaterialTheme import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.surfaceColorAtElevation import androidx.tv.material3.surfaceColorAtElevation
import com.github.damontecres.wholphin.R import com.github.damontecres.wholphin.R
import com.github.damontecres.wholphin.data.model.HomeRowConfig
import com.github.damontecres.wholphin.ui.components.ConfirmDialog import com.github.damontecres.wholphin.ui.components.ConfirmDialog
import com.github.damontecres.wholphin.ui.main.HomePageContent import com.github.damontecres.wholphin.ui.main.HomePageContent
import com.github.damontecres.wholphin.ui.main.settings.HomeSettingsDestination.ChooseRowType import com.github.damontecres.wholphin.ui.main.settings.HomeSettingsDestination.ChooseRowType
@ -50,7 +51,8 @@ fun HomeSettingsPage(
var showConfirmDialog by remember { mutableStateOf<(() -> Unit)?>(null) } var showConfirmDialog by remember { mutableStateOf<(() -> Unit)?>(null) }
val state by viewModel.state.collectAsState() val state by viewModel.state.collectAsState()
val discoverEnabled by viewModel.discoverEnabled.collectAsState(false) // TODO discover rows
val discoverEnabled = false // by viewModel.discoverEnabled.collectAsState(false)
// Adds a row, waits until its done loading, then scrolls to the new row // Adds a row, waits until its done loading, then scrolls to the new row
fun addRow(func: () -> Job) { fun addRow(func: () -> Job) {
@ -157,6 +159,7 @@ fun HomeSettingsPage(
onApplyApplyAll = { onApplyApplyAll = {
viewModel.updateViewOptionsForAll(row.config.viewOptions) viewModel.updateViewOptionsForAll(row.config.viewOptions)
}, },
userGenreSettings = row.config is HomeRowConfig.Genres,
modifier = destModifier, modifier = destModifier,
) )
} }