From 87a109c6b6a19b73a7ca0664676333e81ab57ef4 Mon Sep 17 00:00:00 2001 From: Damontecres Date: Tue, 19 May 2026 14:11:40 -0400 Subject: [PATCH] Add option for click to play continue watching/next up rows (#1405) ## Description Adds an option under Settings->Customize home page->Settings, "Continue watching/Next up click behavior": - When disabled (the default), clicking goes to the item's details page - When enabled, clicking starts playback for the item from its resume position This only applies to the continue watching, next up, or combined rows. All other rows go to the details page no matter what. ### Related issues Closes #1007 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None --- .../wholphin/preferences/AppPreference.kt | 12 ++++++++++++ .../damontecres/wholphin/ui/main/HomePage.kt | 17 ++++++++++++++++- .../ui/main/settings/HomeSettingsGlobal.kt | 12 ++++++++++++ app/src/main/proto/WholphinDataStore.proto | 1 + app/src/main/res/values/strings.xml | 3 +++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/preferences/AppPreference.kt b/app/src/main/java/com/github/damontecres/wholphin/preferences/AppPreference.kt index ecaa0fac..e59e2dd0 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/preferences/AppPreference.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/preferences/AppPreference.kt @@ -226,6 +226,18 @@ sealed interface AppPreference { summaryOff = R.string.disabled, ) + val HomeClickToPlay = + AppSwitchPreference( + title = R.string.continue_watching_click_behavior, + defaultValue = false, + getter = { it.homePagePreferences.clickToPlay }, + setter = { prefs, value -> + prefs.updateHomePagePreferences { clickToPlay = value } + }, + summaryOn = R.string.continue_watching_click_summary_on, + summaryOff = R.string.continue_watching_click_summary_off, + ) + val PlayThemeMusic = AppChoicePreference( title = R.string.play_theme_music, diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/HomePage.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/HomePage.kt index 162f5f4a..f7ac3e7d 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/HomePage.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/HomePage.kt @@ -132,11 +132,18 @@ fun HomePage( var position by rememberPosition() val onFocusPosition = remember { { it: RowColumn -> position = it } } + val currentHomePrefs by rememberUpdatedState(preferences.appPreferences.homePagePreferences) val onClickItem = remember { { clickedPosition: RowColumn, item: BaseItem -> position = clickedPosition - viewModel.navigationManager.navigateTo(item.destination()) + if (currentHomePrefs.clickToPlay && + homeRows.getOrNull(clickedPosition.row)?.isContinueWatchingNextUp == true + ) { + viewModel.navigationManager.navigateTo(Destination.Playback(item)) + } else { + viewModel.navigationManager.navigateTo(item.destination()) + } } } val onLongClickItem = @@ -256,6 +263,14 @@ fun HomePage( } } +val HomeRowLoadingState?.isContinueWatchingNextUp: Boolean + get() = + (this as? HomeRowLoadingState.Success).let { row -> + row?.rowType is HomeRowConfig.ContinueWatching || + row?.rowType is HomeRowConfig.NextUp || + row?.rowType is HomeRowConfig.ContinueWatchingCombined + } + @OptIn(ExperimentalFoundationApi::class) @Composable fun HomePageContent( diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsGlobal.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsGlobal.kt index 35c17a7e..cc463b35 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsGlobal.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeSettingsGlobal.kt @@ -94,6 +94,18 @@ fun HomeSettingsGlobal( modifier = Modifier, ) } + item { + ComposablePreference( + preference = AppPreference.HomeClickToPlay, + value = AppPreference.HomeClickToPlay.getter.invoke(preferences), + onValueChange = { + val newPrefs = AppPreference.HomeClickToPlay.setter.invoke(preferences, it) + onPreferenceChange.invoke(newPrefs) + }, + onNavigate = {}, + modifier = Modifier, + ) + } item { HorizontalDivider() } item { HomeSettingsListItem( diff --git a/app/src/main/proto/WholphinDataStore.proto b/app/src/main/proto/WholphinDataStore.proto index a29c59ac..c979402d 100644 --- a/app/src/main/proto/WholphinDataStore.proto +++ b/app/src/main/proto/WholphinDataStore.proto @@ -94,6 +94,7 @@ message HomePagePreferences{ bool enable_rewatching_next_up = 2; bool combine_continue_next = 3; int32 max_days_next_up = 4; + bool click_to_play = 5; } enum ThemeSongVolume { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 15ab0182..9642625b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -778,6 +778,9 @@ For intros, credits, etc Play with Transcoding + Continue watching/Next up click behavior + Play on click + Show details on click @string/ass_subtitle_mode_libass @string/ass_subtitle_mode_exoplayer