summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorTom Pratt <tom.pratt@outlook.com>2026-07-21 18:45:44 +0200
committerTom Pratt <tom.pratt@outlook.com>2026-08-24 19:36:00 +0200
commitdf4c394fc3456ab6af8ea841d9bb94f297f75e61 (patch)
tree3bd1058d5bcfcebf6998b996c5b853ad9e988ea8 /Source/Android
parent3236c634d9dfb9d382d1f27c2e380c341cb56ab7 (diff)
Netplay PlayerTable fixes
- Improve the column measurement logic so it updates the column width when text changes. - Use matchParentSize on the clickable target in OutlinedBox so that it is clickable when the OutlinedBox contains contents with dynamic height.
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt27
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/theme/DolphinTheme.kt2
2 files changed, 13 insertions, 16 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt
index 7df8ea35ee..018a46a71b 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/netplay/ui/NetplayScreen.kt
@@ -972,7 +972,6 @@ private fun PlayersTable(
) {
rows.zipWithNext { a, b -> if (a.size != b.size) throw IllegalArgumentException("Rows must all contain the same number of elements.") }
val maxWidths = remember { List(rows.first().size) { mutableIntStateOf(0) } }
- val density = LocalDensity.current
Column(
verticalArrangement = Arrangement.spacedBy(6.dp),
@@ -984,23 +983,21 @@ private fun PlayersTable(
) {
row.forEachIndexed { itemIndex, text ->
Box(
- modifier = Modifier
- .then(
- when {
- itemIndex == 0 -> Modifier.weight(1f)
-
- maxWidths[itemIndex].intValue > 0 -> Modifier
- .width(with(density) { maxWidths[itemIndex].intValue.toDp() })
-
- else -> Modifier
+ modifier = if (itemIndex == 0) {
+ Modifier.weight(1f)
+ } else {
+ val maxWidth = maxWidths[itemIndex]
+ Modifier.layout { measurable, constraints ->
+ val placeable =
+ measurable.measure(constraints.copy(maxWidth = Constraints.Infinity))
+ if (placeable.width > maxWidth.intValue) {
+ maxWidth.intValue = placeable.width
}
- )
- .onGloballyPositioned { coordinates ->
- val width = coordinates.size.width
- if (width > maxWidths[itemIndex].intValue) {
- maxWidths[itemIndex].intValue = width
+ layout(maxWidth.intValue, placeable.height) {
+ placeable.place(x = 0, y = 0)
}
}
+ }
) {
Text(
text = text,
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/theme/DolphinTheme.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/theme/DolphinTheme.kt
index 4aa7e2055a..1aec1a0752 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/theme/DolphinTheme.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/theme/DolphinTheme.kt
@@ -257,7 +257,7 @@ fun OutlinedBox(
if (onClick != null) {
Box(
modifier = Modifier
- .fillMaxSize()
+ .matchParentSize()
.clip(MaterialTheme.shapes.extraSmall)
.clickable(
interactionSource = interactionSource,