Begin UI for letting user set name and send texts

1.2-legacy
geeksville 2020-02-15 14:34:58 -08:00
rodzic 91b5987a5c
commit c4cfe727b3
7 zmienionych plików z 94 dodań i 7 usunięć

Wyświetl plik

@ -1,8 +1,11 @@
# Meshtastic-Android
This is a tool for using Android with mesh radios. You probably don't want it yet ;-).
This is a tool for using Android with mesh radios.
Questions? kevinh@geeksville.com
This project is currently pre-alpha, but if you have questions please join our chat [![Join the chat at https://gitter.im/Meshtastic/community](https://badges.gitter.im/Meshtastic/community.svg)](https://gitter.im/Meshtastic/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
Soon our first alpha release of will be released here:
[![Download at https://play.google.com/store/apps/details?id=com.geeksville.mesh](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dappgit%26anid%3Dadmob)
## Analytics setup

Wyświetl plik

@ -6,6 +6,8 @@ MVP features required for first public alpha
* set the radio by using the service
* startforegroundservice only if we have a valid radio
* if no radio is selected, launch app on the radio select screen
* provide gps location for devices that don't have it
* let user send texts
* when we select a new radio, restart the service
* show bt scan progress centered and towards the bottom of the screen
* get rid of green bar at top
@ -14,6 +16,7 @@ MVP features required for first public alpha
* treat macaddrs as the unique id, not the app layer user id
* on onStop somehow stop the BT scan (to prevent burning battery)
* add alphatest screen at boot
* have the foreground service's notification show a summary of network status, add (individually maskable) notifications for received texts or new positions
* prompt user to turnon bluetooth and bind
* test bt boot behavior
* fix BT device scanning - make a setup screen
@ -32,7 +35,8 @@ MVP features required for first public alpha
* test with oldest compatible android in emulator (see below for testing with hardware)
* make playstore entry, first public alpha
* tell Compose geeks
* tell various vendors & post in forum
* tell various vendors & post in forums
* add play store link with https://developers.google.com/analytics/devguides/collection/android/v4/campaigns#google-play-url-builder and the play icon
# Signal alpha release
Do this "Signal app compatible" release relatively soon after the alpha release of the android app.

Wyświetl plik

@ -15,8 +15,7 @@ class MeshUtilApplication : GeeksvilleApplication(null, "58e72ccc361883ea502510b
// We default to off in the manifest, FIXME turn on only if user approves
// leave off when running in the debugger
if (false && !Debug.isDebuggerConnected())
if (!BuildConfig.DEBUG || !Debug.isDebuggerConnected())
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true)
}
}

Wyświetl plik

@ -4,19 +4,35 @@ import androidx.annotation.DrawableRes
import androidx.compose.Composable
import androidx.compose.state
import androidx.ui.animation.Crossfade
import androidx.ui.core.Clip
import androidx.ui.core.Modifier
import androidx.ui.core.Text
import androidx.ui.core.TextField
import androidx.ui.foundation.VerticalScroller
import androidx.ui.foundation.shape.corner.RoundedCornerShape
import androidx.ui.graphics.Color
import androidx.ui.input.ImeAction
import androidx.ui.layout.*
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
import com.geeksville.mesh.R
object UILog : Logging
/// Given a human name, strip out the first letter of the first three words and return that as the initials for
/// that user.
fun getInitials(name: String): String {
val words = name.split(Regex("\\s+")).filter { it.isNotEmpty() }.take(3).map { it.first() }
.joinToString("")
return words
}
@Composable
fun HomeContent() {
Column {
@ -36,6 +52,51 @@ fun HomeContent() {
Text("Text: ${it.text}")
}
val message = state { "text message" }
Surface(color = Color.Yellow) {
Row {
Clip(shape = RoundedCornerShape(15.dp)) {
Padding(padding = 15.dp) {
TextField(
value = message.value,
onValueChange = { message.value = it },
textStyle = TextStyle(
color = Color.DarkGray
),
imeAction = ImeAction.Send,
onImeActionPerformed = {
UILog.info("did IME action")
}
)
}
}
}
}
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)

Wyświetl plik

@ -12,6 +12,7 @@
*DeviceState.receive_queue max_count:32
# FIXME, max out based on total SubPacket size And do fragmentation and reassembly (for larger payloads) at the Android layer, not the esp32 layer.
# note: this payload length is ONLY the bytes that are sent inside of the radiohead packet
*Data.payload max_size:251
# 128 bit psk key (we don't use 256 bit yet because we want to keep our QR code small)
@ -20,3 +21,4 @@
# MyMessage.name max_size:40
# or fixed_length or fixed_count, or max_count

Wyświetl plik

@ -295,10 +295,10 @@ message DeviceState {
/// We bump up the integer values in this enum to indicate minimum levels of encodings for saved files
/// if your file is below the Minimum you should discard it.
Minimum = 11;
Minimum = 12;
/// The current value we are using for saved files
Current = 11;
Current = 12;
};
/// A version integer used to invalidate old save files when we make incompatible changes

Wyświetl plik

@ -0,0 +1,18 @@
package com.geeksville.mesh.ui
import org.junit.Assert
import org.junit.Test
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class UIUnitTest {
@Test
fun initialsGood() {
Assert.assertEquals(getInitials("Kevin Hester"), "KH")
Assert.assertEquals(getInitials(" Kevin Hester Lesser Cat "), "KHL")
Assert.assertEquals(getInitials(" "), "")
}
}