diff --git a/TODO.md b/TODO.md index 7bc4d8c1..8e680725 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,7 @@ # High priority Work items for soon alpha builds -* fix notification setSmallIcon parameter -* have the foreground service's notification show a summary of network status "connected/disconnected, 5 of 6 nodes, nearest: kevin 5km", -* have notification (individually maskable) notifications for received texts - use file:///home/kevinh/packages/android-sdk-linux/docs/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html +* run services in sim mode on emulator * show offline nodes as greyed out * show time since last contact on the node info card * show pointer arrow on the outside of the user icons, always pointing towoards them @@ -21,6 +19,7 @@ Work items for soon alpha builds # Medium priority Features for future builds +* fix notification setSmallIcon parameter - change it to use the meshtastic icon * ditch compose and use https://github.com/zsmb13/MaterialDrawerKt + https://github.com/Kotlin/anko/wiki/Anko-Layouts? * describe user experience: devices always point to each other and show distance, you can send texts between nodes the channel is encrypted, you can share the the channel key with others by qr code or by sharing a special link @@ -158,3 +157,5 @@ Don't leave device discoverable. Don't let unpaired users do things with device * connect to bluetooth device automatically using minimum power - start looking at phone boot * tell various vendors & post in forums * change info() log strings to debug() +* have the foreground service's notification show a summary of network status "connected/disconnected, 5 of 6 nodes, nearest: kevin 5km", +* have notification (individually maskable) notifications for received texts - use file:///home/kevinh/packages/android-sdk-linux/docs/reference/android/support/v4/app/NotificationCompat.BigTextStyle.html diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt index 5f633d0a..1717a6af 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshService.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshService.kt @@ -268,8 +268,7 @@ class MeshService : Service(), Logging { chan.lightColor = Color.BLUE chan.importance = NotificationManager.IMPORTANCE_NONE chan.lockscreenVisibility = Notification.VISIBILITY_PRIVATE - val service = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager - service.createNotificationChannel(chan) + notificationManager.createNotificationChannel(chan) return channelId } @@ -278,7 +277,8 @@ class MeshService : Service(), Logging { getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager } - val channelId = + /// This must be lazy because we use Context + private val channelId: String by lazy() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { createNotificationChannel() } else { @@ -286,10 +286,11 @@ class MeshService : Service(), Logging { // https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#NotificationCompat.Builder(android.content.Context) "" } + } - private val mainAppIntent = Intent(this, MainActivity::class.java) - private val openAppIntent = PendingIntent.getActivity(this, 0, mainAppIntent, 0) - private val notificationBuilder = NotificationCompat.Builder(this, channelId) + private val openAppIntent: PendingIntent by lazy() { + PendingIntent.getActivity(this, 0, Intent(this, MainActivity::class.java), 0) + } /// A text message that has a arrived since the last notification update private var recentReceivedText: TextMessage? = null @@ -298,7 +299,7 @@ class MeshService : Service(), Logging { get() = if (!isConnected) "No radio connected" else - "Connected $numOnlineNodes / $numNodes online" + "Connected: $numOnlineNodes of $numNodes online" override fun toString() = summaryString @@ -307,11 +308,13 @@ class MeshService : Service(), Logging { */ private fun createNotification(): Notification { + val notificationBuilder = NotificationCompat.Builder(this, channelId) + val builder = notificationBuilder.setOngoing(true) .setPriority(PRIORITY_MIN) .setCategory(if (recentReceivedText != null) Notification.CATEGORY_SERVICE else Notification.CATEGORY_MESSAGE) .setSmallIcon(android.R.drawable.stat_sys_data_bluetooth) - .setContentTitle("Meshtastic: $summaryString") // leave this off for now so our notification looks smaller + .setContentTitle(summaryString) // leave this off for now so our notification looks smaller .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) .setContentIntent(openAppIntent) @@ -643,7 +646,7 @@ class MeshService : Service(), Logging { /// If we just changed our nodedb, we might want to do somethings private fun onNodeDBChanged() { updateNotification() - + // we don't ask for GPS locations from android if our device has a built in GPS if (!myNodeInfo!!.hasGPS) { // If we have at least one other person in the mesh, send our GPS position otherwise stop listening to GPS diff --git a/app/src/main/java/com/geeksville/mesh/ui/BTScanScreen.kt b/app/src/main/java/com/geeksville/mesh/ui/BTScanScreen.kt index c4d20e7f..be485ac7 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/BTScanScreen.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/BTScanScreen.kt @@ -7,8 +7,10 @@ import android.os.ParcelUuid import androidx.compose.* import androidx.compose.frames.modelMapOf import androidx.ui.core.ContextAmbient +import androidx.ui.core.LayoutModifier import androidx.ui.core.Text import androidx.ui.layout.Column +import androidx.ui.layout.LayoutGravity import androidx.ui.material.CircularProgressIndicator import androidx.ui.material.EmphasisLevels import androidx.ui.material.ProvideEmphasis @@ -136,7 +138,7 @@ fun BTScanScreen() { Text("An unexpected error was encountered. Please file a bug on our github: ${ScanUIState.errorText}") } else { if (ScanUIState.devices.isEmpty()) { - Text("Looking for Meshtastic devices... (zero found)") + Text(text = "Looking for Meshtastic devices... (zero found)", modifier = LayoutGravity.Center) CircularProgressIndicator() // Show that we are searching still } else { diff --git a/app/src/main/res/drawable/ic_baseline_settings_input_antenna_24.xml b/app/src/main/res/drawable/ic_baseline_settings_input_antenna_24.xml new file mode 100644 index 00000000..9379c0f4 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_settings_input_antenna_24.xml @@ -0,0 +1,10 @@ + + +