mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-23 00:02:31 -04:00
UI is a little less ugly (but still ugly)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
7
app/src/main/res/drawable/app_icon2.xml
Normal file
7
app/src/main/res/drawable/app_icon2.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<vector android:height="108dp" android:tint="?attr/colorControlNormal"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="108dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<group android:scaleX="0.5" android:scaleY="0.5" android:translateX="6" android:translateY="6">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,5c-3.87,0 -7,3.13 -7,7h2c0,-2.76 2.24,-5 5,-5s5,2.24 5,5h2c0,-3.87 -3.13,-7 -7,-7zM13,14.29c0.88,-0.39 1.5,-1.26 1.5,-2.29 0,-1.38 -1.12,-2.5 -2.5,-2.5S9.5,10.62 9.5,12c0,1.02 0.62,1.9 1.5,2.29v3.3L7.59,21 9,22.41l3,-3 3,3L16.41,21 13,17.59v-3.3zM12,1C5.93,1 1,5.93 1,12h2c0,-4.97 4.03,-9 9,-9s9,4.03 9,9h2c0,-6.07 -4.93,-11 -11,-11z"/>
|
||||
</group>
|
||||
</vector>
|
||||
14
app/src/main/res/drawable/cloud_off.xml
Normal file
14
app/src/main/res/drawable/cloud_off.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M22,15c0,-1.66 -1.34,-3 -3,-3h-1.5v-0.5C17.5,8.46 15.04,6 12,6c-0.77,0 -1.49,0.17 -2.16,0.46L20.79,17.4c0.73,-0.55 1.21,-1.41 1.21,-2.4zM2,14c0,2.21 1.79,4 4,4h9.73l-8,-8H6c-2.21,0 -4,1.79 -4,4z"
|
||||
android:fillAlpha=".3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4c-1.33,0 -2.57,0.36 -3.65,0.97l1.49,1.49C10.51,6.17 11.23,6 12,6c3.04,0 5.5,2.46 5.5,5.5v0.5H19c1.66,0 3,1.34 3,3 0,0.99 -0.48,1.85 -1.21,2.4l1.41,1.41c1.09,-0.92 1.8,-2.27 1.8,-3.81 0,-2.64 -2.05,-4.78 -4.65,-4.96zM3,5.27l2.77,2.77h-0.42C2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h11.73l2,2 1.41,-1.41L4.41,3.86 3,5.27zM7.73,10l8,8H6c-2.21,0 -4,-1.79 -4,-4s1.79,-4 4,-4h1.73z"/>
|
||||
</vector>
|
||||
14
app/src/main/res/drawable/cloud_on.xml
Normal file
14
app/src/main/res/drawable/cloud_on.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19.21,12.04l-1.53,-0.11 -0.3,-1.5C16.88,7.86 14.62,6 12,6 9.94,6 8.08,7.14 7.12,8.96l-0.5,0.95 -1.07,0.11C3.53,10.24 2,11.95 2,14c0,2.21 1.79,4 4,4h13c1.65,0 3,-1.35 3,-3 0,-1.55 -1.22,-2.86 -2.79,-2.96zM10,17l-3.5,-3.5 1.41,-1.41L10,14.18l4.6,-4.6 1.41,1.41L10,17z"
|
||||
android:fillAlpha=".3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M19.35,10.04C18.67,6.59 15.64,4 12,4 9.11,4 6.6,5.64 5.35,8.04 2.34,8.36 0,10.91 0,14c0,3.31 2.69,6 6,6h13c2.76,0 5,-2.24 5,-5 0,-2.64 -2.05,-4.78 -4.65,-4.96zM19,18L6,18c-2.21,0 -4,-1.79 -4,-4 0,-2.05 1.53,-3.76 3.56,-3.97l1.07,-0.11 0.5,-0.95C8.08,7.14 9.94,6 12,6c2.62,0 4.88,1.86 5.39,4.43l0.3,1.5 1.53,0.11c1.56,0.1 2.78,1.41 2.78,2.96 0,1.65 -1.35,3 -3,3zM10,14.18l-2.09,-2.09L6.5,13.5 10,17l6.01,-6.01 -1.41,-1.41z"/>
|
||||
</vector>
|
||||
20
app/src/main/res/drawable/face.xml
Normal file
20
app/src/main/res/drawable/face.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17.5,8c0.46,0 0.91,-0.05 1.34,-0.12C17.44,5.56 14.9,4 12,4c-0.46,0 -0.91,0.05 -1.34,0.12C12.06,6.44 14.6,8 17.5,8zM8.08,5.03C6.37,6 5.05,7.58 4.42,9.47c1.71,-0.97 3.03,-2.55 3.66,-4.44z"
|
||||
android:fillAlpha=".3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,4c2.9,0 5.44,1.56 6.84,3.88 -0.43,0.07 -0.88,0.12 -1.34,0.12 -2.9,0 -5.44,-1.56 -6.84,-3.88 0.43,-0.07 0.88,-0.12 1.34,-0.12zM8.08,5.03C7.45,6.92 6.13,8.5 4.42,9.47 5.05,7.58 6.37,6 8.08,5.03zM12,20c-4.41,0 -8,-3.59 -8,-8 0,-0.05 0.01,-0.1 0.01,-0.15 2.6,-0.98 4.68,-2.99 5.74,-5.55 1.83,2.26 4.62,3.7 7.75,3.7 0.75,0 1.47,-0.09 2.17,-0.24 0.21,0.71 0.33,1.46 0.33,2.24 0,4.41 -3.59,8 -8,8z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M9,13m-1.25,0a1.25,1.25 0,1 1,2.5 0a1.25,1.25 0,1 1,-2.5 0"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M15,13m-1.25,0a1.25,1.25 0,1 1,2.5 0a1.25,1.25 0,1 1,-2.5 0"/>
|
||||
</vector>
|
||||
14
app/src/main/res/drawable/navigation.xml
Normal file
14
app/src/main/res/drawable/navigation.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M7.72,17.7l3.47,-1.53 0.81,-0.36 0.81,0.36 3.47,1.53L12,7.27z"
|
||||
android:fillAlpha=".3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M4.5,20.29l0.71,0.71L12,18l6.79,3 0.71,-0.71L12,2 4.5,20.29zM12.81,16.17l-0.81,-0.36 -0.81,0.36 -3.47,1.53L12,7.27l4.28,10.43 -3.47,-1.53z"/>
|
||||
</vector>
|
||||
18
app/src/main/res/drawable/person.xml
Normal file
18
app/src/main/res/drawable/person.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,8m-2.1,0a2.1,2.1 0,1 1,4.2 0a2.1,2.1 0,1 1,-4.2 0"
|
||||
android:fillAlpha=".3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,14.9c-2.97,0 -6.1,1.46 -6.1,2.1v1.1h12.2V17c0,-0.64 -3.13,-2.1 -6.1,-2.1z"
|
||||
android:fillAlpha=".3"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M12,13c-2.67,0 -8,1.34 -8,4v3h16v-3c0,-2.66 -5.33,-4 -8,-4zM18.1,18.1L5.9,18.1L5.9,17c0,-0.64 3.13,-2.1 6.1,-2.1s6.1,1.46 6.1,2.1v1.1zM12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,5.9c1.16,0 2.1,0.94 2.1,2.1 0,1.16 -0.94,2.1 -2.1,2.1S9.9,9.16 9.9,8c0,-1.16 0.94,-2.1 2.1,-2.1z"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/signal_level.xml
Normal file
10
app/src/main/res/drawable/signal_level.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17,4h3v16h-3L17,4zM5,14h3v6L5,20v-6zM11,9h3v11h-3L11,9z"/>
|
||||
</vector>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<foreground android:drawable="@drawable/app_icon2" />
|
||||
</adaptive-icon>
|
||||
Reference in New Issue
Block a user