From 04e0a1018f69b38827e63a7f19a4d1e341f9725a Mon Sep 17 00:00:00 2001 From: Leon Scroggins Date: Fri, 8 Jan 2010 16:19:27 -0500 Subject: [PATCH] Bring up IME after receiving a response from webkit. Fix for http://b/issue?id=2361658 Requires a change to external/webkit --- core/java/android/webkit/WebView.java | 16 +++++++--------- core/java/android/webkit/WebViewCore.java | 5 +++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 7960322a1761..6368dac66759 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -3193,14 +3193,17 @@ public class WebView extends AbsoluteLayout mWebViewCore.sendMessage(EventHub.SET_SELECTION, start, end); } - // Called by JNI when a touch event puts a textfield into focus. + /** + * Called in response to a message from webkit telling us that the soft + * keyboard should be launched. + */ private void displaySoftKeyboard(boolean isTextView) { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (isTextView) { - if (mWebTextView == null) return; - + rebuildWebTextView(); + if (!inEditingMode()) return; imm.showSoftInput(mWebTextView, 0); if (mInZoomOverview) { // if in zoom overview mode, call doDoubleTap() to bring it back @@ -5099,10 +5102,6 @@ public class WebView extends AbsoluteLayout /*package*/ void centerKeyPressOnTextField() { mWebViewCore.sendMessage(EventHub.CLICK, nativeCursorFramePointer(), nativeCursorNodePointer()); - // Need to show the soft keyboard if it's not readonly. - if (!nativeCursorIsReadOnly()) { - displaySoftKeyboard(true); - } } private void doShortPress() { @@ -5743,7 +5742,7 @@ public class WebView extends AbsoluteLayout if (msg.arg1 == 0) { hideSoftKeyboard(); } else { - displaySoftKeyboard(false); + displaySoftKeyboard(1 == msg.arg2); } break; @@ -6346,7 +6345,6 @@ public class WebView extends AbsoluteLayout /* package */ native boolean nativeCursorMatchesFocus(); private native boolean nativeCursorIntersects(Rect visibleRect); private native boolean nativeCursorIsAnchor(); - private native boolean nativeCursorIsReadOnly(); private native boolean nativeCursorIsTextInput(); private native Point nativeCursorPosition(); private native String nativeCursorText(); diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index 1ef37e67bd37..38cb88337e19 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -2245,10 +2245,11 @@ final class WebViewCore { } // called by JNI - private void requestKeyboard(boolean showKeyboard) { + private void requestKeyboard(boolean showKeyboard, boolean isTextView) { if (mWebView != null) { Message.obtain(mWebView.mPrivateHandler, - WebView.REQUEST_KEYBOARD, showKeyboard ? 1 : 0, 0) + WebView.REQUEST_KEYBOARD, showKeyboard ? 1 : 0, + isTextView ? 1 : 0) .sendToTarget(); } } -- 2.11.0