| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser.input; | 5 package org.chromium.content.browser.input; |
| 6 | 6 |
| 7 import android.os.SystemClock; | 7 import android.os.SystemClock; |
| 8 import android.text.Editable; | 8 import android.text.Editable; |
| 9 import android.text.InputType; | 9 import android.text.InputType; |
| 10 import android.text.Selection; | 10 import android.text.Selection; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 if (actionCode == EditorInfo.IME_ACTION_NEXT) { | 219 if (actionCode == EditorInfo.IME_ACTION_NEXT) { |
| 220 restartInput(); | 220 restartInput(); |
| 221 // Send TAB key event | 221 // Send TAB key event |
| 222 long timeStampMs = SystemClock.uptimeMillis(); | 222 long timeStampMs = SystemClock.uptimeMillis(); |
| 223 mImeAdapter.sendSyntheticKeyEvent( | 223 mImeAdapter.sendSyntheticKeyEvent( |
| 224 ImeAdapter.sEventTypeRawKeyDown, timeStampMs, KeyEvent.KEYCO
DE_TAB, 0); | 224 ImeAdapter.sEventTypeRawKeyDown, timeStampMs, KeyEvent.KEYCO
DE_TAB, 0); |
| 225 } else { | 225 } else { |
| 226 mImeAdapter.sendKeyEventWithKeyCode(KeyEvent.KEYCODE_ENTER, | 226 mImeAdapter.sendKeyEventWithKeyCode(KeyEvent.KEYCODE_ENTER, |
| 227 KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE | 227 KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE |
| 228 | KeyEvent.FLAG_EDITOR_ACTION); | 228 | KeyEvent.FLAG_EDITOR_ACTION); |
| 229 | |
| 230 if ((actionCode == EditorInfo.IME_ACTION_GO || actionCode == EditorI
nfo.IME_ACTION_DONE | |
| 231 || actionCode == EditorInfo.IME_ACTION_SEARCH) && isActive()
) { | |
| 232 // User is done typing, hide the keyboard. | |
| 233 InputMethodManagerWrapper wrapper = getInputMethodManagerWrapper
(); | |
| 234 wrapper.hideSoftInputFromWindow(mInternalView.getWindowToken(),
0, null); | |
| 235 } | |
| 236 } | 229 } |
| 237 return true; | 230 return true; |
| 238 } | 231 } |
| 239 | 232 |
| 240 /** | 233 /** |
| 241 * @see BaseInputConnection#performContextMenuAction(int) | 234 * @see BaseInputConnection#performContextMenuAction(int) |
| 242 */ | 235 */ |
| 243 @Override | 236 @Override |
| 244 public boolean performContextMenuAction(int id) { | 237 public boolean performContextMenuAction(int id) { |
| 245 if (DEBUG) Log.w(TAG, "performContextMenuAction [" + id + "]"); | 238 if (DEBUG) Log.w(TAG, "performContextMenuAction [" + id + "]"); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 ImeState getImeStateForTesting() { | 452 ImeState getImeStateForTesting() { |
| 460 Editable editable = getEditable(); | 453 Editable editable = getEditable(); |
| 461 String text = editable.toString(); | 454 String text = editable.toString(); |
| 462 int selectionStart = Selection.getSelectionStart(editable); | 455 int selectionStart = Selection.getSelectionStart(editable); |
| 463 int selectionEnd = Selection.getSelectionEnd(editable); | 456 int selectionEnd = Selection.getSelectionEnd(editable); |
| 464 int compositionStart = getComposingSpanStart(editable); | 457 int compositionStart = getComposingSpanStart(editable); |
| 465 int compositionEnd = getComposingSpanEnd(editable); | 458 int compositionEnd = getComposingSpanEnd(editable); |
| 466 return new ImeState(text, selectionStart, selectionEnd, compositionStart
, compositionEnd); | 459 return new ImeState(text, selectionStart, selectionEnd, compositionStart
, compositionEnd); |
| 467 } | 460 } |
| 468 } | 461 } |
| OLD | NEW |