diff options
author | 2014-07-20 02:45:20 +0000 | |
---|---|---|
committer | 2014-07-17 17:59:02 +0000 | |
commit | 91e7daaddf72008b3e2f5a9cbc23ded56b6bdffa (patch) | |
tree | e503cc367a7c5327e7b58d2b789a7ee5ef5c66b1 /java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java | |
parent | 8279b9d4a9529448b526321ff76eff6a1c2f13f4 (diff) | |
parent | 86f36003fd4397143bd37938dda029e5707634af (diff) | |
download | latinime-91e7daaddf72008b3e2f5a9cbc23ded56b6bdffa.tar.gz latinime-91e7daaddf72008b3e2f5a9cbc23ded56b6bdffa.tar.xz latinime-91e7daaddf72008b3e2f5a9cbc23ded56b6bdffa.zip |
Merge "Use CharSequence for spell checker to keep spans preserved" into lmp-dev
Diffstat (limited to 'java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java b/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java index 13352f39e..ae582ea25 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java @@ -21,6 +21,7 @@ import android.view.textservice.SentenceSuggestionsInfo; import android.view.textservice.SuggestionsInfo; import android.view.textservice.TextInfo; +import com.android.inputmethod.compat.TextInfoCompatUtils; import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.settings.SpacingAndPunctuations; import com.android.inputmethod.latin.utils.RunInLocale; @@ -127,7 +128,8 @@ public class SentenceLevelAdapter { public SentenceTextInfoParams getSplitWords(TextInfo originalTextInfo) { final WordIterator wordIterator = mWordIterator; - final CharSequence originalText = originalTextInfo.getText(); + final CharSequence originalText = + TextInfoCompatUtils.getCharSequenceOrString(originalTextInfo); final int cookie = originalTextInfo.getCookie(); final int start = -1; final int end = originalText.length(); @@ -136,8 +138,9 @@ public class SentenceLevelAdapter { int wordEnd = wordIterator.getEndOfWord(originalText, wordStart); while (wordStart <= end && wordEnd != -1 && wordStart != -1) { if (wordEnd >= start && wordEnd > wordStart) { - final String query = originalText.subSequence(wordStart, wordEnd).toString(); - final TextInfo ti = new TextInfo(query, cookie, query.hashCode()); + CharSequence subSequence = originalText.subSequence(wordStart, wordEnd).toString(); + final TextInfo ti = TextInfoCompatUtils.newInstance(subSequence, 0, + subSequence.length(), cookie, subSequence.hashCode()); wordItems.add(new SentenceWordItem(ti, wordStart, wordEnd)); } wordStart = wordIterator.getBeginningOfNextWord(originalText, wordEnd); |