summaryrefslogtreecommitdiffstats
path: root/core/java/android/text/method
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-10-13 12:15:10 -0700
committerGilles Debunne <debunne@google.com>2011-10-13 16:52:42 -0700
commit9d8d3f1539ce5bdf512bd47ec1648609d6cde5b1 (patch)
treeca73fe0be0a60d1eff8084ec3b919fdec2abf2fc /core/java/android/text/method
parentb10d396f2e1d0329013f5376bd486621bd177bc8 (diff)
downloadframeworks_base-9d8d3f1539ce5bdf512bd47ec1648609d6cde5b1.zip
frameworks_base-9d8d3f1539ce5bdf512bd47ec1648609d6cde5b1.tar.gz
frameworks_base-9d8d3f1539ce5bdf512bd47ec1648609d6cde5b1.tar.bz2
Spell checher's language synced with keyboard.
Bug 5379440. The spell check is now using the IME's language to do the spell checking. Changing the input language triggers a new spell check of the entire text. Optimizations: ArrowKeyMovementMethod re-uses the TextView's wordIterator, already set to the correct language. One wordIterator shared by all SpellParsers in SpellChecker. Cannot re-use TextView's because of concurrency issues. With the current implementation, one has to type a new character to see the new spell checking take place. Change-Id: I0e460c0a6777548f89d03d6b68f3deea6606c17f
Diffstat (limited to 'core/java/android/text/method')
-rw-r--r--core/java/android/text/method/ArrowKeyMovementMethod.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/android/text/method/ArrowKeyMovementMethod.java b/core/java/android/text/method/ArrowKeyMovementMethod.java
index e93039b..4ec4bc4 100644
--- a/core/java/android/text/method/ArrowKeyMovementMethod.java
+++ b/core/java/android/text/method/ArrowKeyMovementMethod.java
@@ -197,16 +197,18 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme
@Override
protected boolean leftWord(TextView widget, Spannable buffer) {
final int selectionEnd = widget.getSelectionEnd();
- mWordIterator.setCharSequence(buffer, selectionEnd, selectionEnd);
- return Selection.moveToPreceding(buffer, mWordIterator, isSelecting(buffer));
+ final WordIterator wordIterator = widget.getWordIterator();
+ wordIterator.setCharSequence(buffer, selectionEnd, selectionEnd);
+ return Selection.moveToPreceding(buffer, wordIterator, isSelecting(buffer));
}
/** {@hide} */
@Override
protected boolean rightWord(TextView widget, Spannable buffer) {
final int selectionEnd = widget.getSelectionEnd();
- mWordIterator.setCharSequence(buffer, selectionEnd, selectionEnd);
- return Selection.moveToFollowing(buffer, mWordIterator, isSelecting(buffer));
+ final WordIterator wordIterator = widget.getWordIterator();
+ wordIterator.setCharSequence(buffer, selectionEnd, selectionEnd);
+ return Selection.moveToFollowing(buffer, wordIterator, isSelecting(buffer));
}
@Override
@@ -322,8 +324,6 @@ public class ArrowKeyMovementMethod extends BaseMovementMethod implements Moveme
return sInstance;
}
- private WordIterator mWordIterator = new WordIterator();
-
private static final Object LAST_TAP_DOWN = new Object();
private static ArrowKeyMovementMethod sInstance;
}