Skip to content

Commit b4185aa

Browse files
Update InPlaceEditView.java for Enter Key issue 3850 (#3853)
Second attempt to fix issue #3850 , when the Enter key is pressed the TextField loses focus, now I have added this condition to the code that if it is a multi-line TextArea then when the Enter key is pressed it wraps maintaining the focus on the TextField instead if it is a single line TextField it enters the onEditorAction() function
1 parent ce30484 commit b4185aa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Ports/Android/src/com/codename1/impl/android/InPlaceEditView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,10 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
21602160
case KeyEvent.KEYCODE_MENU:
21612161
endEditing(InPlaceEditView.REASON_SYSTEM_KEY, false, true, 0);
21622162
break;
2163+
case KeyEvent.KEYCODE_ENTER:
2164+
if (mEditText.mTextArea != null && mEditText.mTextArea.isSingleLineTextArea())
2165+
onEditorAction(EditorInfo.IME_ACTION_DONE);
2166+
break;
21632167
case KeyEvent.KEYCODE_ESCAPE:
21642168
endEditing(InPlaceEditView.REASON_IME_ACTION, false, true, EditorInfo.IME_ACTION_DONE, keyCode);
21652169
break;

0 commit comments

Comments
 (0)