kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
commit
1ef41283eb
|
@ -2,6 +2,7 @@ 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
|
||||
|
@ -29,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) {
|
||||
|
@ -241,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()
|
||||
|
|
|
@ -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>
|
Ładowanie…
Reference in New Issue