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