From a59aaf5c289b54b7da62cb31c3ecbb5eebc618ca Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Mon, 1 Jul 2024 20:17:05 -0500 Subject: [PATCH] Adds hardware model string to NodeInfo card ui if available (#1111) --- .../java/com/geeksville/mesh/ui/NodeInfo.kt | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/NodeInfo.kt b/app/src/main/java/com/geeksville/mesh/ui/NodeInfo.kt index da57200d3..91731dcbc 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/NodeInfo.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/NodeInfo.kt @@ -90,7 +90,7 @@ fun NodeInfo( .background(bgColor) .padding(8.dp) ) { - val (chip, dist, name, pos, alt, sats, batt, heard, sig, env) = createRefs() + val (chip, dist, name, hw, pos, alt, sats, batt, heard, sig, env) = createRefs() val barrierBattHeard = createStartBarrier(batt, heard) val sigBarrier = createBottomBarrier(pos, heard) @@ -149,8 +149,7 @@ fun NodeInfo( bias = 0F, startMargin = 8.dp, endMargin = 8.dp, - - ) + ) width = Dimension.preferredWrapContent }, text = nodeName, @@ -158,11 +157,36 @@ fun NodeInfo( textDecoration = TextDecoration.LineThrough.takeIf { isIgnored }, ) + val hwInfoString = thisNodeInfo?.user?.hwModelString + if (hwInfoString != null){ + Text( + modifier = Modifier.constrainAs(hw) { + linkTo( + top = name.bottom, + bottom = pos.top, + bias = 0F, + topMargin = 4.dp, + bottomMargin = 4.dp + ) + linkTo( + start = name.start, + end = barrierBattHeard, + bias = 0F, + endMargin = 8.dp + ) + width = Dimension.preferredWrapContent + }, + text = hwInfoString, + fontSize = MaterialTheme.typography.caption.fontSize, + style = style, + ) + } + val position = thatNodeInfo.position LinkedCoordinates( modifier = Modifier.constrainAs(pos) { linkTo( - top = name.bottom, + top = hw.bottom, bottom = sig.top, bias = 0F, topMargin = 4.dp,