Option to combine continue watching & next up rows (#192)

A real implementation for combining the `Continue Watching` and `Next
Up` rows on the home page.

It requires a query for every next up item, so it could become slow
especially for many items and larger servers. The app makes a best
effort to cache the information.

The order is determined by querying each episode in next up to associate
it to its immediately previous episode's last played date. Then both
continue watching & next up items are reversed sorted by the last played
data. So this only makes sense if you watch series in order.

Closes #19
This commit is contained in:
damontecres 2025-11-18 15:21:50 -05:00 committed by GitHub
parent 46415fcdd0
commit cda5b118a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 232 additions and 63 deletions

View file

@ -217,7 +217,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.theme_song_volume,
indexToValue = { ThemeSongVolume.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != ThemeSongVolume.UNRECOGNIZED) it.number else 0 },
)
val PlaybackDebugInfo =
@ -433,7 +433,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.app_theme_colors,
indexToValue = { AppThemeColors.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != AppThemeColors.UNRECOGNIZED) it.number else 0 },
)
val InstalledVersion =
@ -495,7 +495,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.skip_behaviors,
indexToValue = { SkipSegmentBehavior.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != SkipSegmentBehavior.UNRECOGNIZED) it.number else 0 },
)
val SkipOutros =
@ -508,7 +508,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.skip_behaviors,
indexToValue = { SkipSegmentBehavior.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != SkipSegmentBehavior.UNRECOGNIZED) it.number else 0 },
)
val SkipCommercials =
@ -521,7 +521,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.skip_behaviors,
indexToValue = { SkipSegmentBehavior.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != SkipSegmentBehavior.UNRECOGNIZED) it.number else 0 },
)
val SkipPreviews =
@ -534,7 +534,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.skip_behaviors,
indexToValue = { SkipSegmentBehavior.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != SkipSegmentBehavior.UNRECOGNIZED) it.number else 0 },
)
val SkipRecaps =
@ -547,7 +547,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.skip_behaviors,
indexToValue = { SkipSegmentBehavior.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != SkipSegmentBehavior.UNRECOGNIZED) it.number else 0 },
)
val GlobalContentScale =
@ -560,7 +560,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.content_scale,
indexToValue = { PrefContentScale.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != PrefContentScale.UNRECOGNIZED) it.number else 0 },
)
val FfmpegPreference =
@ -573,7 +573,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.ffmpeg_extension_options,
indexToValue = { MediaExtensionStatus.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != MediaExtensionStatus.UNRECOGNIZED) it.number else 0 },
)
val ClearImageCache =
@ -641,7 +641,7 @@ sealed interface AppPreference<T> {
},
displayValues = R.array.show_next_up_when_options,
indexToValue = { ShowNextUpWhen.forNumber(it) },
valueToIndex = { it.number },
valueToIndex = { if (it != ShowNextUpWhen.UNRECOGNIZED) it.number else 0 },
)
val ShowClock =
@ -707,6 +707,7 @@ val basicPreferences =
preferences =
listOf(
AppPreference.HomePageItems,
AppPreference.CombineContinueNext,
AppPreference.RewatchNextUp,
AppPreference.PlayThemeMusic,
AppPreference.RememberSelectedTab,
@ -766,7 +767,6 @@ val advancedPreferences =
preferences =
listOf(
AppPreference.ShowClock,
AppPreference.CombineContinueNext,
// Temporarily disabled, see https://github.com/damontecres/Wholphin/pull/127#issuecomment-3478058418
// AppPreference.NavDrawerSwitchOnFocus,
AppPreference.ControllerTimeout,