node list is ugly but it kinda works

This commit is contained in:
geeksville 2020-04-08 15:36:49 -07:00
parent 0ff97ba3c4
commit 9e9cfae829
5 changed files with 47 additions and 43 deletions

View file

@ -292,8 +292,12 @@ class MainActivity : AppCompatActivity(), Logging,
}.attach()
model.isConnected.observe(this, Observer { connected ->
val image =
if (connected != MeshService.ConnectionState.DISCONNECTED) R.drawable.cloud_on else R.drawable.cloud_off
val image = when (connected) {
MeshService.ConnectionState.CONNECTED -> R.drawable.cloud_on
MeshService.ConnectionState.DEVICE_SLEEP -> R.drawable.ic_twotone_cloud_upload_24
MeshService.ConnectionState.DISCONNECTED -> R.drawable.cloud_off
}
connectStatusImage.setImageDrawable(getDrawable(image))
})
}

View file

@ -128,27 +128,7 @@ class UsersFragment : ScreenFragment("Users"), Logging {
/*
@Composable
fun UsersContent() {
Column {
Row {
fun connected() = UIState.isConnected.value != MeshService.ConnectionState.DISCONNECTED
VectorImage(
id = if (connected()) R.drawable.cloud_on else R.drawable.cloud_off,
tint = palette.onBackground,
modifier = LayoutPadding(start = 8.dp)
)
Column {
Text(
when (UIState.isConnected.value) {
MeshService.ConnectionState.CONNECTED -> "Connected"
MeshService.ConnectionState.DISCONNECTED -> "Disconnected"
MeshService.ConnectionState.DEVICE_SLEEP -> "Power Saving"
},
modifier = LayoutPadding(start = 8.dp)
)
if (false) { // hide the firmware update button for now, it is kinda ugly and users don't need it yet
/// Create a software update button
@ -169,9 +149,6 @@ fun UsersContent() {
}
}
NodeDB.nodes.values.forEach {
NodeInfoCard(it)
}
/* FIXME - doens't work yet - probably because I'm not using release keys