Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.content.res.Configuration; | 7 import android.content.res.Configuration; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.ResultReceiver; | 9 import android.os.ResultReceiver; |
| 10 import android.os.SystemClock; | 10 import android.os.SystemClock; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 if (mNativeImeAdapterAndroid != 0) { | 339 if (mNativeImeAdapterAndroid != 0) { |
| 340 nativeResetImeAdapter(mNativeImeAdapterAndroid); | 340 nativeResetImeAdapter(mNativeImeAdapterAndroid); |
| 341 } | 341 } |
| 342 if (nativeImeAdapter != 0) { | 342 if (nativeImeAdapter != 0) { |
| 343 nativeAttachImeAdapter(nativeImeAdapter); | 343 nativeAttachImeAdapter(nativeImeAdapter); |
| 344 } | 344 } |
| 345 mNativeImeAdapterAndroid = nativeImeAdapter; | 345 mNativeImeAdapterAndroid = nativeImeAdapter; |
| 346 if (nativeImeAdapter != 0) { | 346 if (nativeImeAdapter != 0) { |
| 347 createInputConnectionFactory(); | 347 createInputConnectionFactory(); |
| 348 } | 348 } |
| 349 resetAndHideKeyboard(); | |
|
yabinh
2016/08/30 06:32:10
For navigation.
| |
| 349 } | 350 } |
| 350 | 351 |
| 351 /** | 352 /** |
| 352 * Show soft keyboard only if it is the current keyboard configuration. | 353 * Show soft keyboard only if it is the current keyboard configuration. |
| 353 */ | 354 */ |
| 354 private void showSoftKeyboard() { | 355 private void showSoftKeyboard() { |
| 355 if (DEBUG_LOGS) Log.w(TAG, "showSoftKeyboard"); | 356 if (DEBUG_LOGS) Log.w(TAG, "showSoftKeyboard"); |
| 356 mInputMethodManagerWrapper.showSoftInput( | 357 mInputMethodManagerWrapper.showSoftInput( |
| 357 mViewEmbedder.getAttachedView(), 0, mViewEmbedder.getNewShowKeyb oardReceiver()); | 358 mViewEmbedder.getAttachedView(), 0, mViewEmbedder.getNewShowKeyb oardReceiver()); |
| 358 if (mViewEmbedder.getAttachedView().getResources().getConfiguration().ke yboard | 359 if (mViewEmbedder.getAttachedView().getResources().getConfiguration().ke yboard |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 mInputConnectionFactory.onViewDetachedFromWindow(); | 431 mInputConnectionFactory.onViewDetachedFromWindow(); |
| 431 } | 432 } |
| 432 } | 433 } |
| 433 | 434 |
| 434 /** | 435 /** |
| 435 * Call this when view's focus has changed. | 436 * Call this when view's focus has changed. |
| 436 * @param gainFocus True if we're gaining focus. | 437 * @param gainFocus True if we're gaining focus. |
| 437 */ | 438 */ |
| 438 public void onViewFocusChanged(boolean gainFocus) { | 439 public void onViewFocusChanged(boolean gainFocus) { |
| 439 if (DEBUG_LOGS) Log.w(TAG, "onViewFocusChanged: gainFocus [%b]", gainFoc us); | 440 if (DEBUG_LOGS) Log.w(TAG, "onViewFocusChanged: gainFocus [%b]", gainFoc us); |
| 440 if (!gainFocus) resetAndHideKeyboard(); | |
| 441 if (mInputConnectionFactory != null) { | 441 if (mInputConnectionFactory != null) { |
| 442 mInputConnectionFactory.onViewFocusChanged(gainFocus); | 442 mInputConnectionFactory.onViewFocusChanged(gainFocus); |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 | 445 |
| 446 /** | 446 /** |
| 447 * Move cursor to the end of the current selection. | 447 * Move cursor to the end of the current selection. |
| 448 */ | 448 */ |
| 449 public void moveCursorToSelectionEnd() { | 449 public void moveCursorToSelectionEnd() { |
| 450 if (DEBUG_LOGS) Log.w(TAG, "movecursorToEnd"); | 450 if (DEBUG_LOGS) Log.w(TAG, "movecursorToEnd"); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 775 int start, int end); | 775 int start, int end); |
| 776 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i nt start, int end); | 776 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i nt start, int end); |
| 777 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , | 777 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , |
| 778 int before, int after); | 778 int before, int after); |
| 779 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 779 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
| 780 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt erAndroid); | 780 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt erAndroid); |
| 781 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, | 781 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, |
| 782 boolean immediateRequest, boolean monitorRequest); | 782 boolean immediateRequest, boolean monitorRequest); |
| 783 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid ); | 783 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid ); |
| 784 } | 784 } |
| OLD | NEW |