From e6c35bc858e181ca4e900ec390e79a36f2073066 Mon Sep 17 00:00:00 2001 From: evgeny Date: Fri, 30 Oct 2026 12:07:30 +0100 Subject: [PATCH] Compact Android Bluetooth devices into two-line rows --- .../chat/ui/screens/BluetoothSettingsTab.kt | 32 +++++++++++++++---- .../app/src/main/res/values-ru/strings.xml | 1 + .../app/src/main/res/values/strings.xml | 1 + 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/BluetoothSettingsTab.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/BluetoothSettingsTab.kt index 4b4d8ffa..ae120b27 100644 --- a/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/BluetoothSettingsTab.kt +++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/BluetoothSettingsTab.kt @@ -11,10 +11,14 @@ import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.foundation.verticalScroll import androidx.compose.material3.* import androidx.compose.runtime.* +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import androidx.lifecycle.Lifecycle import com.utun.chat.ChatApplication import com.utun.chat.R @@ -124,12 +128,28 @@ fun BluetoothSettingsTab() { Text(stringResource(R.string.ble_devices), style = MaterialTheme.typography.titleMedium) if (peersFailed) Text(stringResource(R.string.ble_devices_failed), color = MaterialTheme.colorScheme.error) else if (peers.isEmpty()) Text(stringResource(R.string.ble_devices_empty), style = MaterialTheme.typography.bodySmall) - peers.forEach { peer -> - key(peer.id) { - Column(verticalArrangement = Arrangement.spacedBy(4.dp)) { - Text(peer.name.ifEmpty { peer.id }, style = MaterialTheme.typography.bodyLarge) - SelectionContainer { Text(peer.address, style = MaterialTheme.typography.bodyMedium) } - Text("${peer.id} · ${if (peer.rssi == 127) "?" else peer.rssi} dBm", style = MaterialTheme.typography.bodySmall) + Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { + peers.forEach { peer -> + key(peer.id) { + Row(Modifier.fillMaxWidth().padding(vertical = 3.dp), + horizontalArrangement = Arrangement.spacedBy(10.dp), verticalAlignment = Alignment.CenterVertically) { + Text(peer.name.ifEmpty { peer.id }, Modifier.weight(1f), style = MaterialTheme.typography.bodyMedium, + lineHeight = 16.sp, maxLines = 2, overflow = TextOverflow.Ellipsis) + SelectionContainer { + Column { + Text(peer.id, color = MaterialTheme.colorScheme.primary, fontFamily = FontFamily.Monospace, + style = MaterialTheme.typography.bodySmall, lineHeight = 16.sp, maxLines = 1, softWrap = false) + Text(peer.address, color = MaterialTheme.colorScheme.tertiary, fontFamily = FontFamily.Monospace, + style = MaterialTheme.typography.bodySmall, lineHeight = 16.sp, maxLines = 1, softWrap = false) + } + } + Column(Modifier.widthIn(min = 64.dp), horizontalAlignment = Alignment.End) { + Text("${if (peer.rssi == 127) "—" else peer.rssi} dBm", color = MaterialTheme.colorScheme.secondary, + style = MaterialTheme.typography.bodySmall, lineHeight = 16.sp, maxLines = 1, softWrap = false) + Text(stringResource(R.string.ble_lqi_unavailable), color = MaterialTheme.colorScheme.onSurfaceVariant, + style = MaterialTheme.typography.bodySmall, lineHeight = 16.sp, maxLines = 1, softWrap = false) + } + } } } } diff --git a/tools/chatgui-android/app/src/main/res/values-ru/strings.xml b/tools/chatgui-android/app/src/main/res/values-ru/strings.xml index 40fc111e..489ff5d6 100644 --- a/tools/chatgui-android/app/src/main/res/values-ru/strings.xml +++ b/tools/chatgui-android/app/src/main/res/values-ru/strings.xml @@ -635,4 +635,5 @@ Устройства VibeChat поблизости Поблизости пока не найдены устройства Не удалось обновить список устройств + LQI — diff --git a/tools/chatgui-android/app/src/main/res/values/strings.xml b/tools/chatgui-android/app/src/main/res/values/strings.xml index 8b8cb495..6a05e3f7 100644 --- a/tools/chatgui-android/app/src/main/res/values/strings.xml +++ b/tools/chatgui-android/app/src/main/res/values/strings.xml @@ -634,4 +634,5 @@ Nearby VibeChat devices No nearby devices found yet Could not refresh the device list + LQI —