aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-07-20 00:27:27 +0900
committerYohei Yukawa <yukawa@google.com>2014-07-20 02:16:11 +0000
commit86f36003fd4397143bd37938dda029e5707634af (patch)
tree44464146de8c5fd1af2074feffb6366a2eacdc33 /java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java
parent22ba22f32dc9d59a0dccc8d1bca7aaee90e90b2a (diff)
downloadlatinime-86f36003fd4397143bd37938dda029e5707634af.tar.gz
latinime-86f36003fd4397143bd37938dda029e5707634af.tar.xz
latinime-86f36003fd4397143bd37938dda029e5707634af.zip
Use CharSequence for spell checker to keep spans preserved
This is a ground work to take per word locale information into consideration in the spell checker. This CL is supposed to change no user visible behavior. With this CL, the spell checker session is able to read span information if necessary. BUG: 16029304 Change-Id: Icb1e1ecdf40fe0445e14565b685b1b878b746210
Diffstat (limited to 'java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java')
-rw-r--r--java/src/com/android/inputmethod/latin/spellcheck/SentenceLevelAdapter.java9
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);