diff --git a/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt b/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt index e90d6b607..d93889da9 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/MeshApp.kt @@ -22,7 +22,14 @@ fun HomeContent() { Column { Text(text = "Meshtastic") - Text("Radio connected: ${UIState.isConnected.value}") + + Row { + Container(LayoutSize(40.dp, 40.dp)) { + VectorImage(id = if (UIState.isConnected.value) R.drawable.cloud_on else R.drawable.cloud_off) + } + + Text(if (UIState.isConnected.value) "Connected" else "Not Connected") + } UIState.nodes.value.values.forEach { NodeInfoCard(it) diff --git a/app/src/main/java/com/geeksville/mesh/ui/NodeInfoCard.kt b/app/src/main/java/com/geeksville/mesh/ui/NodeInfoCard.kt index bbe3e9bf1..764582f16 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/NodeInfoCard.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/NodeInfoCard.kt @@ -3,15 +3,10 @@ package com.geeksville.mesh.ui import androidx.compose.Composable import androidx.ui.core.Modifier import androidx.ui.core.Text -import androidx.ui.foundation.DrawImage -import androidx.ui.layout.Container -import androidx.ui.layout.LayoutPadding -import androidx.ui.layout.LayoutSize -import androidx.ui.layout.Row +import androidx.ui.layout.* import androidx.ui.material.EmphasisLevels import androidx.ui.material.MaterialTheme import androidx.ui.material.ProvideEmphasis -import androidx.ui.res.imageResource import androidx.ui.tooling.preview.Preview import androidx.ui.unit.dp import com.geeksville.mesh.NodeInfo @@ -20,10 +15,26 @@ import com.geeksville.mesh.R @Composable fun NodeIcon(modifier: Modifier = Modifier.None, node: NodeInfo) { - val image = imageResource(R.drawable.ic_launcher_foreground) + Column { + Container(modifier = modifier + LayoutSize(40.dp, 40.dp)) { + VectorImage(id = if (node.user?.shortName != null) R.drawable.person else R.drawable.help) + } - Container(modifier = modifier + LayoutSize(40.dp, 40.dp)) { - DrawImage(image) + // Show our shortname if possible + node.user?.shortName?.let { + Text(it) + } + + } +} + +@Composable +fun CompassHeading(modifier: Modifier = Modifier.None, node: NodeInfo) { + Column { + Container(modifier = modifier + LayoutSize(40.dp, 40.dp)) { + VectorImage(id = R.drawable.navigation) + } + Text("2.3 km") } } @@ -49,14 +60,14 @@ fun NodeInfoCard(node: NodeInfo) { // Text("Node: ${it.user?.longName}") Row(modifier = LayoutPadding(16.dp)) { NodeIcon( - modifier = LayoutPadding(left = 0.dp, top = 0.dp, right = 16.dp, bottom = 0.dp), + modifier = LayoutPadding(left = 0.dp, top = 0.dp, right = 0.dp, bottom = 0.dp), node = node ) NodeHeading(node) // FIXME - show compass instead - NodeIcon(node = node) + CompassHeading(node = node) } } diff --git a/app/src/main/res/drawable/app_icon2.xml b/app/src/main/res/drawable/app_icon2.xml new file mode 100644 index 000000000..ef8c94b55 --- /dev/null +++ b/app/src/main/res/drawable/app_icon2.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/app/src/main/res/drawable/cloud_off.xml b/app/src/main/res/drawable/cloud_off.xml new file mode 100644 index 000000000..92b0aa54f --- /dev/null +++ b/app/src/main/res/drawable/cloud_off.xml @@ -0,0 +1,14 @@ + + + + diff --git a/app/src/main/res/drawable/cloud_on.xml b/app/src/main/res/drawable/cloud_on.xml new file mode 100644 index 000000000..0c9bcd4d5 --- /dev/null +++ b/app/src/main/res/drawable/cloud_on.xml @@ -0,0 +1,14 @@ + + + + diff --git a/app/src/main/res/drawable/face.xml b/app/src/main/res/drawable/face.xml new file mode 100644 index 000000000..94608039c --- /dev/null +++ b/app/src/main/res/drawable/face.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/app/src/main/res/drawable/navigation.xml b/app/src/main/res/drawable/navigation.xml new file mode 100644 index 000000000..1b5ee3904 --- /dev/null +++ b/app/src/main/res/drawable/navigation.xml @@ -0,0 +1,14 @@ + + + + diff --git a/app/src/main/res/drawable/person.xml b/app/src/main/res/drawable/person.xml new file mode 100644 index 000000000..f336fc423 --- /dev/null +++ b/app/src/main/res/drawable/person.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/app/src/main/res/drawable/signal_level.xml b/app/src/main/res/drawable/signal_level.xml new file mode 100644 index 000000000..c560971ec --- /dev/null +++ b/app/src/main/res/drawable/signal_level.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index eca70cfe5..32c9047fb 100644 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -1,5 +1,5 @@ - + \ No newline at end of file