@@ -1105,10 +1105,6 @@ private boolean editorContains(int x, int y) {
1105
1105
return mIsEditing && mEditText != null && mEditText .mTextArea != null && mEditText .mTextArea .contains (x , y );
1106
1106
}
1107
1107
1108
- private synchronized void endEditing (int reason , boolean forceVKBOpen , int actionCode ) {
1109
- endEditing (reason , forceVKBOpen , false , actionCode );
1110
- }
1111
-
1112
1108
private Component getNextComponent (Component curr ) {
1113
1109
Form f = curr .getComponentForm ();
1114
1110
if (f != null ) {
@@ -1117,11 +1113,19 @@ private Component getNextComponent(Component curr) {
1117
1113
return null ;
1118
1114
}
1119
1115
1116
+ private synchronized void endEditing (int reason , boolean forceVKBOpen , int actionCode ) {
1117
+ endEditing (reason , forceVKBOpen , false , actionCode );
1118
+ }
1119
+
1120
+ private synchronized void endEditing (int reason , boolean forceVKBOpen , boolean forceVKBClose , int actionCode ) {
1121
+ endEditing (reason , forceVKBOpen , false , actionCode , -1 );
1122
+ }
1123
+
1120
1124
/**
1121
1125
* Finish the in-place editing of the given text area, release the edit lock, and allow the synchronous call
1122
1126
* to 'edit' to return.
1123
1127
*/
1124
- private synchronized void endEditing (int reason , boolean forceVKBOpen , boolean forceVKBClose , int actionCode ) {
1128
+ private synchronized void endEditing (int reason , boolean forceVKBOpen , boolean forceVKBClose , int actionCode , int keyEvent ) {
1125
1129
//if (cursorTimer != null) {
1126
1130
// cursorTimer.cancel();
1127
1131
//}
@@ -1167,11 +1171,9 @@ private synchronized void endEditing(int reason, boolean forceVKBOpen, boolean f
1167
1171
if (reason == REASON_IME_ACTION
1168
1172
&& ((TextArea ) mEditText .mTextArea ).getDoneListener () != null
1169
1173
&& (actionCode == EditorInfo .IME_ACTION_DONE )|| actionCode == EditorInfo .IME_ACTION_SEARCH || actionCode == EditorInfo .IME_ACTION_SEND || actionCode == EditorInfo .IME_ACTION_GO ) {
1170
- ((TextArea ) mEditText .mTextArea ).fireDoneEvent ();
1171
-
1174
+ ((TextArea ) mEditText .mTextArea ).fireDoneEvent (keyEvent );
1172
1175
}
1173
1176
1174
-
1175
1177
// Call this in onComplete instead
1176
1178
//mIsEditing = false;
1177
1179
mLastEditText = mEditText ;
@@ -2157,6 +2159,12 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
2157
2159
case KeyEvent .KEYCODE_MENU :
2158
2160
endEditing (InPlaceEditView .REASON_SYSTEM_KEY , false , true , 0 );
2159
2161
break ;
2162
+ case KeyEvent .KEYCODE_ENTER :
2163
+ onEditorAction (EditorInfo .IME_ACTION_DONE );
2164
+ break ;
2165
+ case KeyEvent .KEYCODE_ESCAPE :
2166
+ endEditing (InPlaceEditView .REASON_IME_ACTION , false , true , EditorInfo .IME_ACTION_DONE , keyCode );
2167
+ break ;
2160
2168
case KeyEvent .KEYCODE_TAB :
2161
2169
onEditorAction (EditorInfo .IME_ACTION_NEXT );
2162
2170
break ;
0 commit comments