summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/SpellChecker.java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2012-04-12 14:50:23 -0700
committerGilles Debunne <debunne@google.com>2012-04-23 18:25:25 -0700
commitc62589cbecef6e748bcc6c6f4ea6a8ff7656923f (patch)
treedb06a9dcccc55d78ab361a43a3f30caf4938560a /core/java/android/widget/SpellChecker.java
parente267f5f2b0f2059fac3b62e5cc09d46b65fdf200 (diff)
downloadframeworks_base-c62589cbecef6e748bcc6c6f4ea6a8ff7656923f.zip
frameworks_base-c62589cbecef6e748bcc6c6f4ea6a8ff7656923f.tar.gz
frameworks_base-c62589cbecef6e748bcc6c6f4ea6a8ff7656923f.tar.bz2
Editor uses a SpanWatcher to track EasyEditSpans
Will also fix Bug 6344997 The previous TextWatcher mechanism was inneficient. It require an expensive getSpans() call to retrieve all the spans and then search for the one we're interested in in case it has been changed. The SpanWatcher is faster, it will broadcast the add/changed/removed events we're interested in. Now that we can rely on SpanWatcher, use it to directly track addition and removals of EasyEditSpans. No unit test for this feature which require an integration with the voice IME. Easy to test manually though. Change-Id: Idabcacc48c479bf9868d5204c0b0ca709207ede2
Diffstat (limited to 'core/java/android/widget/SpellChecker.java')
-rw-r--r--core/java/android/widget/SpellChecker.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index c725b64..f033072 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -207,6 +207,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
public void spellCheck(int start, int end) {
final Locale locale = mTextView.getTextServicesLocale();
+ final boolean isSessionActive = isSessionActive();
if (mCurrentLocale == null || (!(mCurrentLocale.equals(locale)))) {
setLocale(locale);
// Re-check the entire text
@@ -214,13 +215,13 @@ public class SpellChecker implements SpellCheckerSessionListener {
end = mTextView.getText().length();
} else {
final boolean spellCheckerActivated = mTextServicesManager.isSpellCheckerEnabled();
- if (isSessionActive() != spellCheckerActivated) {
+ if (isSessionActive != spellCheckerActivated) {
// Spell checker has been turned of or off since last spellCheck
resetSession();
}
}
- if (!isSessionActive()) return;
+ if (!isSessionActive) return;
// Find first available SpellParser from pool
final int length = mSpellParsers.length;