diff options
author | Leon Scroggins <scroggo@google.com> | 2009-10-23 11:49:03 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-10-23 11:49:03 -0400 |
commit | 1d96ca06d83ef87544a7053ab6c19b3b8233ae4b (patch) | |
tree | 5961ae7c8709330dfd9da689f287320ee468c2ba /core/java | |
parent | 1d60c5c16b92ddc64d10f13da8af7faaae22cd2f (diff) | |
download | frameworks_base-1d96ca06d83ef87544a7053ab6c19b3b8233ae4b.zip frameworks_base-1d96ca06d83ef87544a7053ab6c19b3b8233ae4b.tar.gz frameworks_base-1d96ca06d83ef87544a7053ab6c19b3b8233ae4b.tar.bz2 |
Show the soft keyboard when pressing center key/trackball on input field
Fixes http://b/issue?id=2210234
Consolidate center key/trackball presses on input fields, and show
soft keyboard if the field is not readonly. Also rename the method
for a center press, and pass a click rather than a touch. Requires
a change in external/webkit.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/webkit/WebTextView.java | 2 | ||||
-rw-r--r-- | core/java/android/webkit/WebView.java | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index db117f7..4fafb65 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -188,7 +188,7 @@ import java.util.ArrayList; } // Center key should be passed to a potential onClick if (!down) { - mWebView.shortPressOnTextField(); + mWebView.centerKeyPressOnTextField(); } // Pass to super to handle longpress. return super.dispatchKeyEvent(event); diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index c657765..fabaf8c 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2834,10 +2834,7 @@ public class WebView extends AbsoluteLayout public boolean performLongClick() { if (mNativeClass != 0 && nativeCursorIsTextInput()) { // Send the click so that the textfield is in focus - // FIXME: When we start respecting changes to the native textfield's - // selection, need to make sure that this does not change it. - mWebViewCore.sendMessage(EventHub.CLICK, nativeCursorFramePointer(), - nativeCursorNodePointer()); + centerKeyPressOnTextField(); rebuildWebTextView(); } if (inEditingMode()) { @@ -3474,6 +3471,7 @@ public class WebView extends AbsoluteLayout playSoundEffect(SoundEffectConstants.CLICK); if (nativeCursorIsTextInput()) { rebuildWebTextView(); + centerKeyPressOnTextField(); return true; } nativeSetFollowedLink(true); @@ -4707,12 +4705,15 @@ public class WebView extends AbsoluteLayout nativeTextInputMotionUp(x, y); } - /*package*/ void shortPressOnTextField() { - if (inEditingMode()) { - View v = mWebTextView; - int x = viewToContentX((v.getLeft() + v.getRight()) >> 1); - int y = viewToContentY((v.getTop() + v.getBottom()) >> 1); - nativeTextInputMotionUp(x, y); + /** + * Called when pressing the center key or trackball on a textfield. + */ + /*package*/ void centerKeyPressOnTextField() { + mWebViewCore.sendMessage(EventHub.CLICK, nativeCursorFramePointer(), + nativeCursorNodePointer()); + // Need to show the soft keyboard if it's not readonly. + if (!nativeCursorIsReadOnly()) { + displaySoftKeyboard(true); } } @@ -5789,6 +5790,7 @@ 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(); |