Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java |
| index 6333b7818c6b4a9defeaa0aebec32e9fc3e50d5c..3a65a1b8e6edc7a4c74763a2d18d591d2a5abc20 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java |
| @@ -77,7 +77,6 @@ public class AdapterInputConnection extends BaseInputConnection { |
| if (inputType == TextInputType.TEXT) { |
| // Normal text field |
| - outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; |
| if ((inputFlags & WebTextInputFlags.AutocorrectOff) == 0) { |
| outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; |
| } |
| @@ -87,13 +86,11 @@ public class AdapterInputConnection extends BaseInputConnection { |
| if ((inputFlags & WebTextInputFlags.AutocorrectOff) == 0) { |
| outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; |
| } |
| - outAttrs.imeOptions |= EditorInfo.IME_ACTION_NONE; |
| mSingleLine = false; |
| } else if (inputType == TextInputType.PASSWORD) { |
| // Password |
| outAttrs.inputType = InputType.TYPE_CLASS_TEXT |
| | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; |
| - outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; |
| } else if (inputType == TextInputType.SEARCH) { |
| // Search |
| outAttrs.imeOptions |= EditorInfo.IME_ACTION_SEARCH; |
| @@ -101,24 +98,34 @@ public class AdapterInputConnection extends BaseInputConnection { |
| // Url |
| outAttrs.inputType = InputType.TYPE_CLASS_TEXT |
| | InputType.TYPE_TEXT_VARIATION_URI; |
| - outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; |
| } else if (inputType == TextInputType.EMAIL) { |
| outAttrs.inputType = InputType.TYPE_CLASS_TEXT |
| | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; |
| - outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; |
| } else if (inputType == TextInputType.TELEPHONE) { |
| // Telephone |
| // Number and telephone do not have both a Tab key and an |
| // action in default OSK, so set the action to NEXT |
| outAttrs.inputType = InputType.TYPE_CLASS_PHONE; |
| - outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; |
| } else if (inputType == TextInputType.NUMBER) { |
| // Number |
| outAttrs.inputType = InputType.TYPE_CLASS_NUMBER |
| | InputType.TYPE_NUMBER_VARIATION_NORMAL |
| | InputType.TYPE_NUMBER_FLAG_DECIMAL; |
| + } |
| + |
| + boolean haveNextInput = false; |
| + if ((inputFlags & WebTextInputFlags.HaveNextInput) != 0) { |
| outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; |
| + haveNextInput = true; |
| + } |
| + if ((inputFlags & WebTextInputFlags.HavePreviousInput) != 0) { |
| + outAttrs.imeOptions |= EditorInfo.IME_ACTION_PREVIOUS; |
| + haveNextInput = true; |
| + } |
| + if (mSingleLine && (inputFlags & WebTextInputFlags.WantEnterEvents) == 0) { |
|
bcwhite
2015/04/14 18:22:08
Should this be || (or)?
AKV
2015/04/14 18:41:26
For textarea and content editable, which has to su
bcwhite
2015/04/14 18:56:59
Understood.
|
| + // TODO(AKV) Find an option to remove Enter Key from IME |
| + if (!haveNextInput) outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; |
|
bcwhite
2015/04/14 18:22:08
This would mean no GO button if there was a PREVIO
AKV
2015/04/14 18:41:26
Done. But I feel we need to discuss with Keyboard
bcwhite
2015/04/14 18:56:59
Do NEXT and PREVIOUS ever both appear in your curr
|
| } |
| // Handling of autocapitalize. Blink will send the flag taking into account the element's |
| @@ -281,16 +288,20 @@ public class AdapterInputConnection extends BaseInputConnection { |
| @Override |
| public boolean performEditorAction(int actionCode) { |
| if (DEBUG) Log.w(TAG, "performEditorAction [" + actionCode + "]"); |
| - if (actionCode == EditorInfo.IME_ACTION_NEXT) { |
| - restartInput(); |
| - // Send TAB key event |
| - long timeStampMs = SystemClock.uptimeMillis(); |
| - mImeAdapter.sendSyntheticKeyEvent( |
| - WebInputEventType.RawKeyDown, timeStampMs, KeyEvent.KEYCODE_TAB, 0, 0); |
| - } else { |
| - mImeAdapter.sendKeyEventWithKeyCode(KeyEvent.KEYCODE_ENTER, |
| - KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE |
| - | KeyEvent.FLAG_EDITOR_ACTION); |
| + switch (actionCode) { |
| + case EditorInfo.IME_ACTION_NEXT: |
| + restartInput(); |
| + mImeAdapter.advanceFocusToNextInputField(true); |
| + break; |
| + case EditorInfo.IME_ACTION_PREVIOUS: |
| + restartInput(); |
| + mImeAdapter.advanceFocusToNextInputField(false); |
| + break; |
| + default: |
| + mImeAdapter.sendKeyEventWithKeyCode( |
| + KeyEvent.KEYCODE_ENTER, KeyEvent.FLAG_SOFT_KEYBOARD |
| + | KeyEvent.FLAG_KEEP_TOUCH_MODE | KeyEvent.FLAG_EDITOR_ACTION); |
| + break; |
| } |
| return true; |
| } |