Skip to content

Commit

Permalink
Maintenance: send when pressing return
Browse files Browse the repository at this point in the history
  • Loading branch information
robbi5 committed Jul 3, 2023
1 parent 3c248ef commit 578c6b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eu.pretix.pretixprint.ui

import android.os.Bundle
import android.text.Editable
import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.View.VISIBLE
Expand Down Expand Up @@ -80,7 +81,11 @@ class MaintenanceFragment : Fragment(R.layout.fragment_maintenance) {
}
binding.tilInput.editText!!.apply {
addTextChangedListener(afterTextChanged = validateTilInput)
setOnEditorActionListener { _, actionId, _ ->
setOnEditorActionListener { _, actionId, event ->
if (event.keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_DOWN) {
binding.btnSend.performClick()
return@setOnEditorActionListener true
}
return@setOnEditorActionListener when (actionId) {
EditorInfo.IME_ACTION_SEND -> {
binding.btnSend.performClick()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
android:hint="@string/maintain_data_to_send"
android:maxLines="1"
android:imeOptions="actionSend"
android:nextFocusForward="@+id/btnSend"
android:inputType="text|textNoSuggestions"/>
</com.google.android.material.textfield.TextInputLayout>

Expand Down

0 comments on commit 578c6b2

Please sign in to comment.