mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-09 16:11:20 +02:00
Add toggle for using series image
This commit is contained in:
parent
b73900b698
commit
44a08f27c1
5 changed files with 40 additions and 19 deletions
|
|
@ -110,7 +110,7 @@ class HomeSettingsService
|
|||
displayPreferencesId: String = DISPLAY_PREF_ID,
|
||||
): HomePageSettings? {
|
||||
val current = getDisplayPreferences(userId, displayPreferencesId)
|
||||
return current.customPrefs[DISPLAY_PREF_ID]?.let {
|
||||
return current.customPrefs[CUSTOM_PREF_ID]?.let {
|
||||
val jsonElement = jsonParser.parseToJsonElement(it)
|
||||
decode(jsonElement)
|
||||
}
|
||||
|
|
@ -515,7 +515,13 @@ class HomeSettingsService
|
|||
): HomeRowLoadingState =
|
||||
when (row) {
|
||||
is HomeRowConfig.ContinueWatching -> {
|
||||
val resume = latestNextUpService.getResume(userDto.id, limit, true)
|
||||
val resume =
|
||||
latestNextUpService.getResume(
|
||||
userDto.id,
|
||||
limit,
|
||||
true,
|
||||
row.viewOptions.useSeries,
|
||||
)
|
||||
|
||||
Success(
|
||||
title = context.getString(R.string.continue_watching),
|
||||
|
|
@ -531,6 +537,7 @@ class HomeSettingsService
|
|||
limit,
|
||||
prefs.enableRewatchingNextUp,
|
||||
false,
|
||||
row.viewOptions.useSeries,
|
||||
)
|
||||
|
||||
Success(
|
||||
|
|
@ -542,13 +549,19 @@ class HomeSettingsService
|
|||
|
||||
is HomeRowConfig.ContinueWatchingCombined -> {
|
||||
val resume =
|
||||
latestNextUpService.getResume(userDto.id, limit, true)
|
||||
latestNextUpService.getResume(
|
||||
userDto.id,
|
||||
limit,
|
||||
true,
|
||||
row.viewOptions.useSeries,
|
||||
)
|
||||
val nextUp =
|
||||
latestNextUpService.getNextUp(
|
||||
userDto.id,
|
||||
limit,
|
||||
prefs.enableRewatchingNextUp,
|
||||
false,
|
||||
row.viewOptions.useSeries,
|
||||
)
|
||||
|
||||
Success(
|
||||
|
|
@ -625,7 +638,7 @@ class HomeSettingsService
|
|||
api.userLibraryApi
|
||||
.getLatestMedia(request)
|
||||
.content
|
||||
.map { BaseItem.Companion.from(it, api, true) }
|
||||
.map { BaseItem.Companion.from(it, api, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
title,
|
||||
|
|
@ -657,7 +670,7 @@ class HomeSettingsService
|
|||
GetItemsRequestHandler
|
||||
.execute(api, request)
|
||||
.content.items
|
||||
.map { BaseItem.Companion.from(it, api, true) }
|
||||
.map { BaseItem.Companion.from(it, api, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
title,
|
||||
|
|
@ -685,7 +698,7 @@ class HomeSettingsService
|
|||
GetItemsRequestHandler
|
||||
.execute(api, request)
|
||||
.content.items
|
||||
.map { BaseItem(it, true) }
|
||||
.map { BaseItem(it, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
name ?: context.getString(R.string.collection),
|
||||
|
|
@ -712,7 +725,7 @@ class HomeSettingsService
|
|||
GetItemsRequestHandler
|
||||
.execute(api, request)
|
||||
.content.items
|
||||
.map { BaseItem(it, true) }
|
||||
.map { BaseItem(it, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
row.name,
|
||||
|
|
@ -757,7 +770,7 @@ class HomeSettingsService
|
|||
GetItemsRequestHandler
|
||||
.execute(api, request)
|
||||
.content.items
|
||||
.map { BaseItem(it, false) }
|
||||
.map { BaseItem(it, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
context.getString(R.string.favorites), // TODO
|
||||
|
|
@ -781,7 +794,7 @@ class HomeSettingsService
|
|||
api.liveTvApi
|
||||
.getRecordings(request)
|
||||
.content.items
|
||||
.map { BaseItem(it, true) }
|
||||
.map { BaseItem(it, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
context.getString(R.string.active_recordings),
|
||||
|
|
@ -803,7 +816,7 @@ class HomeSettingsService
|
|||
api.liveTvApi
|
||||
.getRecommendedPrograms(request)
|
||||
.content.items
|
||||
.map { BaseItem(it, true) }
|
||||
.map { BaseItem(it, row.viewOptions.useSeries) }
|
||||
.let {
|
||||
Success(
|
||||
context.getString(R.string.live_tv),
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class LatestNextUpService
|
|||
userId: UUID,
|
||||
limit: Int,
|
||||
includeEpisodes: Boolean,
|
||||
useSeriesForPrimary: Boolean = true,
|
||||
): List<BaseItem> {
|
||||
val request =
|
||||
GetResumeItemsRequest(
|
||||
|
|
@ -65,7 +66,7 @@ class LatestNextUpService
|
|||
.getResumeItems(request)
|
||||
.content
|
||||
.items
|
||||
.map { BaseItem.from(it, api, true) }
|
||||
.map { BaseItem.from(it, api, useSeriesForPrimary) }
|
||||
return items
|
||||
}
|
||||
|
||||
|
|
@ -74,6 +75,7 @@ class LatestNextUpService
|
|||
limit: Int,
|
||||
enableRewatching: Boolean,
|
||||
enableResumable: Boolean,
|
||||
useSeriesForPrimary: Boolean = true,
|
||||
): List<BaseItem> {
|
||||
val request =
|
||||
GetNextUpRequest(
|
||||
|
|
@ -91,7 +93,7 @@ class LatestNextUpService
|
|||
.getNextUp(request)
|
||||
.content
|
||||
.items
|
||||
.map { BaseItem.from(it, api, true) }
|
||||
.map { BaseItem.from(it, api, useSeriesForPrimary) }
|
||||
return nextUp
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ internal object Options {
|
|||
|
||||
val ViewOptionsUseSeries =
|
||||
AppSwitchPreference<HomeRowViewOptions>(
|
||||
title = R.string.go_to_series, // TODO
|
||||
title = R.string.use_series,
|
||||
defaultValue = true,
|
||||
getter = { it.useSeries },
|
||||
setter = { vo, value -> vo.copy(useSeries = value) },
|
||||
|
|
@ -175,11 +175,11 @@ internal object Options {
|
|||
ViewOptionsAspectRatio,
|
||||
// TODO
|
||||
// ViewOptionsShowTitles,
|
||||
// ViewOptionsUseSeries,
|
||||
ViewOptionsUseSeries,
|
||||
ViewOptionsColumns,
|
||||
ViewOptionsSpacing,
|
||||
ViewOptionsContentScale,
|
||||
ViewOptionsApplyAll,
|
||||
// ViewOptionsApplyAll,
|
||||
ViewOptionsReset,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -296,13 +296,15 @@ class HomeSettingsViewModel
|
|||
viewOptions: HomeRowViewOptions,
|
||||
) {
|
||||
viewModelScope.launchIO {
|
||||
var fetchData = false
|
||||
updateState {
|
||||
val index = it.rows.indexOfFirst { it.id == rowId }
|
||||
val newRowConfig =
|
||||
it.rows[index]
|
||||
.config
|
||||
.updateViewOptions(viewOptions)
|
||||
val config = it.rows[index].config
|
||||
val newRowConfig = config.updateViewOptions(viewOptions)
|
||||
val newRow = it.rows[index].copy(config = newRowConfig)
|
||||
if (config.viewOptions.useSeries != viewOptions.useSeries) {
|
||||
fetchData = true
|
||||
}
|
||||
it.copy(
|
||||
rows =
|
||||
it.rows.toMutableList().apply {
|
||||
|
|
@ -321,6 +323,9 @@ class HomeSettingsViewModel
|
|||
},
|
||||
)
|
||||
}
|
||||
if (fetchData) {
|
||||
fetchRowData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -472,6 +472,7 @@
|
|||
<string name="load_from_server">Load from server</string>
|
||||
<string name="save_to_server">Save to server</string>
|
||||
<string name="load_from_web_client">Load from web client</string>
|
||||
<string name="use_series">Use series image</string>
|
||||
|
||||
<string-array name="theme_song_volume">
|
||||
<item>Disabled</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue