Skip to content

Commit

Permalink
Rename tileSize
Browse files Browse the repository at this point in the history
  • Loading branch information
sevonj committed Nov 14, 2024
1 parent a2b0c42 commit 808ac17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fun AlbumGrid(
context.symphony.groove.album.sort(albumIds, sortBy, sortReverse)
}
}
var albumGridSize by remember { mutableStateOf(200f) }
var tileSize by remember { mutableStateOf(200f) }

MediaSortBarScaffold(
mediaSortBar = {
Expand All @@ -49,9 +49,9 @@ fun AlbumGrid(
label = {
Text(context.symphony.t.XAlbums((albumsCount ?: albumIds.size).toString()))
},
gridSize = albumGridSize,
gridSize = tileSize,
onGridSizeChange = {
albumGridSize = it
tileSize = it
}
)
},
Expand All @@ -68,7 +68,7 @@ fun AlbumGrid(
content = { Text(context.symphony.t.DamnThisIsSoEmpty) }
)

else -> ResponsiveGrid(size = albumGridSize) {
else -> ResponsiveGrid(tileSize = tileSize) {
itemsIndexed(
sortedAlbumIds,
key = { i, x -> "$i-$x" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import kotlin.math.roundToInt
data class ResponsiveGridData(val columnsCount: Int)

@Composable
fun ResponsiveGrid(size: Float = 200f, content: LazyGridScope.(ResponsiveGridData) -> Unit) {
fun ResponsiveGrid(tileSize: Float = 200f, content: LazyGridScope.(ResponsiveGridData) -> Unit) {
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
val cols = (this@BoxWithConstraints.maxWidth.value / size).roundToInt()
val cols = (this@BoxWithConstraints.maxWidth.value / tileSize).roundToInt()
val gridState = rememberLazyGridState()
val responsiveGridData = ResponsiveGridData(columnsCount = cols)

Expand Down

0 comments on commit 808ac17

Please sign in to comment.