summaryrefslogtreecommitdiffstats
path: root/core/java/android/webkit/WebTextView.java
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-09-16 18:26:17 -0400
committerLeon Scroggins <scroggo@google.com>2009-09-16 18:32:52 -0400
commit241403fd19edc44d089f3860db1562ed523dea07 (patch)
treea9757979bbabc71ab30c9386f624b446ef14cd11 /core/java/android/webkit/WebTextView.java
parent44ca7090aca79b8c8e71d34982ae54b69968ad56 (diff)
downloadframeworks_base-241403fd19edc44d089f3860db1562ed523dea07.zip
frameworks_base-241403fd19edc44d089f3860db1562ed523dea07.tar.gz
frameworks_base-241403fd19edc44d089f3860db1562ed523dea07.tar.bz2
Update the input method when the selection changes.
Fix http://b/issue?id=2074446 Add in code that is normally called by TextView.onDraw(). Since drawing does not happen for WebTextView, we need to call it ourselves. Change-Id: Icb47f6a58fba6f8b11e2924befc704f26af68d43
Diffstat (limited to 'core/java/android/webkit/WebTextView.java')
-rw-r--r--core/java/android/webkit/WebTextView.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index a175be0..39a2470 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -16,6 +16,8 @@
package android.webkit;
+import com.android.internal.widget.EditableInputConnection;
+
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -347,6 +349,16 @@ import java.util.ArrayList;
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
+ // This code is copied from TextView.onDraw(). That code does not get
+ // executed, however, because the WebTextView does not draw, allowing
+ // webkit's drawing to show through.
+ InputMethodManager imm = InputMethodManager.peekInstance();
+ if (imm != null && imm.isActive(this)) {
+ Spannable sp = (Spannable) getText();
+ int candStart = EditableInputConnection.getComposingSpanStart(sp);
+ int candEnd = EditableInputConnection.getComposingSpanEnd(sp);
+ imm.updateSelection(this, selStart, selEnd, candStart, candEnd);
+ }
if (!mFromWebKit && mWebView != null) {
if (DebugFlags.WEB_TEXT_VIEW) {
Log.v(LOGTAG, "onSelectionChanged selStart=" + selStart