Skip to content

Commit

Permalink
Merge pull request #37025 from nekomatata/lineedit-text-entered-android
Browse files Browse the repository at this point in the history
Fix text_entered signal when max_length is used in LineEdit on Android
  • Loading branch information
akien-mga authored Mar 17, 2020
2 parents c5d7613 + c169367 commit 51772e7
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ public void onTextChanged(final CharSequence pCharSequence, final int start, fin
@Override
public void run() {
for (int i = 0; i < count; ++i) {
GodotLib.key(0, 0, newChars[i], true);
GodotLib.key(0, 0, newChars[i], false);
int key = newChars[i];
if (key == '\n') {
// Return keys are handled through action events
continue;
}
GodotLib.key(0, 0, key, true);
GodotLib.key(0, 0, key, false);
}
}
});
Expand All @@ -134,8 +139,13 @@ public void run() {
});
}

if (pActionID == EditorInfo.IME_ACTION_DONE) {
if (pActionID == EditorInfo.IME_NULL) {
// Enter key has been pressed
GodotLib.key(KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_ENTER, 0, true);
GodotLib.key(KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_ENTER, 0, false);

this.mView.requestFocus();
return true;
}
return false;
}
Expand Down

0 comments on commit 51772e7

Please sign in to comment.