Make playlists a top-level item in Android Auto

This commit is contained in:
Niels van Velzen authored and Niels van Velzen committed 2026-05-26 16:04:52 +02:00
1 parent 8be98bbd8a
commit 89cff58bf6
5 files changed
+6 -13

No files matched your search

@@ -59,7 +59,7 @@ sealed interface LibraryRoute {
data class Genre(val genreId: UUID) : LibraryRoute
@Serializable
data class Playlists(val libraryId: UUID) : LibraryRoute
data object Playlists : LibraryRoute
@Serializable
data class Playlist(val playlistId: UUID) : LibraryRoute
@@ -13,7 +13,6 @@ import org.jellyfin.sdk.model.api.ItemSortBy
val PlaylistsLibraryPage = { api: ApiClient ->
libraryPage<LibraryRoute.Playlists>(grid = true) { route, offset, limit ->
val result by api.itemsApi.getItems(
parentId = route.libraryId,
includeItemTypes = listOf(BaseItemKind.PLAYLIST),
sortBy = listOf(ItemSortBy.SORT_NAME),
recursive = true,
@@ -8,7 +8,7 @@ import org.jellyfin.sdk.api.client.ApiClient
import org.jellyfin.sdk.api.client.extensions.userViewsApi
import org.jellyfin.sdk.model.api.CollectionType
private val collectionTypes = setOf(CollectionType.MUSIC, CollectionType.BOOKS)
private val collectionTypes = setOf(CollectionType.MUSIC, CollectionType.BOOKS, CollectionType.PLAYLISTS)
/**
* Root library page that returns the available libraries (user views) for Android Auto playback.
@@ -28,7 +28,10 @@ val RootLibraryPage = { api: ApiClient ->
item = it,
image = null,
iconRes = null,
action = LibraryItemAction.Navigate(LibraryRoute.Library(it.id, it.collectionType)),
action = when (it.collectionType) {
CollectionType.PLAYLISTS -> LibraryItemAction.Navigate(LibraryRoute.Playlists)
else -> LibraryItemAction.Navigate(LibraryRoute.Library(it.id, it.collectionType))
},
)
}
}
@@ -58,14 +58,6 @@ val UserViewLibraryPage = { context: Context ->
),
)
add(
LibraryPageElement.Item(
title = context.getString(R.string.media_service_car_section_playlists),
iconRes = R.drawable.ic_playlist,
action = LibraryItemAction.Navigate(LibraryRoute.Playlists(route.libraryId)),
),
)
add(
LibraryPageElement.Item(
title = context.getString(R.string.media_service_car_section_recents),
-1
View File
@@ -54,7 +54,6 @@
<string name="media_service_car_section_artists">Artists</string>
<string name="media_service_car_section_songs">Songs</string>
<string name="media_service_car_section_genres">Genres</string>
<string name="media_service_car_section_playlists">Playlists</string>
<string name="media_service_car_item_no_title">No title</string>
<string name="music_notification_channel">Jellyfin Music Player</string>