mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Various fixes for home page customization (#902)
## Description Fixes several issues with home page customization such as - Displaying wrong episode-specific display options - Smaller text on cards without images - Prefer fill scaling for posters, like the old home page ### Related issues Related to #803 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
dc3c6dc739
commit
8c2227bf67
6 changed files with 21 additions and 13 deletions
|
|
@ -127,7 +127,7 @@ sealed interface HomeRowConfig {
|
||||||
@Serializable
|
@Serializable
|
||||||
@SerialName("TvPrograms")
|
@SerialName("TvPrograms")
|
||||||
data class TvPrograms(
|
data class TvPrograms(
|
||||||
override val viewOptions: HomeRowViewOptions = HomeRowViewOptions(),
|
override val viewOptions: HomeRowViewOptions = HomeRowViewOptions.liveTvDefault,
|
||||||
) : HomeRowConfig {
|
) : HomeRowConfig {
|
||||||
override fun updateViewOptions(viewOptions: HomeRowViewOptions): TvPrograms = this.copy(viewOptions = viewOptions)
|
override fun updateViewOptions(viewOptions: HomeRowViewOptions): TvPrograms = this.copy(viewOptions = viewOptions)
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ sealed interface HomeRowConfig {
|
||||||
@Serializable
|
@Serializable
|
||||||
@SerialName("TvChannels")
|
@SerialName("TvChannels")
|
||||||
data class TvChannels(
|
data class TvChannels(
|
||||||
override val viewOptions: HomeRowViewOptions = HomeRowViewOptions(),
|
override val viewOptions: HomeRowViewOptions = HomeRowViewOptions.liveTvDefault,
|
||||||
) : HomeRowConfig {
|
) : HomeRowConfig {
|
||||||
override fun updateViewOptions(viewOptions: HomeRowViewOptions): TvChannels = this.copy(viewOptions = viewOptions)
|
override fun updateViewOptions(viewOptions: HomeRowViewOptions): TvChannels = this.copy(viewOptions = viewOptions)
|
||||||
}
|
}
|
||||||
|
|
@ -213,12 +213,12 @@ const val SUPPORTED_HOME_PAGE_SETTINGS_VERSION = 1
|
||||||
data class HomeRowViewOptions(
|
data class HomeRowViewOptions(
|
||||||
val heightDp: Int = Cards.HEIGHT_2X3_DP,
|
val heightDp: Int = Cards.HEIGHT_2X3_DP,
|
||||||
val spacing: Int = 16,
|
val spacing: Int = 16,
|
||||||
val contentScale: PrefContentScale = PrefContentScale.FIT,
|
val contentScale: PrefContentScale = PrefContentScale.FILL,
|
||||||
val aspectRatio: AspectRatio = AspectRatio.TALL,
|
val aspectRatio: AspectRatio = AspectRatio.TALL,
|
||||||
val imageType: ViewOptionImageType = ViewOptionImageType.PRIMARY,
|
val imageType: ViewOptionImageType = ViewOptionImageType.PRIMARY,
|
||||||
val showTitles: Boolean = false,
|
val showTitles: Boolean = false,
|
||||||
val useSeries: Boolean = true,
|
val useSeries: Boolean = true,
|
||||||
val episodeContentScale: PrefContentScale = PrefContentScale.FIT,
|
val episodeContentScale: PrefContentScale = PrefContentScale.FILL,
|
||||||
val episodeAspectRatio: AspectRatio = AspectRatio.TALL,
|
val episodeAspectRatio: AspectRatio = AspectRatio.TALL,
|
||||||
val episodeImageType: ViewOptionImageType = ViewOptionImageType.PRIMARY,
|
val episodeImageType: ViewOptionImageType = ViewOptionImageType.PRIMARY,
|
||||||
) {
|
) {
|
||||||
|
|
@ -229,10 +229,11 @@ data class HomeRowViewOptions(
|
||||||
aspectRatio = AspectRatio.WIDE,
|
aspectRatio = AspectRatio.WIDE,
|
||||||
)
|
)
|
||||||
|
|
||||||
val channelsDefault =
|
val liveTvDefault =
|
||||||
HomeRowViewOptions(
|
HomeRowViewOptions(
|
||||||
heightDp = 96,
|
heightDp = 96,
|
||||||
aspectRatio = AspectRatio.WIDE,
|
aspectRatio = AspectRatio.WIDE,
|
||||||
|
contentScale = PrefContentScale.FIT,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -859,8 +859,10 @@ class HomeSettingsService
|
||||||
userId = userDto.id,
|
userId = userDto.id,
|
||||||
fields = DefaultItemFields,
|
fields = DefaultItemFields,
|
||||||
limit = limit,
|
limit = limit,
|
||||||
enableImages = true,
|
|
||||||
enableUserData = true,
|
enableUserData = true,
|
||||||
|
enableImages = true,
|
||||||
|
enableImageTypes = listOf(ImageType.PRIMARY),
|
||||||
|
imageTypeLimit = 1,
|
||||||
)
|
)
|
||||||
api.liveTvApi
|
api.liveTvApi
|
||||||
.getRecommendedPrograms(request)
|
.getRecommendedPrograms(request)
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ fun BannerCard(
|
||||||
Text(
|
Text(
|
||||||
text = name ?: "",
|
text = name ?: "",
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ data class HomeRowPresets(
|
||||||
val videoLibrary: HomeRowViewOptions,
|
val videoLibrary: HomeRowViewOptions,
|
||||||
val photoLibrary: HomeRowViewOptions,
|
val photoLibrary: HomeRowViewOptions,
|
||||||
val playlist: HomeRowViewOptions,
|
val playlist: HomeRowViewOptions,
|
||||||
|
val liveTv: HomeRowViewOptions,
|
||||||
val genreSize: Int,
|
val genreSize: Int,
|
||||||
) {
|
) {
|
||||||
fun getByCollectionType(collectionType: CollectionType): HomeRowViewOptions =
|
fun getByCollectionType(collectionType: CollectionType): HomeRowViewOptions =
|
||||||
|
|
@ -49,10 +50,11 @@ data class HomeRowPresets(
|
||||||
|
|
||||||
CollectionType.PHOTOS -> photoLibrary
|
CollectionType.PHOTOS -> photoLibrary
|
||||||
|
|
||||||
|
CollectionType.LIVETV -> liveTv
|
||||||
|
|
||||||
CollectionType.UNKNOWN,
|
CollectionType.UNKNOWN,
|
||||||
CollectionType.MUSIC,
|
CollectionType.MUSIC,
|
||||||
CollectionType.BOOKS,
|
CollectionType.BOOKS,
|
||||||
CollectionType.LIVETV,
|
|
||||||
CollectionType.PLAYLISTS,
|
CollectionType.PLAYLISTS,
|
||||||
CollectionType.FOLDERS,
|
CollectionType.FOLDERS,
|
||||||
-> HomeRowViewOptions()
|
-> HomeRowViewOptions()
|
||||||
|
|
@ -78,6 +80,7 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.SQUARE,
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
contentScale = PrefContentScale.FIT,
|
contentScale = PrefContentScale.FIT,
|
||||||
),
|
),
|
||||||
|
liveTv = HomeRowViewOptions.liveTvDefault,
|
||||||
genreSize = Cards.HEIGHT_2X3_DP,
|
genreSize = Cards.HEIGHT_2X3_DP,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -115,6 +118,7 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.SQUARE,
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
contentScale = PrefContentScale.FIT,
|
contentScale = PrefContentScale.FIT,
|
||||||
),
|
),
|
||||||
|
liveTv = HomeRowViewOptions.liveTvDefault,
|
||||||
genreSize = epHeight,
|
genreSize = epHeight,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -156,6 +160,7 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.SQUARE,
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
contentScale = PrefContentScale.FIT,
|
contentScale = PrefContentScale.FIT,
|
||||||
),
|
),
|
||||||
|
liveTv = HomeRowViewOptions.liveTvDefault,
|
||||||
genreSize = epHeight,
|
genreSize = epHeight,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ internal object Options {
|
||||||
title = R.string.global_content_scale,
|
title = R.string.global_content_scale,
|
||||||
defaultValue = PrefContentScale.FIT,
|
defaultValue = PrefContentScale.FIT,
|
||||||
displayValues = R.array.content_scale,
|
displayValues = R.array.content_scale,
|
||||||
getter = { it.contentScale },
|
getter = { it.episodeContentScale },
|
||||||
setter = { viewOptions, value -> viewOptions.copy(episodeContentScale = value) },
|
setter = { viewOptions, value -> viewOptions.copy(episodeContentScale = value) },
|
||||||
indexToValue = { PrefContentScale.forNumber(it) },
|
indexToValue = { PrefContentScale.forNumber(it) },
|
||||||
valueToIndex = { it.number },
|
valueToIndex = { it.number },
|
||||||
|
|
@ -219,7 +219,7 @@ internal object Options {
|
||||||
title = R.string.image_type,
|
title = R.string.image_type,
|
||||||
defaultValue = ViewOptionImageType.PRIMARY,
|
defaultValue = ViewOptionImageType.PRIMARY,
|
||||||
displayValues = R.array.image_types,
|
displayValues = R.array.image_types,
|
||||||
getter = { it.imageType },
|
getter = { it.episodeImageType },
|
||||||
setter = { viewOptions, value ->
|
setter = { viewOptions, value ->
|
||||||
val aspectRatio =
|
val aspectRatio =
|
||||||
when (value) {
|
when (value) {
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ class HomeSettingsViewModel
|
||||||
title = title,
|
title = title,
|
||||||
config =
|
config =
|
||||||
HomeRowConfig.TvChannels(
|
HomeRowConfig.TvChannels(
|
||||||
viewOptions = HomeRowViewOptions.channelsDefault,
|
viewOptions = HomeRowViewOptions.liveTvDefault,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -655,11 +655,11 @@ class HomeSettingsViewModel
|
||||||
}
|
}
|
||||||
|
|
||||||
is HomeRowConfig.TvPrograms -> {
|
is HomeRowConfig.TvPrograms -> {
|
||||||
it.config.updateViewOptions(preset.tvLibrary)
|
it.config.updateViewOptions(preset.liveTv)
|
||||||
}
|
}
|
||||||
|
|
||||||
is HomeRowConfig.TvChannels -> {
|
is HomeRowConfig.TvChannels -> {
|
||||||
it.config
|
it.config.updateViewOptions(preset.liveTv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
it.copy(config = newConfig)
|
it.copy(config = newConfig)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue