Fix clicking genre cards on home page (#953)
## Description Fixes clicking on a genre card added to the home page ### Related issues Fixes #952 ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
e8c9b4e208
commit
a51d9e9c65
4 changed files with 78 additions and 28 deletions
|
|
@ -21,8 +21,7 @@ import androidx.lifecycle.ViewModel
|
|||
import androidx.lifecycle.viewModelScope
|
||||
import com.github.damontecres.wholphin.data.ServerRepository
|
||||
import com.github.damontecres.wholphin.data.model.BaseItem
|
||||
import com.github.damontecres.wholphin.data.model.CollectionFolderFilter
|
||||
import com.github.damontecres.wholphin.data.model.GetItemsFilter
|
||||
import com.github.damontecres.wholphin.data.model.createGenreDestination
|
||||
import com.github.damontecres.wholphin.services.ImageUrlService
|
||||
import com.github.damontecres.wholphin.services.NavigationManager
|
||||
import com.github.damontecres.wholphin.ui.OneTimeLaunchedEffect
|
||||
|
|
@ -30,7 +29,6 @@ import com.github.damontecres.wholphin.ui.SlimItemFields
|
|||
import com.github.damontecres.wholphin.ui.cards.GenreCard
|
||||
import com.github.damontecres.wholphin.ui.detail.CardGrid
|
||||
import com.github.damontecres.wholphin.ui.detail.CardGridItem
|
||||
import com.github.damontecres.wholphin.ui.nav.Destination
|
||||
import com.github.damontecres.wholphin.ui.setValueOnMain
|
||||
import com.github.damontecres.wholphin.ui.tryRequestFocus
|
||||
import com.github.damontecres.wholphin.util.GetGenresRequestHandler
|
||||
|
|
@ -256,23 +254,12 @@ fun GenreCardGrid(
|
|||
pager = genres,
|
||||
onClickItem = { _, genre ->
|
||||
viewModel.navigationManager.navigateTo(
|
||||
Destination.FilteredCollection(
|
||||
itemId = itemId,
|
||||
filter =
|
||||
CollectionFolderFilter(
|
||||
nameOverride =
|
||||
listOfNotNull(
|
||||
genre.name,
|
||||
item?.title,
|
||||
).joinToString(" "),
|
||||
filter =
|
||||
GetItemsFilter(
|
||||
genres = listOf(genre.id),
|
||||
includeItemTypes = includeItemTypes,
|
||||
),
|
||||
useSavedLibraryDisplayInfo = false,
|
||||
),
|
||||
recursive = true,
|
||||
createGenreDestination(
|
||||
genreId = genre.id,
|
||||
genreName = genre.name,
|
||||
parentId = itemId,
|
||||
parentName = item?.title,
|
||||
includeItemTypes = includeItemTypes,
|
||||
),
|
||||
)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.github.damontecres.wholphin.ui.playback
|
|||
import androidx.compose.ui.layout.ContentScale
|
||||
import com.github.damontecres.wholphin.preferences.PrefContentScale
|
||||
import org.jellyfin.sdk.model.api.BaseItemKind
|
||||
import org.jellyfin.sdk.model.api.CollectionType
|
||||
|
||||
val playbackSpeedOptions = listOf(".25", ".5", ".75", "1.0", "1.25", "1.5", "1.75", "2.0")
|
||||
|
||||
|
|
@ -81,3 +82,20 @@ val BaseItemKind.playable: Boolean
|
|||
BaseItemKind.YEAR,
|
||||
-> false
|
||||
}
|
||||
|
||||
fun getTypeFor(collectionType: CollectionType): BaseItemKind? =
|
||||
when (collectionType) {
|
||||
CollectionType.UNKNOWN -> null
|
||||
CollectionType.MOVIES -> BaseItemKind.MOVIE
|
||||
CollectionType.TVSHOWS -> BaseItemKind.SERIES
|
||||
CollectionType.MUSIC -> BaseItemKind.AUDIO
|
||||
CollectionType.MUSICVIDEOS -> BaseItemKind.MUSIC_VIDEO
|
||||
CollectionType.TRAILERS -> BaseItemKind.TRAILER
|
||||
CollectionType.HOMEVIDEOS -> BaseItemKind.VIDEO
|
||||
CollectionType.BOXSETS -> BaseItemKind.BOX_SET
|
||||
CollectionType.BOOKS -> BaseItemKind.BOOK
|
||||
CollectionType.PHOTOS -> BaseItemKind.PHOTO_ALBUM
|
||||
CollectionType.LIVETV -> BaseItemKind.LIVE_TV_CHANNEL
|
||||
CollectionType.PLAYLISTS -> BaseItemKind.PLAYLIST
|
||||
CollectionType.FOLDERS -> BaseItemKind.FOLDER
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue