From b4185aadeb1f7ac1eee71bc20fb6fd9f9bb4575a Mon Sep 17 00:00:00 2001 From: ImmediandoSrl Date: Sat, 16 Nov 2024 07:14:05 +0100 Subject: [PATCH] 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 --- .../src/com/codename1/impl/android/InPlaceEditView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Ports/Android/src/com/codename1/impl/android/InPlaceEditView.java b/Ports/Android/src/com/codename1/impl/android/InPlaceEditView.java index 7fd1e47165..6c6ab7dda8 100644 --- a/Ports/Android/src/com/codename1/impl/android/InPlaceEditView.java +++ b/Ports/Android/src/com/codename1/impl/android/InPlaceEditView.java @@ -2160,6 +2160,10 @@ public boolean onKeyDown(int keyCode, KeyEvent event) { case KeyEvent.KEYCODE_MENU: endEditing(InPlaceEditView.REASON_SYSTEM_KEY, false, true, 0); break; + case KeyEvent.KEYCODE_ENTER: + if (mEditText.mTextArea != null && mEditText.mTextArea.isSingleLineTextArea()) + onEditorAction(EditorInfo.IME_ACTION_DONE); + break; case KeyEvent.KEYCODE_ESCAPE: endEditing(InPlaceEditView.REASON_IME_ACTION, false, true, EditorInfo.IME_ACTION_DONE, keyCode); break;