From c15e498b08b418779d18ed0fde9026f67201451a Mon Sep 17 00:00:00 2001 From: Ludovic Goix Date: Wed, 23 Sep 2020 23:13:35 -0400 Subject: [PATCH 1/4] Add date to message #169 --- app/src/main/java/com/geeksville/mesh/ui/MessagesFragment.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/MessagesFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/MessagesFragment.kt index 9670f77a..2093dfcc 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/MessagesFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/MessagesFragment.kt @@ -1,7 +1,6 @@ package com.geeksville.mesh.ui import android.os.Bundle -import android.text.format.DateFormat import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -22,6 +21,7 @@ import com.geeksville.mesh.service.MeshService import com.google.android.material.chip.Chip import kotlinx.android.synthetic.main.adapter_message_layout.view.* import kotlinx.android.synthetic.main.messages_fragment.* +import java.text.DateFormat import java.util.* // Allows usage like email.on(EditorInfo.IME_ACTION_NEXT, { confirm() }) @@ -40,7 +40,7 @@ class MessagesFragment : ScreenFragment("Messages"), Logging { private val model: UIViewModel by activityViewModels() - private lateinit var dateTimeFormat : java.text.DateFormat + private val dateTimeFormat: DateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM) // Provide a direct reference to each of the views within a data item // Used to cache the views within the item layout for fast access @@ -173,7 +173,6 @@ class MessagesFragment : ScreenFragment("Messages"), Logging { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - dateTimeFormat = DateFormat.getTimeFormat(context) messageInputText.on(EditorInfo.IME_ACTION_DONE) { debug("did IME action") From 40762c4e22222b6844b444c5eabcaba2f5a7c289 Mon Sep 17 00:00:00 2001 From: Paul Mandal Date: Fri, 25 Sep 2020 19:43:20 -0600 Subject: [PATCH 2/4] Fix the broadcast intent action package in IMeshService.aidl's comments --- app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl index bf13bc7a..b07374ca 100644 --- a/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl +++ b/app/src/main/aidl/com/geeksville/mesh/IMeshService.aidl @@ -22,7 +22,7 @@ The intent you use to reach the service should look like this: Once you have bound to the service you should register your broadcast receivers per https://developer.android.com/guide/components/broadcasts#context-registered-receivers - // com.geeksville.com.geeksville.mesh.x broadcast intents, where x is: + // com.geeksville.mesh.x broadcast intents, where x is: // RECEIVED_DATA for data received from other nodes. payload will contain a DataPacket // NODE_CHANGE for new IDs appearing or disappearing // CONNECTION_CHANGED for losing/gaining connection to the packet radio From 1357be5499b7c9d86c5d0c18049edf64aab340dc Mon Sep 17 00:00:00 2001 From: Paul Mandal Date: Fri, 25 Sep 2020 19:44:04 -0600 Subject: [PATCH 3/4] Change SafeBluetooth's handler to run on the main thread --- app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt index 9bdeda6a..ee460c9c 100644 --- a/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt +++ b/app/src/main/java/com/geeksville/mesh/service/SafeBluetooth.kt @@ -5,6 +5,7 @@ import android.content.Context import android.os.Build import android.os.DeadObjectException import android.os.Handler +import android.os.Looper import com.geeksville.android.GeeksvilleApplication import com.geeksville.android.Logging import com.geeksville.concurrent.CallbackContinuation @@ -97,7 +98,7 @@ class SafeBluetooth(private val context: Context, private val device: BluetoothD * skanky hack to restart BLE if it says it is hosed * https://stackoverflow.com/questions/35103701/ble-android-onconnectionstatechange-not-being-called */ - private val mHandler: Handler = Handler() + private val mHandler: Handler = Handler(Looper.getMainLooper()) fun restartBle() { GeeksvilleApplication.analytics.track("ble_restart") // record # of times we needed to use this nasty hack From bd18a3aadde6f6d5b8132d766b18cbc234d2777b Mon Sep 17 00:00:00 2001 From: Gunter Tim Date: Sat, 26 Sep 2020 22:21:39 -0700 Subject: [PATCH 4/4] Always keep first character of long name when making short name from one word long names --- app/src/main/java/com/geeksville/mesh/model/UIState.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/geeksville/mesh/model/UIState.kt b/app/src/main/java/com/geeksville/mesh/model/UIState.kt index a673dd6e..a7350865 100644 --- a/app/src/main/java/com/geeksville/mesh/model/UIState.kt +++ b/app/src/main/java/com/geeksville/mesh/model/UIState.kt @@ -28,7 +28,7 @@ fun getInitials(nameIn: String): String { val initials = when (words.size) { in 0..minchars - 1 -> { - val nm = name.filterNot { c -> c.toLowerCase() in "aeiou" } + val nm = name.first() + name.drop(1).filterNot { c -> c.toLowerCase() in "aeiou" } if (nm.length >= nchars) nm else name } else -> words.map { it.first() }.joinToString("")