summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-12-06 10:15:56 -0800
committerGilles Debunne <debunne@google.com>2011-12-06 15:46:58 -0800
commite300be9c29b7915450ddb62f2957d312b52cfa32 (patch)
treee92cba17aaf8ba635d05ba08730f3728b200eb35 /core/java/android/inputmethodservice/InputMethodService.java
parent6db79c35c0cb4e26c6aff4a913777fd21069fd3c (diff)
IOOB is Suggestions
Bug 5555929 This problem only happens when in landscape extracted text mode. A suggestion pick from the popup window replaces the text in the ExtractedText, when it should do it in the underlying source EditText instead. When the replacement text is longer than the replaced text and is at the end of the text, an IOOB occurs because the ExtractedText was not modified (we now correctly change the source text using replaceText_internal). This is basically an implementation of the TODO comment next to setSpan in TextView. Change-Id: I6575137530e0bb5c9ac7e40cc2bba9c66dc254d2
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 02839dbe6770..53cdf2146011 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -2006,6 +2006,22 @@ public class InputMethodService extends AbstractInputMethodService {
}
/**
+ * @hide
+ */
+ public void onExtractedSetSpan(Object span, int start, int end, int flags) {
+ InputConnection conn = getCurrentInputConnection();
+ if (conn != null) {
+ if (!conn.setSelection(start, end)) return;
+ CharSequence text = conn.getSelectedText(InputConnection.GET_TEXT_WITH_STYLES);
+ if (text instanceof Spannable) {
+ ((Spannable) text).setSpan(span, 0, text.length(), flags);
+ conn.setComposingRegion(start, end);
+ conn.commitText(text, 1);
+ }
+ }
+ }
+
+ /**
* This is called when the user has clicked on the extracted text view,
* when running in fullscreen mode. The default implementation hides
* the candidates view when this happens, but only if the extracted text