Android: tidier client group dialogs
test / test (push) Has been cancelled

The group dialogs list a group we may not assign only when the client is
in it, and the rows drop the 48dp minimum touch target for a 6dp padding.
The Server groups and Channel group actions share one row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 16:33:54 +00:00
co-authored by Claude Opus 5.5
parent b586a80a14
commit f78e4fcd66
@@ -15,12 +15,14 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Checkbox
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -30,6 +32,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import eu.lixko.ts3j.client.android.ClientItem
import eu.lixko.ts3j.client.android.ServerController
@@ -132,7 +135,8 @@ internal fun BanDurationField(state: BanDurationState, maxSeconds: Long, modifie
/**
* A client's groups to tick: several server groups, or with [single] the one channel group.
* Groups we have no power over show greyed out; a change shows once the server made it.
* Groups we may not assign are listed only when the client is in them, greyed out; a change shows once the server
* made it.
*/
@Composable
fun GroupsDialog(
@@ -146,8 +150,9 @@ fun GroupsDialog(
onDismissRequest = onDismiss,
title = { Text(title) },
text = {
CompositionLocalProvider(LocalMinimumInteractiveComponentSize provides Dp.Unspecified) {
LazyColumn {
items(choices, key = { it.group().id }) { choice ->
items(choices.filter { it.allowed() || it.assigned() }, key = { it.group().id }) { choice ->
val group = choice.group()
// A client always has one channel group: picking another is the only change.
val changeable = choice.allowed() && !(single && choice.assigned())
@@ -156,7 +161,7 @@ fun GroupsDialog(
Modifier.fillMaxWidth()
.clickable(enabled = changeable, onClick = toggle)
.alpha(if (choice.allowed()) 1f else 0.38f)
.padding(vertical = 2.dp),
.padding(vertical = 6.dp),
verticalAlignment = Alignment.CenterVertically,
) {
if (single) {
@@ -171,6 +176,7 @@ fun GroupsDialog(
}
}
}
}
},
confirmButton = { TextButton(onClick = onDismiss) { Text("Close") } },
)
@@ -190,9 +196,13 @@ fun ClientModeration(server: ServerController, client: ClientItem, onDone: () ->
if (server.canKickFromServer) Action("KICK_FROM_SERVER", "Kick from server") { kick = true }
if (server.canBanClients) Action("BAN_CLIENT", "Ban") { banning = true }
}
if (serverGroups.any { it.allowed() }) Action("PERMISSIONS_SERVER_GROUPS", "Server groups") { groups = true }
if (channelGroups.any { it.allowed() && !it.assigned() }) {
Action("PERMISSIONS_CHANNEL_GROUPS", "Channel group") { groups = false }
val showServerGroups = serverGroups.any { it.allowed() }
val showChannelGroups = channelGroups.any { it.allowed() && !it.assigned() }
if (showServerGroups || showChannelGroups) {
Row {
if (showServerGroups) Action("PERMISSIONS_SERVER_GROUPS", "Server groups", Modifier.weight(1f)) { groups = true }
if (showChannelGroups) Action("PERMISSIONS_CHANNEL_GROUPS", "Channel group", Modifier.weight(1f)) { groups = false }
}
}
kick?.let { fromServer ->