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:
@@ -15,12 +15,14 @@ import androidx.compose.material3.AlertDialog
|
|||||||
import androidx.compose.material3.Checkbox
|
import androidx.compose.material3.Checkbox
|
||||||
import androidx.compose.material3.DropdownMenu
|
import androidx.compose.material3.DropdownMenu
|
||||||
import androidx.compose.material3.DropdownMenuItem
|
import androidx.compose.material3.DropdownMenuItem
|
||||||
|
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
|
||||||
import androidx.compose.material3.OutlinedButton
|
import androidx.compose.material3.OutlinedButton
|
||||||
import androidx.compose.material3.OutlinedTextField
|
import androidx.compose.material3.OutlinedTextField
|
||||||
import androidx.compose.material3.RadioButton
|
import androidx.compose.material3.RadioButton
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
@@ -30,6 +32,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.alpha
|
import androidx.compose.ui.draw.alpha
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
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.ClientItem
|
||||||
import eu.lixko.ts3j.client.android.ServerController
|
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.
|
* 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
|
@Composable
|
||||||
fun GroupsDialog(
|
fun GroupsDialog(
|
||||||
@@ -146,8 +150,9 @@ fun GroupsDialog(
|
|||||||
onDismissRequest = onDismiss,
|
onDismissRequest = onDismiss,
|
||||||
title = { Text(title) },
|
title = { Text(title) },
|
||||||
text = {
|
text = {
|
||||||
|
CompositionLocalProvider(LocalMinimumInteractiveComponentSize provides Dp.Unspecified) {
|
||||||
LazyColumn {
|
LazyColumn {
|
||||||
items(choices, key = { it.group().id }) { choice ->
|
items(choices.filter { it.allowed() || it.assigned() }, key = { it.group().id }) { choice ->
|
||||||
val group = choice.group()
|
val group = choice.group()
|
||||||
// A client always has one channel group: picking another is the only change.
|
// A client always has one channel group: picking another is the only change.
|
||||||
val changeable = choice.allowed() && !(single && choice.assigned())
|
val changeable = choice.allowed() && !(single && choice.assigned())
|
||||||
@@ -156,7 +161,7 @@ fun GroupsDialog(
|
|||||||
Modifier.fillMaxWidth()
|
Modifier.fillMaxWidth()
|
||||||
.clickable(enabled = changeable, onClick = toggle)
|
.clickable(enabled = changeable, onClick = toggle)
|
||||||
.alpha(if (choice.allowed()) 1f else 0.38f)
|
.alpha(if (choice.allowed()) 1f else 0.38f)
|
||||||
.padding(vertical = 2.dp),
|
.padding(vertical = 6.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
if (single) {
|
if (single) {
|
||||||
@@ -171,6 +176,7 @@ fun GroupsDialog(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
confirmButton = { TextButton(onClick = onDismiss) { Text("Close") } },
|
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.canKickFromServer) Action("KICK_FROM_SERVER", "Kick from server") { kick = true }
|
||||||
if (server.canBanClients) Action("BAN_CLIENT", "Ban") { banning = true }
|
if (server.canBanClients) Action("BAN_CLIENT", "Ban") { banning = true }
|
||||||
}
|
}
|
||||||
if (serverGroups.any { it.allowed() }) Action("PERMISSIONS_SERVER_GROUPS", "Server groups") { groups = true }
|
val showServerGroups = serverGroups.any { it.allowed() }
|
||||||
if (channelGroups.any { it.allowed() && !it.assigned() }) {
|
val showChannelGroups = channelGroups.any { it.allowed() && !it.assigned() }
|
||||||
Action("PERMISSIONS_CHANNEL_GROUPS", "Channel group") { groups = false }
|
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 ->
|
kick?.let { fromServer ->
|
||||||
|
|||||||
Reference in New Issue
Block a user