@@ -37,7 +37,6 @@ import androidx.compose.foundation.layout.Arrangement
3737import androidx.compose.foundation.layout.Box
3838import androidx.compose.foundation.layout.Column
3939import androidx.compose.foundation.layout.Row
40- import androidx.compose.foundation.layout.Spacer
4140import androidx.compose.foundation.layout.WindowInsets
4241import androidx.compose.foundation.layout.WindowInsetsSides
4342import androidx.compose.foundation.layout.asPaddingValues
@@ -67,6 +66,7 @@ import androidx.compose.ui.Modifier
6766import androidx.compose.ui.draw.clip
6867import androidx.compose.ui.res.painterResource
6968import androidx.compose.ui.res.stringResource
69+ import androidx.compose.ui.text.style.TextOverflow
7070import androidx.compose.ui.unit.dp
7171import androidx.hilt.navigation.compose.hiltViewModel
7272import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -234,33 +234,28 @@ internal fun DeviceListItem(
234234 }
235235
236236 Column (
237- horizontalAlignment = Alignment .Start ,
238237 verticalArrangement = Arrangement .spacedBy(4 .dp),
238+ modifier = Modifier .weight(1.0f )
239239 ) {
240- Row {
241- Column (
242- verticalArrangement = Arrangement .spacedBy(4 .dp)
243- ) {
244- val name = result.advertisingData.name ? : result.peripheral.name
245- Text (
246- text = name ? : stringResource(R .string.no_name),
247- color = if (name != null ) {
248- MaterialTheme .colorScheme.onSurface
249- } else {
250- MaterialTheme .colorScheme.onSurface.copy(alpha = 0.38f )
251- },
252- style = MaterialTheme .typography.titleMedium,
253- )
254- Text (
255- text = result.peripheral.address,
256- style = MaterialTheme .typography.bodyMedium,
257- )
258- }
259- Spacer (modifier = Modifier .weight(1f ))
260-
261- // Show RSSI if available
262- RssiIcon (result.rssi)
263- }
240+ val name = result.advertisingData.name ? : result.peripheral.name
241+ Text (
242+ text = name ? : stringResource(R .string.no_name),
243+ color = if (name != null ) {
244+ MaterialTheme .colorScheme.onSurface
245+ } else {
246+ MaterialTheme .colorScheme.onSurface.copy(alpha = 0.38f )
247+ },
248+ maxLines = 2 ,
249+ overflow = TextOverflow .Ellipsis ,
250+ style = MaterialTheme .typography.titleMedium,
251+ )
252+ Text (
253+ text = result.peripheral.address,
254+ style = MaterialTheme .typography.bodyMedium,
255+ )
264256 }
257+
258+ // Show RSSI if available
259+ RssiIcon (result.rssi)
265260 }
266261}
0 commit comments