summaryrefslogtreecommitdiff
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-04-24 11:27:32 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-24 11:27:32 -0700
commit0b7d747e900dd9e6e6f62f10772c2dded9b9d0c6 (patch)
tree9460ede938f79cbf4c1a087ef1b2da38dd25b023 /core/java/android/widget/TextView.java
parentdb41553eafab653199cef87bc2101314210ea41f (diff)
parentc62589cbecef6e748bcc6c6f4ea6a8ff7656923f (diff)
Merge "Editor uses a SpanWatcher to track EasyEditSpans"
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java19
1 files changed, 8 insertions, 11 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index f45297336be0..eba580d32c52 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3200,22 +3200,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (text instanceof Spannable && !mAllowTransformationLengthChange) {
Spannable sp = (Spannable) text;
- // Remove any ChangeWatchers that might have come
- // from other TextViews.
+ // Remove any ChangeWatchers that might have come from other TextViews.
final ChangeWatcher[] watchers = sp.getSpans(0, sp.length(), ChangeWatcher.class);
final int count = watchers.length;
- for (int i = 0; i < count; i++)
+ for (int i = 0; i < count; i++) {
sp.removeSpan(watchers[i]);
+ }
- if (mChangeWatcher == null)
- mChangeWatcher = new ChangeWatcher();
+ if (mChangeWatcher == null) mChangeWatcher = new ChangeWatcher();
sp.setSpan(mChangeWatcher, 0, textLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE |
(CHANGE_WATCHER_PRIORITY << Spanned.SPAN_PRIORITY_SHIFT));
- if (mEditor != null && getEditor().mKeyListener != null) {
- sp.setSpan(getEditor().mKeyListener, 0, textLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
- }
+ if (mEditor != null) mEditor.addSpanWatchers(sp);
if (mTransformation != null) {
sp.setSpan(mTransformation, 0, textLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
@@ -5208,7 +5205,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*/
public void setExtracting(ExtractedTextRequest req) {
if (getEditor().mInputMethodState != null) {
- getEditor().mInputMethodState.mExtracting = req;
+ getEditor().mInputMethodState.mExtractedTextRequest = req;
}
// This would stop a possible selection mode, but no such mode is started in case
// extracted mode will start. Some text is selected though, and will trigger an action mode
@@ -6856,7 +6853,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (what instanceof ParcelableSpan) {
// If this is a span that can be sent to a remote process,
// the current extract editor would be interested in it.
- if (ims != null && ims.mExtracting != null) {
+ if (ims != null && ims.mExtractedTextRequest != null) {
if (ims.mBatchEditNesting != 0) {
if (oldStart >= 0) {
if (ims.mChangedStart > oldStart) {
@@ -6877,7 +6874,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} else {
if (DEBUG_EXTRACT) Log.v(LOG_TAG, "Span change outside of batch: "
+ oldStart + "-" + oldEnd + ","
- + newStart + "-" + newEnd + what);
+ + newStart + "-" + newEnd + " " + what);
ims.mContentChanged = true;
}
}