diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/HomeScreen.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/HomeScreen.kt index ec3ba43..0fb8643 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/HomeScreen.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/HomeScreen.kt @@ -3,6 +3,7 @@ package it.vfsfitvnm.vimusic.ui.screens import android.net.Uri import android.os.Bundle import androidx.compose.animation.* +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.clickable @@ -49,6 +50,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +@ExperimentalFoundationApi @ExperimentalAnimationApi @Composable fun HomeScreen() { @@ -151,6 +153,10 @@ fun HomeScreen() { } } + var isGridExpanded by remember { + mutableStateOf(false) + } + var isCreatingANewPlaylist by rememberSaveable { mutableStateOf(false) } @@ -208,20 +214,41 @@ fun HomeScreen() { } item { - BasicText( - text = "Your playlists", - style = typography.m.semiBold, + Row( + verticalAlignment = Alignment.CenterVertically, modifier = Modifier - .padding(horizontal = 16.dp) - ) + .zIndex(1f) + .padding(horizontal = 8.dp) + ) { + BasicText( + text = "Your playlists", + style = typography.m.semiBold, + modifier = Modifier + .weight(1f) + .padding(horizontal = 8.dp) + ) + + Image( + painter = painterResource(if (isGridExpanded) R.drawable.grid else R.drawable.grid_single), + contentDescription = null, + colorFilter = ColorFilter.tint(colorPalette.textSecondary), + modifier = Modifier + .clickable { + isGridExpanded = !isGridExpanded + } + .padding(all = 10.dp) + .size(16.dp) + ) + } } item { LazyHorizontalGrid( - rows = GridCells.Fixed(preferences.yourPlaylistsGridRowCount), + rows = GridCells.Fixed(if (isGridExpanded) 3 else 1), contentPadding = PaddingValues(horizontal = 16.dp), modifier = Modifier - .height(124.dp * preferences.yourPlaylistsGridRowCount) + .animateContentSize() + .height(124.dp * (if (isGridExpanded) 3 else 1)) ) { item { Column( @@ -260,6 +287,7 @@ fun HomeScreen() { PlaylistPreviewItem( playlistPreview = playlistPreview, modifier = Modifier + .animateItemPlacement() .padding(all = 8.dp) .clickable( indication = rememberRipple(bounded = true), @@ -274,14 +302,14 @@ fun HomeScreen() { item { Row( - verticalAlignment = Alignment.Bottom, + verticalAlignment = Alignment.CenterVertically, modifier = Modifier .zIndex(1f) .padding(horizontal = 8.dp) .padding(top = 32.dp) ) { Row( - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.Bottom, modifier = Modifier .weight(1f) .padding(horizontal = 8.dp) diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/settings/AppearanceSettingsScreen.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/settings/AppearanceSettingsScreen.kt index 35a1f58..40587ce 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/settings/AppearanceSettingsScreen.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/ui/screens/settings/AppearanceSettingsScreen.kt @@ -92,15 +92,6 @@ fun AppearanceSettingsScreen() { preferences.thumbnailRoundness = it } ) - - ValueSelectorSettingsEntry( - title = "\"Your playlists\" grid row count", - selectedValue = preferences.yourPlaylistsGridRowCount, - values = listOf(1, 2, 3), - onValueSelected = { - preferences.yourPlaylistsGridRowCount = it - } - ) } } } diff --git a/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Preferences.kt b/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Preferences.kt index fad2b12..aa0e3f4 100644 --- a/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Preferences.kt +++ b/app/src/main/kotlin/it/vfsfitvnm/vimusic/utils/Preferences.kt @@ -26,7 +26,6 @@ class Preferences(holder: SharedPreferences) : SharedPreferences by holder { var exoPlayerDiskCacheMaxSizeBytes by preference("exoPlayerDiskCacheMaxSizeBytes", 512L * 1024 * 1024) var skipSilence by preference("skipSilence", false) var volumeNormalization by preference("volumeNormalization", true) - var yourPlaylistsGridRowCount by preference("yourPlaylistsGridRowCount", 2) } val Context.preferences: Preferences diff --git a/app/src/main/res/drawable/grid.xml b/app/src/main/res/drawable/grid.xml new file mode 100644 index 0000000..9c66d95 --- /dev/null +++ b/app/src/main/res/drawable/grid.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/main/res/drawable/grid_single.xml b/app/src/main/res/drawable/grid_single.xml new file mode 100644 index 0000000..f2843ee --- /dev/null +++ b/app/src/main/res/drawable/grid_single.xml @@ -0,0 +1,12 @@ + + + +