Merge remote-tracking branch 'root/master' into dev

1.2-legacy
Kevin Hester 2021-11-17 10:03:28 -08:00
commit 2f19434922
4 zmienionych plików z 16 dodań i 16 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
package com.geeksville.mesh.ui
import android.graphics.Color
import android.os.Bundle
import android.text.InputType
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -28,6 +30,8 @@ import java.util.*
// Allows usage like email.on(EditorInfo.IME_ACTION_NEXT, { confirm() })
fun EditText.on(actionId: Int, func: () -> Unit) {
setImeOptions(EditorInfo.IME_ACTION_SEND) // Force "SEND" IME Action
setRawInputType(InputType.TYPE_CLASS_TEXT) // Suppress ENTER but allow textMultiLine
setOnEditorActionListener { _, receivedActionId, _ ->
if (actionId == receivedActionId) {
@ -54,7 +58,7 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
private fun getShortDateTime(time: Date): String {
// return time if within 24 hours, otherwise date/time
val one_day = 60 * 60 * 24 * 100L
val one_day = 60 * 60 * 24 * 1000
if (System.currentTimeMillis() - time.time > one_day) {
return dateTimeFormat.format(time)
} else return timeFormat.format(time)
@ -142,7 +146,8 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
val nodes = model.nodeDB.nodes.value!!
val node = nodes.get(msg.from)
// Determine if this is my message (originated on this device).
val isMe = model.myNodeInfo.value?.myNodeNum == node?.num
// val isMe = model.myNodeInfo.value?.myNodeNum == node?.num
val isMe = msg.from == "^local"
// Set cardview offset and color.
val marginParams = holder.card.layoutParams as ViewGroup.MarginLayoutParams
@ -180,7 +185,7 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
holder.username.text = user?.shortName ?: msg.from
}
if (msg.errorMessage != null) {
// FIXME, set the style to show a red error message
context?.let { holder.card.setCardBackgroundColor(Color.RED) }
holder.messageText.text = msg.errorMessage
} else {
holder.messageText.text = msg.text
@ -239,7 +244,7 @@ class MessagesFragment : ScreenFragment("Messages"), Logging {
// requireActivity().hideKeyboard()
}
binding.messageInputText.on(EditorInfo.IME_ACTION_DONE) {
binding.messageInputText.on(EditorInfo.IME_ACTION_SEND) {
debug("did IME action")
val str = binding.messageInputText.text.toString().trim()

Wyświetl plik

@ -22,7 +22,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890- "
android:hint="@string/channel_name"
android:imeOptions="actionDone"
android:maxLength="15"
android:singleLine="true"
@ -92,8 +91,7 @@
<AutoCompleteTextView
android:id="@+id/filled_exposed_dropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/set_channel_options" />
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<Button

Wyświetl plik

@ -33,8 +33,8 @@
android:id="@+id/messageInputText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:maxLength="200"
android:imeOptions="actionDone"
android:text="" />
</com.google.android.material.textfield.TextInputLayout>
@ -42,15 +42,12 @@
<ImageButton
android:id="@+id/sendButton"
android:layout_width="64dp"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_height="64dp"
android:layout_marginBottom="4dp"
android:contentDescription="@string/send_text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/textInputLayout"
app:layout_constraintTop_toBottomOf="@+id/messageListView"
app:srcCompat="@drawable/ic_send_24" />
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -4,7 +4,7 @@
<color name="colorPrimary">#141414</color>
<color name="colorPrimaryDark">#141414</color>
<color name="colorMsg">#212121</color>
<color name="colorMyMsg">#212121</color>
<color name="colorMyMsg">#28463C</color>
<color name="colorDebugBackground">#141414</color>
<color name="colorAdvancedBackground">#141414</color>
<color name="colorIconTint">#FFFFFF</color>