mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Add view option for hiding card titles (#422)
Adds a view option for grids to show/hide titles. It is enabled by default. Closes #403
This commit is contained in:
parent
f63a30d295
commit
2403a44c18
4 changed files with 45 additions and 30 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package com.github.damontecres.wholphin.ui.cards
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
|
|
@ -44,6 +45,7 @@ fun GridCard(
|
|||
imageAspectRatio: Float = AspectRatios.TALL,
|
||||
imageContentScale: ContentScale = ContentScale.Fit,
|
||||
imageType: ViewOptionImageType = ViewOptionImageType.PRIMARY,
|
||||
showTitle: Boolean = true,
|
||||
) {
|
||||
val dto = item?.data
|
||||
val focused by interactionSource.collectIsFocusedAsState()
|
||||
|
|
@ -98,6 +100,7 @@ fun GridCard(
|
|||
.background(MaterialTheme.colorScheme.surfaceVariant),
|
||||
)
|
||||
}
|
||||
AnimatedVisibility(showTitle) {
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(0.dp),
|
||||
modifier =
|
||||
|
|
@ -129,3 +132,4 @@ fun GridCard(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -681,6 +681,10 @@ fun CollectionFolderGridContent(
|
|||
letterPosition: suspend (Char) -> Int,
|
||||
sortOptions: List<ItemSortBy>,
|
||||
playEnabled: Boolean,
|
||||
getPossibleFilterValues: suspend (ItemFilterBy<*>) -> List<FilterValueOption>,
|
||||
defaultViewOptions: ViewOptions,
|
||||
onSaveViewOptions: (ViewOptions) -> Unit,
|
||||
viewOptions: ViewOptions,
|
||||
onClickPlayAll: (shuffle: Boolean) -> Unit,
|
||||
onClickPlay: (Int, BaseItem) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
@ -689,10 +693,6 @@ fun CollectionFolderGridContent(
|
|||
currentFilter: GetItemsFilter = GetItemsFilter(),
|
||||
filterOptions: List<ItemFilterBy<*>> = listOf(),
|
||||
onFilterChange: (GetItemsFilter) -> Unit = {},
|
||||
getPossibleFilterValues: suspend (ItemFilterBy<*>) -> List<FilterValueOption>,
|
||||
defaultViewOptions: ViewOptions,
|
||||
viewOptions: ViewOptions,
|
||||
onSaveViewOptions: (ViewOptions) -> Unit,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val title = item?.name ?: item?.data?.collectionType?.name ?: stringResource(R.string.collection)
|
||||
|
|
@ -837,6 +837,7 @@ fun CollectionFolderGridContent(
|
|||
imageContentScale = viewOptions.contentScale.scale,
|
||||
imageAspectRatio = viewOptions.aspectRatio.ratio,
|
||||
imageType = viewOptions.imageType,
|
||||
showTitle = viewOptions.showTitles,
|
||||
modifier = mod,
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ data class ViewOptions(
|
|||
val aspectRatio: AspectRatio = AspectRatio.TALL,
|
||||
val showDetails: Boolean = false,
|
||||
val imageType: ViewOptionImageType = ViewOptionImageType.PRIMARY,
|
||||
val showTitles: Boolean = true,
|
||||
) {
|
||||
companion object {
|
||||
val ViewOptionsColumns =
|
||||
|
|
@ -165,6 +166,13 @@ data class ViewOptions(
|
|||
getter = { it.showDetails },
|
||||
setter = { vo, value -> vo.copy(showDetails = value) },
|
||||
)
|
||||
val ViewOptionsShowTitles =
|
||||
AppSwitchPreference<ViewOptions>(
|
||||
title = R.string.show_titles,
|
||||
defaultValue = true,
|
||||
getter = { it.showTitles },
|
||||
setter = { vo, value -> vo.copy(showTitles = value) },
|
||||
)
|
||||
|
||||
val ViewOptionsImageType =
|
||||
AppChoicePreference<ViewOptions, ViewOptionImageType>(
|
||||
|
|
@ -194,6 +202,7 @@ data class ViewOptions(
|
|||
ViewOptionsImageType,
|
||||
ViewOptionsAspectRatio,
|
||||
ViewOptionsDetailHeader,
|
||||
ViewOptionsShowTitles,
|
||||
ViewOptionsColumns,
|
||||
ViewOptionsSpacing,
|
||||
ViewOptionsContentScale,
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@
|
|||
<string name="automatic">Automatic</string>
|
||||
<string name="username_or_password">Use username/password</string>
|
||||
<string name="login">Login</string>
|
||||
<string name="show_titles">Show titles</string>
|
||||
|
||||
<string-array name="theme_song_volume">
|
||||
<item>Disabled</item>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue