mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
add padding to cells
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
ecf6d362bf
commit
bcb276d533
@ -12,6 +12,7 @@ import androidx.compose.foundation.clickable
|
|||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
@ -112,21 +113,30 @@ fun ParticipantGrid(
|
|||||||
else -> {
|
else -> {
|
||||||
val columns = if (isPortrait) 2 else 3
|
val columns = if (isPortrait) 2 else 3
|
||||||
val rows = ceil(participants.size / columns.toFloat()).toInt()
|
val rows = ceil(participants.size / columns.toFloat()).toInt()
|
||||||
|
|
||||||
val screenHeight = LocalConfiguration.current.screenHeightDp.dp
|
val screenHeight = LocalConfiguration.current.screenHeightDp.dp
|
||||||
val rawItemHeight = screenHeight / rows
|
val itemSpacing = 8.dp
|
||||||
val itemHeight = max(rawItemHeight, 120.dp)
|
val edgePadding = 8.dp
|
||||||
|
|
||||||
|
val totalVerticalSpacing = itemSpacing * (rows - 1)
|
||||||
|
val totalVerticalPadding = edgePadding * 2
|
||||||
|
val availableHeight = screenHeight - totalVerticalSpacing - totalVerticalPadding
|
||||||
|
|
||||||
|
val rawItemHeight = availableHeight / rows
|
||||||
|
val itemHeight = maxOf(rawItemHeight, 100.dp)
|
||||||
|
|
||||||
LazyVerticalGrid(
|
LazyVerticalGrid(
|
||||||
columns = GridCells.Fixed(columns),
|
columns = GridCells.Fixed(columns),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(0.dp)
|
.padding(horizontal = edgePadding) // Only horizontal outer padding here
|
||||||
.clickable { onClick() },
|
.clickable { onClick() },
|
||||||
verticalArrangement = Arrangement.spacedBy(0.dp),
|
verticalArrangement = Arrangement.spacedBy(itemSpacing),
|
||||||
horizontalArrangement = Arrangement.spacedBy(0.dp)
|
horizontalArrangement = Arrangement.spacedBy(itemSpacing),
|
||||||
|
contentPadding = PaddingValues(vertical = edgePadding) // vertical padding handled here
|
||||||
) {
|
) {
|
||||||
items(
|
items(
|
||||||
participants,
|
participants.sortedBy { it.isAudioEnabled }.asReversed(),
|
||||||
key = { it.sessionKey }
|
key = { it.sessionKey }
|
||||||
) { participant ->
|
) { participant ->
|
||||||
ParticipantTile(
|
ParticipantTile(
|
||||||
|
Loading…
Reference in New Issue
Block a user