placeholder channel screen

pull/8/head
geeksville 2020-02-17 20:00:11 -08:00
rodzic bdd6e5de6c
commit bb2b11264d
4 zmienionych plików z 68 dodań i 37 usunięć

Wyświetl plik

@ -615,12 +615,17 @@ class MeshService : Service(), Logging {
debug("Received broadcast ${intent.action}")
when (intent.action) {
RadioInterfaceService.RADIO_CONNECTED_ACTION -> {
onConnectionChanged(intent.getBooleanExtra(EXTRA_CONNECTED, false))
try {
onConnectionChanged(intent.getBooleanExtra(EXTRA_CONNECTED, false))
// forward the connection change message to anyone who is listening to us. but change the action
// to prevent an infinite loop from us receiving our own broadcast. ;-)
intent.action = ACTION_MESH_CONNECTED
explicitBroadcast(intent)
// forward the connection change message to anyone who is listening to us. but change the action
// to prevent an infinite loop from us receiving our own broadcast. ;-)
intent.action = ACTION_MESH_CONNECTED
explicitBroadcast(intent)
} catch (ex: RemoteException) {
// This can happen sometimes (especially if the device is slowly dying due to killing power, don't report to crashlytics
warn("Abandoning reconnect attempt, due to errors during init: ${ex.message}")
}
}
RadioInterfaceService.RECEIVE_FROMRADIO_ACTION -> {

Wyświetl plik

@ -0,0 +1,53 @@
package com.geeksville.mesh.ui
import androidx.compose.Composable
import androidx.ui.core.Text
import androidx.ui.foundation.DrawImage
import androidx.ui.layout.*
import androidx.ui.material.MaterialTheme
import androidx.ui.res.imageResource
import androidx.ui.tooling.preview.Preview
import androidx.ui.unit.dp
import com.geeksville.mesh.R
/// The Compose IDE preview doesn't like the protobufs
data class Channel(val name: String, val num: Int)
@Composable
fun ChannelContent(channel: Channel = Channel("Default", 7)) {
val typography = MaterialTheme.typography()
Column(modifier = LayoutSize.Fill + LayoutPadding(16.dp)) {
Text(
text = "Channel: ${channel.name}",
modifier = LayoutGravity.Center,
style = typography.h4
)
Row {
val image = imageResource(id = R.drawable.qrcode)
Container(modifier = LayoutGravity.Center + LayoutSize.Min(320.dp, 320.dp)) {
DrawImage(image = image)
}
}
Text(
text = "Number: ${channel.num}",
modifier = LayoutGravity.Center
)
Text(
text = "Mode: Long range (but slow)",
modifier = LayoutGravity.Center
)
}
}
@Preview
@Composable
fun previewChannel() {
// another bug? It seems modaldrawerlayout not yet supported in preview
MaterialTheme(colors = palette) {
ChannelContent()
}
}

Wyświetl plik

@ -3,16 +3,13 @@ package com.geeksville.mesh.ui
import androidx.compose.Composable
import androidx.compose.state
import androidx.ui.animation.Crossfade
import androidx.ui.core.Clip
import androidx.ui.core.Text
import androidx.ui.core.TextField
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.input.ImeAction
import androidx.ui.layout.*
import androidx.ui.layout.Column
import androidx.ui.layout.Container
import androidx.ui.layout.LayoutSize
import androidx.ui.layout.Row
import androidx.ui.material.*
import androidx.ui.material.surface.Surface
import androidx.ui.text.TextStyle
import androidx.ui.tooling.preview.Preview
import androidx.ui.unit.dp
import com.geeksville.android.Logging
@ -47,30 +44,6 @@ fun HomeContent() {
NodeInfoCard(it)
}
val state = state { "fixme bob" }
Surface(color = Color.LightGray) {
Row {
Clip(shape = RoundedCornerShape(15.dp)) {
Padding(padding = 15.dp) {
TextField(
value = state.value,
onValueChange = { state.value = it },
textStyle = TextStyle(
color = Color.DarkGray
),
imeAction = ImeAction.Done,
onImeActionPerformed = {
UILog.info("did IME action")
}
)
}
}
Text(text = getInitials(state.value))
}
}
/* FIXME - doens't work yet - probably because I'm not using release keys
// If account is null, then show the signin button, otherwise
val context = ambient(ContextAmbient)
@ -158,7 +131,7 @@ private fun AppContent(openDrawer: () -> Unit) {
Screen.messages -> MessagesContent()
Screen.settings -> BTScanScreen()
Screen.users -> HomeContent()
Screen.channel -> HomeContent()
Screen.channel -> ChannelContent()
else -> TODO()
}
//}

Wyświetl plik

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 690 B

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 690 B