Fixed that enterPressed() has been called on ACTION_DOWN and ACTION_UP
This commit is contained in:
parent
cee92e4d2d
commit
306669c23a
|
@ -5,8 +5,8 @@ import android.widget.EditText
|
|||
|
||||
|
||||
fun EditText.addEnterPressedListener(enterPressed: () -> Boolean) {
|
||||
this.setOnKeyListener { _, keyCode, _ ->
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
this.setOnKeyListener { _, keyCode, event ->
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||
return@setOnKeyListener enterPressed()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue