kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
preview shows up again
rodzic
072b847ca3
commit
37230d8bc0
|
@ -148,11 +148,6 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun previewView() {
|
||||
composeView()
|
||||
}
|
||||
|
||||
private fun sendTestPackets() {
|
||||
exceptionReporter {
|
||||
|
@ -206,6 +201,38 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HomeContent() {
|
||||
Column {
|
||||
Text(text = "Meshtastic")
|
||||
|
||||
Text("Radio connected: ${isConnected.value}")
|
||||
|
||||
nodes.value.values.forEach {
|
||||
composeNodeInfo(it)
|
||||
}
|
||||
|
||||
messages.value.forEach {
|
||||
Text("Text: ${it.text}")
|
||||
}
|
||||
|
||||
Button(text = "Start scan",
|
||||
onClick = {
|
||||
if (bluetoothAdapter != null) {
|
||||
// Note: We don't want this service to die just because our activity goes away (because it is doing a software update)
|
||||
// So we use the application context instead of the activity
|
||||
SoftwareUpdateService.enqueueWork(
|
||||
applicationContext,
|
||||
SoftwareUpdateService.startUpdateIntent
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
Button(text = "send packets",
|
||||
onClick = { sendTestPackets() })
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HomeScreen(openDrawer: () -> Unit) {
|
||||
Column {
|
||||
|
@ -218,34 +245,7 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
}
|
||||
)
|
||||
VerticalScroller(modifier = LayoutFlexible(1f)) {
|
||||
Column {
|
||||
Text(text = "Meshtastic")
|
||||
|
||||
Text("Radio connected: ${isConnected.value}")
|
||||
|
||||
nodes.value.values.forEach {
|
||||
composeNodeInfo(it)
|
||||
}
|
||||
|
||||
messages.value.forEach {
|
||||
Text("Text: ${it.text}")
|
||||
}
|
||||
|
||||
Button(text = "Start scan",
|
||||
onClick = {
|
||||
if (bluetoothAdapter != null) {
|
||||
// Note: We don't want this service to die just because our activity goes away (because it is doing a software update)
|
||||
// So we use the application context instead of the activity
|
||||
SoftwareUpdateService.enqueueWork(
|
||||
applicationContext,
|
||||
SoftwareUpdateService.startUpdateIntent
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
Button(text = "send packets",
|
||||
onClick = { sendTestPackets() })
|
||||
}
|
||||
HomeContent()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,6 +276,13 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun previewView() {
|
||||
// It seems modaldrawerlayout not yet supported in preview
|
||||
HomeContent()
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AppContent(openDrawer: () -> Unit) {
|
||||
Crossfade(AppStatus.currentScreen) { screen ->
|
||||
|
|
Ładowanie…
Reference in New Issue