Skip to content

Commit

Permalink
Album tileSize persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
sevonj committed Nov 14, 2024
1 parent 1735cc6 commit 3e4fc42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class Settings(private val symphony: Symphony) {
AlbumRepository.SortBy.ALBUM_NAME,
)
val lastUsedAlbumsSortReverse = BooleanEntry("last_used_albums_sort_reverse", false)
val lastUsedAlbumsTileSize = FloatEntry("last_used_albums_tile_size", 200f)
val lastUsedGenresSortBy = EnumEntry(
"last_used_genres_sort_by",
enumEntries<GenreRepository.SortBy>(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
Expand All @@ -35,7 +34,8 @@ fun AlbumGrid(
context.symphony.groove.album.sort(albumIds, sortBy, sortReverse)
}
}
var tileSize by remember { mutableFloatStateOf(200f) }
val tileSize by context.symphony.settings.lastUsedAlbumsTileSize.flow.collectAsState()

val sheetState = rememberModalBottomSheetState()
var showBottomSheet by remember { mutableStateOf(false) }

Expand Down Expand Up @@ -93,7 +93,11 @@ fun AlbumGrid(
) {
ResponsiveGridSizeAdjust(
tileSize,
onTileSizeChange = { tileSize = it },
onTileSizeChange = {
context.symphony.settings.lastUsedAlbumsTileSize.setValue(
it
)
},
)
}
}
Expand Down

0 comments on commit 3e4fc42

Please sign in to comment.