diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/cards/BannerCard.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/cards/BannerCard.kt index 294df8f6..51d003fe 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/cards/BannerCard.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/cards/BannerCard.kt @@ -68,6 +68,7 @@ fun BannerCard( interactionSource: MutableInteractionSource? = null, imageType: ImageType = ImageType.PRIMARY, imageContentScale: ContentScale = ContentScale.FillBounds, + useSeriesForPrimary: Boolean = true, ) { val imageUrlService = LocalImageUrlService.current val density = LocalDensity.current @@ -82,7 +83,7 @@ fun BannerCard( } } val imageUrl = - remember(item, fillHeight, imageType) { + remember(item, fillHeight, imageType, useSeriesForPrimary) { if (item != null) { item.imageUrlOverride ?: imageUrlService.getItemImageUrl( @@ -90,6 +91,7 @@ fun BannerCard( imageType, fillWidth = null, fillHeight = fillHeight, + useSeriesForPrimary = useSeriesForPrimary, ) } else { null @@ -208,6 +210,7 @@ fun BannerCardWithTitle( interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, imageType: ImageType = ImageType.PRIMARY, imageContentScale: ContentScale = ContentScale.FillBounds, + useSeriesForPrimary: Boolean = item?.useSeriesForPrimary ?: true, ) { val focused by interactionSource.collectIsFocusedAsState() val spaceBetween by animateDpAsState(if (focused) 12.dp else 4.dp) @@ -234,6 +237,7 @@ fun BannerCardWithTitle( interactionSource = interactionSource, imageType = imageType, imageContentScale = imageContentScale, + useSeriesForPrimary = useSeriesForPrimary, ) Column( verticalArrangement = Arrangement.spacedBy(0.dp), 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 b9a7cbd7..cf8738c5 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 @@ -524,6 +524,7 @@ fun HomePageCardContent( onLongClick = onLongClick, modifier = modifier, cardHeight = viewOptions.heightDp.dp, + useSeriesForPrimary = viewOptions.useSeries, ) } else { BannerCard( @@ -543,6 +544,7 @@ fun HomePageCardContent( modifier = modifier, interactionSource = null, cardHeight = viewOptions.heightDp.dp, + useSeriesForPrimary = viewOptions.useSeries, ) } } diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowPresets.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowPresets.kt index ff4cfe0a..815c343a 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowPresets.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/main/settings/HomeRowPresets.kt @@ -123,7 +123,7 @@ data class HomeRowPresets( ) } - val Thumbnails by lazy { + val SeriesThumbs by lazy { val height = 148 val epHeight = 100 HomeRowPresets( @@ -132,6 +132,7 @@ data class HomeRowPresets( heightDp = epHeight, imageType = ViewOptionImageType.THUMB, aspectRatio = AspectRatio.WIDE, + useSeries = true, episodeImageType = ViewOptionImageType.THUMB, episodeAspectRatio = AspectRatio.WIDE, ), @@ -164,6 +165,50 @@ data class HomeRowPresets( genreSize = epHeight, ) } + + val EpisodeThumbnails by lazy { + val height = 148 + val epHeight = 100 + HomeRowPresets( + continueWatching = + HomeRowViewOptions( + heightDp = epHeight, + imageType = ViewOptionImageType.THUMB, + aspectRatio = AspectRatio.WIDE, + showTitles = true, + useSeries = false, + episodeImageType = ViewOptionImageType.PRIMARY, + episodeAspectRatio = AspectRatio.WIDE, + ), + movieLibrary = + HomeRowViewOptions( + heightDp = height, + ), + tvLibrary = + HomeRowViewOptions( + heightDp = height, + ), + videoLibrary = + HomeRowViewOptions( + heightDp = epHeight, + aspectRatio = AspectRatio.WIDE, + ), + photoLibrary = + HomeRowViewOptions( + heightDp = epHeight, + aspectRatio = AspectRatio.WIDE, + contentScale = PrefContentScale.CROP, + ), + playlist = + HomeRowViewOptions( + heightDp = epHeight, + aspectRatio = AspectRatio.SQUARE, + contentScale = PrefContentScale.FIT, + ), + liveTv = HomeRowViewOptions.liveTvDefault, + genreSize = epHeight, + ) + } } } @@ -173,13 +218,13 @@ fun HomeRowPresetsContent( modifier: Modifier = Modifier, ) { val presets = - remember { - listOf( - "Wholphin Default", - "Wholphin Compact", - "Thumbnails", - ) - } + listOf( + stringResource(R.string.display_preset_default) to HomeRowPresets.WholphinDefault, + stringResource(R.string.display_preset_compact) to HomeRowPresets.WholphinCompact, + stringResource(R.string.display_preset_series_thumb) to HomeRowPresets.SeriesThumbs, + stringResource(R.string.display_preset_episode_thumbnails) to HomeRowPresets.EpisodeThumbnails, + ) + val focusRequesters = remember { List(presets.size) { FocusRequester() } } LaunchedEffect(Unit) { focusRequesters[0].tryRequestFocus() } Column(modifier = modifier) { @@ -192,16 +237,12 @@ fun HomeRowPresetsContent( .fillMaxHeight() .focusRestorer(focusRequesters[0]), ) { - itemsIndexed(presets) { index, title -> + itemsIndexed(presets) { index, (title, preset) -> HomeSettingsListItem( selected = false, headlineText = title, onClick = { - when (index) { - 0 -> onApply.invoke(HomeRowPresets.WholphinDefault) - 1 -> onApply.invoke(HomeRowPresets.WholphinCompact) - 2 -> onApply.invoke(HomeRowPresets.Thumbnails) - } + onApply.invoke(preset) }, modifier = Modifier.focusRequester(focusRequesters[index]), ) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c4f3db4f..3baee433 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -522,6 +522,10 @@ Display presets Built-in presets to quickly style all rows Choose rows and images on the home page + Wholphin Default + Wholphin Compact + Series Thumb images + Episode Thumbnail images Disabled