summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorsatok <satok@google.com>2012-04-26 08:12:31 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-26 08:12:31 -0700
commit9b593a67f1e93896af4ef1050e485fb84bd5dd4f (patch)
tree7047b22ef6d7f241e148c7dfcae834de1ae0b32c /core/java/android
parente9e260fbc0892885790eeccb4d803f7d81f261aa (diff)
parent24d146b966c87fd9c3b48027cbfb4238cb892ca5 (diff)
downloadframeworks_base-9b593a67f1e93896af4ef1050e485fb84bd5dd4f.zip
frameworks_base-9b593a67f1e93896af4ef1050e485fb84bd5dd4f.tar.gz
frameworks_base-9b593a67f1e93896af4ef1050e485fb84bd5dd4f.tar.bz2
Merge "Fix the boundary of the sentence level spell check" into jb-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/SpellChecker.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java
index a91b16e..98e45fb 100644
--- a/core/java/android/widget/SpellChecker.java
+++ b/core/java/android/widget/SpellChecker.java
@@ -457,7 +457,16 @@ public class SpellChecker implements SpellCheckerSessionListener {
public void parse() {
Editable editable = (Editable) mTextView.getText();
// Iterate over the newly added text and schedule new SpellCheckSpans
- final int start = editable.getSpanStart(mRange);
+ final int start;
+ if (mIsSentenceSpellCheckSupported) {
+ // TODO: Find the start position of the sentence.
+ // Set span with the context
+ start = Math.max(
+ 0, editable.getSpanStart(mRange) - MIN_SENTENCE_LENGTH);
+ } else {
+ start = editable.getSpanStart(mRange);
+ }
+
final int end = editable.getSpanEnd(mRange);
int wordIteratorWindowEnd = Math.min(end, start + WORD_ITERATOR_INTERVAL);
@@ -512,9 +521,7 @@ public class SpellChecker implements SpellCheckerSessionListener {
return;
}
// TODO: Find the start position of the sentence.
- // Set span with the context
- final int spellCheckStart = Math.max(
- 0, Math.min(wordStart, regionEnd - MIN_SENTENCE_LENGTH));
+ final int spellCheckStart = wordStart;
if (regionEnd <= spellCheckStart) {
return;
}