summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/TextView.java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-22 00:13:42 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-22 00:13:42 -0800
commitf1e484acb594a726fb57ad0ae4cfe902c7f35858 (patch)
tree99d2b34512f0dc2ae67666e756c1cfcd331e5fe3 /core/java/android/widget/TextView.java
parent22f7dfd23490a3de2f21ff96949ba47003aac8f8 (diff)
downloadframeworks_base-f1e484acb594a726fb57ad0ae4cfe902c7f35858.zip
frameworks_base-f1e484acb594a726fb57ad0ae4cfe902c7f35858.tar.gz
frameworks_base-f1e484acb594a726fb57ad0ae4cfe902c7f35858.tar.bz2
auto import from //branches/cupcake/...@127436
Diffstat (limited to 'core/java/android/widget/TextView.java')
-rw-r--r--core/java/android/widget/TextView.java40
1 files changed, 39 insertions, 1 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 8baed7d..aa70663 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -235,6 +235,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
float[] mTmpOffset = new float[2];
ExtractedTextRequest mExtracting;
final ExtractedText mTmpExtracted = new ExtractedText();
+ boolean mBatchEditing;
}
InputMethodState mInputMethodState;
@@ -3505,7 +3506,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
*/
InputMethodManager imm = InputMethodManager.peekInstance();
- if (highlight != null && mInputMethodState != null && imm != null) {
+ if (highlight != null && mInputMethodState != null
+ && !mInputMethodState.mBatchEditing && imm != null) {
if (imm.isActive(this)) {
int candStart = -1;
int candEnd = -1;
@@ -3865,6 +3867,38 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
/**
+ * Called by the framework in response to a request to begin a batch
+ * of edit operations from the current input method, as a result of
+ * it calling {@link InputConnection#beginBatchEdit
+ * InputConnection.beginBatchEdit()}. The default implementation sets
+ * up the TextView's internal state to take care of this; if overriding
+ * you should call through to the super class.
+ */
+ public void onBeginBatchEdit() {
+ if (mInputMethodState != null) {
+ // XXX we should be smarter here, such as not doing invalidates
+ // until all edits are done.
+ mInputMethodState.mBatchEditing = true;
+ }
+ }
+
+ /**
+ * Called by the framework in response to a request to end a batch
+ * of edit operations from the current input method, as a result of
+ * it calling {@link InputConnection#endBatchEdit
+ * InputConnection.endBatchEdit()}. The default implementation sets
+ * up the TextView's internal state to take care of this; if overriding
+ * you should call through to the super class.
+ */
+ public void onEndBatchEdit() {
+ if (mInputMethodState != null) {
+ mInputMethodState.mBatchEditing = false;
+ // Cheezy way to get us to report the current cursor location.
+ invalidateCursor();
+ }
+ }
+
+ /**
* Called by the framework in response to a private command from the
* current method, provided by it calling
* {@link InputConnection#performPrivateCommand
@@ -5271,6 +5305,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (mError != null) {
hideError();
}
+ // Don't leave us in the middle of a batch edit.
+ onEndBatchEdit();
}
startStopMarquee(focused);
@@ -5300,6 +5336,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
if (mBlink != null) {
mBlink.cancel();
}
+ // Don't leave us in the middle of a batch edit.
+ onEndBatchEdit();
}
startStopMarquee(hasWindowFocus);