mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 15:50:16 +02:00
Better defaults when adding music to home page
This commit is contained in:
parent
f062aedadf
commit
c91ac434e0
3 changed files with 47 additions and 4 deletions
|
|
@ -29,6 +29,7 @@ data class HomeRowPresets(
|
||||||
val tvLibrary: HomeRowViewOptions,
|
val tvLibrary: HomeRowViewOptions,
|
||||||
val videoLibrary: HomeRowViewOptions,
|
val videoLibrary: HomeRowViewOptions,
|
||||||
val photoLibrary: HomeRowViewOptions,
|
val photoLibrary: HomeRowViewOptions,
|
||||||
|
val musicLibrary: HomeRowViewOptions,
|
||||||
val playlist: HomeRowViewOptions,
|
val playlist: HomeRowViewOptions,
|
||||||
val liveTv: HomeRowViewOptions,
|
val liveTv: HomeRowViewOptions,
|
||||||
val genreSize: Int,
|
val genreSize: Int,
|
||||||
|
|
@ -51,8 +52,9 @@ data class HomeRowPresets(
|
||||||
|
|
||||||
CollectionType.LIVETV -> liveTv
|
CollectionType.LIVETV -> liveTv
|
||||||
|
|
||||||
|
CollectionType.MUSIC -> musicLibrary
|
||||||
|
|
||||||
CollectionType.UNKNOWN,
|
CollectionType.UNKNOWN,
|
||||||
CollectionType.MUSIC,
|
|
||||||
CollectionType.BOOKS,
|
CollectionType.BOOKS,
|
||||||
CollectionType.PLAYLISTS,
|
CollectionType.PLAYLISTS,
|
||||||
CollectionType.FOLDERS,
|
CollectionType.FOLDERS,
|
||||||
|
|
@ -74,6 +76,10 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.WIDE,
|
aspectRatio = AspectRatio.WIDE,
|
||||||
contentScale = PrefContentScale.CROP,
|
contentScale = PrefContentScale.CROP,
|
||||||
),
|
),
|
||||||
|
musicLibrary =
|
||||||
|
HomeRowViewOptions(
|
||||||
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
|
),
|
||||||
playlist =
|
playlist =
|
||||||
HomeRowViewOptions(
|
HomeRowViewOptions(
|
||||||
aspectRatio = AspectRatio.SQUARE,
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
|
|
@ -111,6 +117,11 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.WIDE,
|
aspectRatio = AspectRatio.WIDE,
|
||||||
contentScale = PrefContentScale.CROP,
|
contentScale = PrefContentScale.CROP,
|
||||||
),
|
),
|
||||||
|
musicLibrary =
|
||||||
|
HomeRowViewOptions(
|
||||||
|
heightDp = epHeight,
|
||||||
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
|
),
|
||||||
playlist =
|
playlist =
|
||||||
HomeRowViewOptions(
|
HomeRowViewOptions(
|
||||||
heightDp = epHeight,
|
heightDp = epHeight,
|
||||||
|
|
@ -154,6 +165,11 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.WIDE,
|
aspectRatio = AspectRatio.WIDE,
|
||||||
contentScale = PrefContentScale.CROP,
|
contentScale = PrefContentScale.CROP,
|
||||||
),
|
),
|
||||||
|
musicLibrary =
|
||||||
|
HomeRowViewOptions(
|
||||||
|
heightDp = epHeight,
|
||||||
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
|
),
|
||||||
playlist =
|
playlist =
|
||||||
HomeRowViewOptions(
|
HomeRowViewOptions(
|
||||||
heightDp = epHeight,
|
heightDp = epHeight,
|
||||||
|
|
@ -198,6 +214,11 @@ data class HomeRowPresets(
|
||||||
aspectRatio = AspectRatio.WIDE,
|
aspectRatio = AspectRatio.WIDE,
|
||||||
contentScale = PrefContentScale.CROP,
|
contentScale = PrefContentScale.CROP,
|
||||||
),
|
),
|
||||||
|
musicLibrary =
|
||||||
|
HomeRowViewOptions(
|
||||||
|
heightDp = epHeight,
|
||||||
|
aspectRatio = AspectRatio.SQUARE,
|
||||||
|
),
|
||||||
playlist =
|
playlist =
|
||||||
HomeRowViewOptions(
|
HomeRowViewOptions(
|
||||||
heightDp = epHeight,
|
heightDp = epHeight,
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ val favoriteOptions by lazy {
|
||||||
BaseItemKind.VIDEO to R.string.videos,
|
BaseItemKind.VIDEO to R.string.videos,
|
||||||
BaseItemKind.PLAYLIST to R.string.playlists,
|
BaseItemKind.PLAYLIST to R.string.playlists,
|
||||||
BaseItemKind.PERSON to R.string.people,
|
BaseItemKind.PERSON to R.string.people,
|
||||||
|
BaseItemKind.MUSIC_ARTIST to R.string.artists,
|
||||||
|
BaseItemKind.MUSIC_ALBUM to R.string.albums,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val favoriteOptionsList by lazy { favoriteOptions.keys.toList() }
|
val favoriteOptionsList by lazy { favoriteOptions.keys.toList() }
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import com.github.damontecres.wholphin.services.UnsupportedHomeSettingsVersionEx
|
||||||
import com.github.damontecres.wholphin.services.UserPreferencesService
|
import com.github.damontecres.wholphin.services.UserPreferencesService
|
||||||
import com.github.damontecres.wholphin.services.hilt.IoCoroutineScope
|
import com.github.damontecres.wholphin.services.hilt.IoCoroutineScope
|
||||||
import com.github.damontecres.wholphin.services.tvAccess
|
import com.github.damontecres.wholphin.services.tvAccess
|
||||||
|
import com.github.damontecres.wholphin.ui.AspectRatio
|
||||||
import com.github.damontecres.wholphin.ui.launchIO
|
import com.github.damontecres.wholphin.ui.launchIO
|
||||||
import com.github.damontecres.wholphin.ui.showToast
|
import com.github.damontecres.wholphin.ui.showToast
|
||||||
import com.github.damontecres.wholphin.util.HomeRowLoadingState
|
import com.github.damontecres.wholphin.util.HomeRowLoadingState
|
||||||
|
|
@ -258,6 +259,24 @@ class HomeSettingsViewModel
|
||||||
rowType: LibraryRowType,
|
rowType: LibraryRowType,
|
||||||
): Job =
|
): Job =
|
||||||
viewModelScope.launchIO {
|
viewModelScope.launchIO {
|
||||||
|
val viewOptions =
|
||||||
|
when (library.collectionType) {
|
||||||
|
CollectionType.MUSIC -> {
|
||||||
|
HomeRowViewOptions(aspectRatio = AspectRatio.SQUARE)
|
||||||
|
}
|
||||||
|
|
||||||
|
CollectionType.HOMEVIDEOS,
|
||||||
|
CollectionType.MUSICVIDEOS,
|
||||||
|
-> {
|
||||||
|
HomeRowViewOptions(
|
||||||
|
aspectRatio = AspectRatio.WIDE,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
HomeRowViewOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
val id = idCounter++
|
val id = idCounter++
|
||||||
val newRow =
|
val newRow =
|
||||||
when (rowType) {
|
when (rowType) {
|
||||||
|
|
@ -267,7 +286,7 @@ class HomeSettingsViewModel
|
||||||
HomeRowConfigDisplay(
|
HomeRowConfigDisplay(
|
||||||
id = id,
|
id = id,
|
||||||
title = title,
|
title = title,
|
||||||
config = RecentlyAdded(library.itemId),
|
config = RecentlyAdded(library.itemId, viewOptions),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,7 +301,7 @@ class HomeSettingsViewModel
|
||||||
HomeRowConfigDisplay(
|
HomeRowConfigDisplay(
|
||||||
id = id,
|
id = id,
|
||||||
title = title,
|
title = title,
|
||||||
config = RecentlyReleased(library.itemId),
|
config = RecentlyReleased(library.itemId, viewOptions),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,7 +320,7 @@ class HomeSettingsViewModel
|
||||||
HomeRowConfigDisplay(
|
HomeRowConfigDisplay(
|
||||||
id = id,
|
id = id,
|
||||||
title = title,
|
title = title,
|
||||||
config = Suggestions(library.itemId),
|
config = Suggestions(library.itemId, viewOptions),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -662,6 +681,7 @@ class HomeSettingsViewModel
|
||||||
BaseItemKind.VIDEO -> preset.videoLibrary
|
BaseItemKind.VIDEO -> preset.videoLibrary
|
||||||
BaseItemKind.PLAYLIST -> preset.playlist
|
BaseItemKind.PLAYLIST -> preset.playlist
|
||||||
BaseItemKind.PERSON -> preset.movieLibrary
|
BaseItemKind.PERSON -> preset.movieLibrary
|
||||||
|
BaseItemKind.MUSIC_ARTIST, BaseItemKind.MUSIC_ALBUM -> preset.musicLibrary
|
||||||
else -> preset.movieLibrary
|
else -> preset.movieLibrary
|
||||||
}
|
}
|
||||||
it.config.updateViewOptions(viewOptions)
|
it.config.updateViewOptions(viewOptions)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue