Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java

Issue 2290133002: Make WebView keep keyboard when losing focus (Closed)
Patch Set: Add some tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
350 resetAndHideKeyboard();
349 } 351 }
350 352
351 /** 353 /**
352 * Show soft keyboard only if it is the current keyboard configuration. 354 * Show soft keyboard only if it is the current keyboard configuration.
353 */ 355 */
354 private void showSoftKeyboard() { 356 private void showSoftKeyboard() {
355 if (DEBUG_LOGS) Log.w(TAG, "showSoftKeyboard"); 357 if (DEBUG_LOGS) Log.w(TAG, "showSoftKeyboard");
356 mInputMethodManagerWrapper.showSoftInput( 358 mInputMethodManagerWrapper.showSoftInput(
357 mViewEmbedder.getAttachedView(), 0, mViewEmbedder.getNewShowKeyb oardReceiver()); 359 mViewEmbedder.getAttachedView(), 0, mViewEmbedder.getNewShowKeyb oardReceiver());
358 if (mViewEmbedder.getAttachedView().getResources().getConfiguration().ke yboard 360 if (mViewEmbedder.getAttachedView().getResources().getConfiguration().ke yboard
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 mInputConnectionFactory.onViewDetachedFromWindow(); 432 mInputConnectionFactory.onViewDetachedFromWindow();
431 } 433 }
432 } 434 }
433 435
434 /** 436 /**
435 * Call this when view's focus has changed. 437 * Call this when view's focus has changed.
436 * @param gainFocus True if we're gaining focus. 438 * @param gainFocus True if we're gaining focus.
437 */ 439 */
438 public void onViewFocusChanged(boolean gainFocus) { 440 public void onViewFocusChanged(boolean gainFocus) {
439 if (DEBUG_LOGS) Log.w(TAG, "onViewFocusChanged: gainFocus [%b]", gainFoc us); 441 if (DEBUG_LOGS) Log.w(TAG, "onViewFocusChanged: gainFocus [%b]", gainFoc us);
440 if (!gainFocus) resetAndHideKeyboard();
441 if (mInputConnectionFactory != null) { 442 if (mInputConnectionFactory != null) {
442 mInputConnectionFactory.onViewFocusChanged(gainFocus); 443 mInputConnectionFactory.onViewFocusChanged(gainFocus);
443 } 444 }
444 } 445 }
445 446
446 /** 447 /**
447 * Move cursor to the end of the current selection. 448 * Move cursor to the end of the current selection.
448 */ 449 */
449 public void moveCursorToSelectionEnd() { 450 public void moveCursorToSelectionEnd() {
450 if (DEBUG_LOGS) Log.w(TAG, "movecursorToEnd"); 451 if (DEBUG_LOGS) Log.w(TAG, "movecursorToEnd");
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 int start, int end); 776 int start, int end);
776 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i nt start, int end); 777 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i nt start, int end);
777 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , 778 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid ,
778 int before, int after); 779 int before, int after);
779 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); 780 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid);
780 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt erAndroid); 781 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt erAndroid);
781 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, 782 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid,
782 boolean immediateRequest, boolean monitorRequest); 783 boolean immediateRequest, boolean monitorRequest);
783 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid ); 784 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid );
784 } 785 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698