sforkowany z mirror/meshtastic-android
Fix: EditText with textMultiLine & IME_ACTION_SEND
rodzic
615f202583
commit
15161862f3
|
@ -1,6 +1,7 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -28,6 +29,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) {
|
||||
|
@ -239,7 +242,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,7 +33,7 @@
|
|||
android:id="@+id/messageInputText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textMultiLine"
|
||||
android:maxLength="200"
|
||||
android:text="" />
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue