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..41904b74293a03b9d77d3595fff9d4180000d998 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,25 +98,31 @@ 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; |
+ } |
+ |
+ if (mSingleLine && (inputFlags & WebTextInputFlags.WantEnterEvents) == 0) { |
+ // TODO(AKV) Find an option to remove Enter Key from IME |
+ } |
+ if ((inputFlags & WebTextInputFlags.HaveNextInput) != 0) { |
outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; |
} |
+ if ((inputFlags & WebTextInputFlags.HavePreviousInput) != 0) { |
+ outAttrs.imeOptions |= EditorInfo.IME_ACTION_PREVIOUS; |
+ } |
bcwhite
2015/04/13 16:51:34
I don't see any way to show the GO button. Should
AKV
2015/04/13 18:35:46
Mostly this use case can happen when the element i
bcwhite
2015/04/13 18:56:49
The existing functionality is to show GO so we nee
|
// Handling of autocapitalize. Blink will send the flag taking into account the element's |
// type. This is not using AutocapitalizeNone because Android does not autocapitalize by |
@@ -281,16 +284,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; |
} |