зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1888378 - Commit url on numpad ENTER too. r=android-reviewers,mcarare
Differential Revision: https://phabricator.services.mozilla.com/D206002
This commit is contained in:
Родитель
61d13ab945
Коммит
25d431d79c
|
@ -182,7 +182,7 @@ open class InlineAutocompleteEditText @JvmOverloads constructor(
|
|||
return false
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
|
||||
// If the edit text has a composition string, don't submit the text yet.
|
||||
// ENTER is needed to commit the composition string.
|
||||
val content = text
|
||||
|
@ -201,7 +201,7 @@ open class InlineAutocompleteEditText @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
private val onKey = fun (_: View, keyCode: Int, event: KeyEvent): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
|
||||
if (event.action != KeyEvent.ACTION_DOWN) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -226,6 +226,17 @@ class InlineAutocompleteEditTextTest {
|
|||
assertTrue(invoked)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `onCommitListenerInvocation with Numpad ENTER`() {
|
||||
val et = InlineAutocompleteEditText(testContext, attributes)
|
||||
var invoked = false
|
||||
et.setOnCommitListener { invoked = true }
|
||||
et.onAttachedToWindow()
|
||||
|
||||
et.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_NUMPAD_ENTER))
|
||||
assertTrue(invoked)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onTextChangeListenerInvocation() {
|
||||
val et = InlineAutocompleteEditText(testContext, attributes)
|
||||
|
|
Загрузка…
Ссылка в новой задаче