Skip to content

Commit

Permalink
ui: Fix select header height consistency
Browse files Browse the repository at this point in the history
* Fixes #130
  • Loading branch information
mikooomich committed Jan 2, 2025
1 parent 5c79b96 commit 2d6d3ab
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun RowScope.SelectHeader(
) {
Text(
text = "${selectedItems.size}/${totalItemCount} selected",
modifier = Modifier.weight(1f)
modifier = Modifier.weight(1f, false)
)

// option menu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.grid.GridCells
Expand Down Expand Up @@ -139,10 +138,7 @@ fun ArtistItemsScreen(

if (itemsPage?.items?.firstOrNull() is SongItem) {
if (inSelectMode) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(horizontal = 16.dp)
) {
Row {
SelectHeader(
selectedItems = selection.mapNotNull { songId ->
songIndex[songId]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,22 +473,17 @@ fun AutoPlaylistScreen(
modifier = Modifier.padding(horizontal = 16.dp)
) {
if (inSelectMode) {
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.padding(horizontal = 16.dp)
) {
SelectHeader(
selectedItems = selection.map { songs[it] }.map { it.toMediaMetadata() },
totalItemCount = songs.size,
onSelectAll = {
selection.clear()
selection.addAll(songs.indices)
},
onDeselectAll = { selection.clear() },
menuState = menuState,
onDismiss = onExitSelectionMode
)
}
SelectHeader(
selectedItems = selection.map { songs[it] }.map { it.toMediaMetadata() },
totalItemCount = songs.size,
onSelectAll = {
selection.clear()
selection.addAll(songs.indices)
},
onDeselectAll = { selection.clear() },
menuState = menuState,
onDismiss = onExitSelectionMode
)
} else {
SortHeader(
sortType = sortType,
Expand All @@ -506,14 +501,15 @@ fun AutoPlaylistScreen(
}
}
)
}
Spacer(Modifier.weight(1f))

Text(
text = pluralStringResource(R.plurals.n_song, songs.size, songs.size),
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.secondary
)
Spacer(Modifier.weight(1f))

Text(
text = pluralStringResource(R.plurals.n_song, songs.size, songs.size),
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.secondary
)
}
}
}
} else {
Expand Down

0 comments on commit 2d6d3ab

Please sign in to comment.