From fedad12ce26b680c13857b3da690c46d946e2735 Mon Sep 17 00:00:00 2001 From: Malopieds Date: Fri, 28 Jun 2024 12:55:30 +0200 Subject: [PATCH] fix: naming of playlist localization --- .../malopieds/innertune/ui/component/Items.kt | 47 ++++++++++++------- .../screens/library/LibraryPlaylistsScreen.kt | 2 +- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/malopieds/innertune/ui/component/Items.kt b/app/src/main/java/com/malopieds/innertune/ui/component/Items.kt index 2685ffd9b..7763321ed 100644 --- a/app/src/main/java/com/malopieds/innertune/ui/component/Items.kt +++ b/app/src/main/java/com/malopieds/innertune/ui/component/Items.kt @@ -53,6 +53,7 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.pluralStringResource +import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow @@ -112,15 +113,15 @@ inline fun ListItem( Row( verticalAlignment = Alignment.CenterVertically, modifier = if (isActive) - modifier - .height(ListItemHeight) - .padding(horizontal = 8.dp) - .clip(RoundedCornerShape(8.dp)) - .background(color = MaterialTheme.colorScheme.secondaryContainer) + modifier + .height(ListItemHeight) + .padding(horizontal = 8.dp) + .clip(RoundedCornerShape(8.dp)) + .background(color = MaterialTheme.colorScheme.secondaryContainer) else - modifier - .height(ListItemHeight) - .padding(horizontal = 8.dp) + modifier + .height(ListItemHeight) + .padding(horizontal = 8.dp) ) { Box( modifier = Modifier.padding(6.dp), @@ -905,16 +906,22 @@ fun PlaylistListItem( playlist: Playlist, modifier: Modifier = Modifier, trailingContent: @Composable RowScope.() -> Unit = {}, - autoPlaylist: Boolean = true, + autoPlaylist: Boolean = false, ) = ListItem( title = playlist.playlist.name, subtitle = if (autoPlaylist) "" else pluralStringResource(R.plurals.n_song, playlist.songCount, playlist.songCount), thumbnailContent = { val painter = when (playlist.playlist.name) { - "Liked" -> R.drawable.favorite - "Offline" -> R.drawable.offline - "My Top 50" -> R.drawable.trending_up - else -> R.drawable.queue_music + stringResource(R.string.liked) -> R.drawable.favorite + stringResource(R.string.offline) -> R.drawable.offline + else -> { + println(playlist.playlist.name + " " + autoPlaylist) + if (autoPlaylist){ + R.drawable.trending_up + } else { + R.drawable.queue_music + } + } } when (playlist.thumbnails.size) { 0 -> Icon( @@ -972,10 +979,16 @@ fun PlaylistGridItem( badges = badges, thumbnailContent = { val painter = when (playlist.playlist.name) { - "Liked" -> R.drawable.favorite - "Offline" -> R.drawable.offline - "My Top 50" -> R.drawable.trending_up - else -> R.drawable.queue_music + stringResource(R.string.liked) -> R.drawable.favorite + stringResource(R.string.offline) -> R.drawable.offline + else -> { + println(playlist.playlist.name + " " + autoPlaylist) + if (autoPlaylist){ + R.drawable.trending_up + } else { + R.drawable.queue_music + } + } } val width = maxWidth when (playlist.thumbnails.size) { diff --git a/app/src/main/java/com/malopieds/innertune/ui/screens/library/LibraryPlaylistsScreen.kt b/app/src/main/java/com/malopieds/innertune/ui/screens/library/LibraryPlaylistsScreen.kt index a38cecd1d..ceaebbef6 100644 --- a/app/src/main/java/com/malopieds/innertune/ui/screens/library/LibraryPlaylistsScreen.kt +++ b/app/src/main/java/com/malopieds/innertune/ui/screens/library/LibraryPlaylistsScreen.kt @@ -97,7 +97,7 @@ fun LibraryPlaylistsScreen( ) val topPlaylist = Playlist( - playlist = PlaylistEntity(id = UUID.randomUUID().toString(), name = stringResource(R.string.liked) + " $topSize"), + playlist = PlaylistEntity(id = UUID.randomUUID().toString(), name = stringResource(R.string.my_top) + " $topSize"), songCount = 0, thumbnails = emptyList() )