WIP is a little better

This commit is contained in:
geeksville 2020-04-07 10:40:01 -07:00
parent 9491a74fc6
commit 5403b15044
11 changed files with 156 additions and 107 deletions

View file

@ -1,12 +1,10 @@
package com.geeksville.mesh.ui
import androidx.compose.Composable
import androidx.compose.onCommit
import com.geeksville.android.GeeksvilleApplication
/**
* Track compose screen visibility
*/
/*
@Composable
fun analyticsScreen(name: String) {
onCommit(AppStatus.currentScreen) {
@ -16,4 +14,4 @@ fun analyticsScreen(name: String) {
GeeksvilleApplication.analytics.endScreenView()
}
}
}
} */

View file

@ -1,21 +1,6 @@
package com.geeksville.mesh.ui
import androidx.annotation.DrawableRes
import androidx.compose.Composable
import androidx.ui.core.Modifier
import androidx.ui.foundation.Text
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.layout.*
import androidx.ui.material.Divider
import androidx.ui.material.MaterialTheme
import androidx.ui.material.Surface
import androidx.ui.material.TextButton
import androidx.ui.tooling.preview.Preview
import androidx.ui.unit.dp
import com.geeksville.mesh.R
/*
@Composable
fun AppDrawer(
currentScreen: ScreenInfo,
@ -111,4 +96,4 @@ fun previewDrawer() {
currentScreen = AppStatus.currentScreen,
closeDrawer = { }
)
}
} */

View file

@ -73,8 +73,8 @@ fun BTScanScreen() {
val bluetoothAdapter =
(context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager?)?.adapter
analyticsScreen(name = "settings")
onCommit(AppStatus.currentScreen) {
// FIXME - remove onCommit now that we have a fragement to run in
onCommit() {
ScanState.debug("BTScan component active")
ScanUIState.selectedMacAddr = RadioInterfaceService.getBondedDeviceAddress(context)

View file

@ -23,7 +23,6 @@ object ChannelLog : Logging
@Composable
fun ChannelContent(channel: Channel?) {
analyticsScreen(name = "channel")
val typography = MaterialTheme.typography
val context = ContextAmbient.current

View file

@ -75,11 +75,10 @@ private val mapLifecycleCallbacks = object : Application.ActivityLifecycleCallba
@Composable
fun MapContent() {
analyticsScreen(name = "map")
val context = ContextAmbient.current
onCommit(AppStatus.currentScreen) {
// FIXME - remove onCommit
onCommit() {
onDispose {
// We no longer care about activity lifecycle
(context.applicationContext as Application).unregisterActivityLifecycleCallbacks(

View file

@ -1,19 +1,14 @@
package com.geeksville.mesh.ui
import androidx.compose.Composable
import androidx.compose.state
import androidx.ui.foundation.Text
import androidx.ui.material.*
import androidx.ui.tooling.preview.Preview
import androidx.ui.material.lightColorPalette
import com.geeksville.android.Logging
import com.geeksville.mesh.R
import com.geeksville.mesh.model.UIState
object UILog : Logging
val palette = lightColorPalette() // darkColorPalette()
/*
@Composable
fun MeshApp() {
val (drawerState, onDrawerStateChange) = state { DrawerState.Closed }
@ -73,3 +68,4 @@ private fun AppContent(openDrawer: () -> Unit) {
}
//}
}
*/

View file

@ -67,8 +67,6 @@ fun MessageCard(msg: TextMessage, modifier: Modifier = Modifier.None) {
@Composable
fun MessagesContent() {
analyticsScreen(name = "messages")
Column(modifier = LayoutSize.Fill) {
val sidePad = 8.dp

View file

@ -1,9 +1,6 @@
package com.geeksville.mesh.ui
import androidx.compose.Model
import com.geeksville.mesh.R
/*
data class ScreenInfo(val icon: Int, val label: String)
// defines the screens we have in the app
@ -28,3 +25,4 @@ object AppStatus {
fun navigateTo(destination: ScreenInfo) {
AppStatus.currentScreen = destination
}
*/

View file

@ -27,8 +27,6 @@ fun getInitials(name: String): String {
@Composable
fun UsersContent() {
analyticsScreen(name = "users")
Column {
Row {
fun connected() = UIState.isConnected.value != MeshService.ConnectionState.DISCONNECTED