From 43fde88695474d14916ed871f767bccce8fa9ea8 Mon Sep 17 00:00:00 2001 From: Damontecres Date: Thu, 29 Jan 2026 16:56:11 -0500 Subject: [PATCH] Disable discover & use different settings for genre rows --- .../wholphin/ui/main/settings/HomeRowSettings.kt | 15 ++++++++++++--- .../ui/main/settings/HomeSettingsFavoriteList.kt | 5 +++-- .../wholphin/ui/main/settings/HomeSettingsPage.kt | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowSettings.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowSettings.kt index 457a7e3d..b31245e8 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowSettings.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowSettings.kt @@ -37,9 +37,11 @@ fun HomeRowSettings( viewOptions: HomeRowViewOptions, onViewOptionsChange: (HomeRowViewOptions) -> Unit, onApplyApplyAll: () -> Unit, + userGenreSettings: Boolean, modifier: Modifier = Modifier, defaultViewOptions: HomeRowViewOptions = HomeRowViewOptions(), ) { + val options = if (userGenreSettings) Options.GENRE_OPTIONS else Options.OPTIONS val firstFocus = remember { FocusRequester() } LaunchedEffect(Unit) { firstFocus.tryRequestFocus() } Column(modifier = modifier) { @@ -49,7 +51,7 @@ fun HomeRowSettings( color = MaterialTheme.colorScheme.onSurface, ) LazyColumn { - itemsIndexed(Options.OPTIONS) { index, pref -> + itemsIndexed(options) { index, pref -> pref as AppPreference val interactionSource = remember { MutableInteractionSource() } val value = pref.getter.invoke(viewOptions) @@ -82,7 +84,7 @@ fun HomeRowSettings( } internal object Options { - val ViewOptionsColumns = + val ViewOptionsCardHeight = AppSliderPreference( title = R.string.height, defaultValue = Cards.HEIGHT_2X3_DP.toLong(), @@ -176,10 +178,17 @@ internal object Options { // TODO // ViewOptionsShowTitles, ViewOptionsUseSeries, - ViewOptionsColumns, + ViewOptionsCardHeight, ViewOptionsSpacing, ViewOptionsContentScale, // ViewOptionsApplyAll, ViewOptionsReset, ) + + val GENRE_OPTIONS = + listOf( + ViewOptionsCardHeight, + ViewOptionsSpacing, + ViewOptionsReset, + ) } diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsFavoriteList.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsFavoriteList.kt index c71e62eb..7e78e739 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsFavoriteList.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsFavoriteList.kt @@ -56,7 +56,7 @@ fun HomeSettingsFavoriteList( } } -val favoriteOptions = +val favoriteOptions by lazy { mapOf( BaseItemKind.MOVIE to R.string.movies, BaseItemKind.SERIES to R.string.tv_shows, @@ -65,4 +65,5 @@ val favoriteOptions = BaseItemKind.PLAYLIST to R.string.playlists, BaseItemKind.PERSON to R.string.people, ) -val favoriteOptionsList = favoriteOptions.keys.toList() +} +val favoriteOptionsList by lazy { favoriteOptions.keys.toList() } diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt index 386eae87..cd61e391 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsPage.kt @@ -28,6 +28,7 @@ import androidx.navigation3.ui.NavDisplay import androidx.tv.material3.MaterialTheme import androidx.tv.material3.surfaceColorAtElevation 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.main.HomePageContent import com.github.damontecres.wholphin.ui.main.settings.HomeSettingsDestination.ChooseRowType @@ -50,7 +51,8 @@ fun HomeSettingsPage( var showConfirmDialog by remember { mutableStateOf<(() -> Unit)?>(null) } 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 fun addRow(func: () -> Job) { @@ -157,6 +159,7 @@ fun HomeSettingsPage( onApplyApplyAll = { viewModel.updateViewOptionsForAll(row.config.viewOptions) }, + userGenreSettings = row.config is HomeRowConfig.Genres, modifier = destModifier, ) }