diff options
author | 2014-07-20 00:27:27 +0900 | |
---|---|---|
committer | 2014-07-20 02:16:11 +0000 | |
commit | 86f36003fd4397143bd37938dda029e5707634af (patch) | |
tree | 44464146de8c5fd1af2074feffb6366a2eacdc33 /java/src/com/android/inputmethod/latin/PrevWordsInfo.java | |
parent | 22ba22f32dc9d59a0dccc8d1bca7aaee90e90b2a (diff) | |
download | latinime-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/PrevWordsInfo.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/PrevWordsInfo.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/java/src/com/android/inputmethod/latin/PrevWordsInfo.java b/java/src/com/android/inputmethod/latin/PrevWordsInfo.java index f45c73f53..db877ab7a 100644 --- a/java/src/com/android/inputmethod/latin/PrevWordsInfo.java +++ b/java/src/com/android/inputmethod/latin/PrevWordsInfo.java @@ -16,10 +16,12 @@ package com.android.inputmethod.latin; -import java.util.Arrays; +import android.text.TextUtils; import com.android.inputmethod.latin.utils.StringUtils; +import java.util.Arrays; + /** * Class to represent information of previous words. This class is used to add n-gram entries * into binary dictionaries, to get predictions, and to get suggestions. @@ -37,8 +39,8 @@ public class PrevWordsInfo { public static final WordInfo EMPTY_WORD_INFO = new WordInfo(null); public static final WordInfo BEGINNING_OF_SENTENCE = new WordInfo(); - // This is an empty string when mIsBeginningOfSentence is true. - public final String mWord; + // This is an empty char sequence when mIsBeginningOfSentence is true. + public final CharSequence mWord; // TODO: Have sentence separator. // Whether the current context is beginning of sentence or not. This is true when composing // at the beginning of an input field or composing a word after a sentence separator. @@ -50,7 +52,7 @@ public class PrevWordsInfo { mIsBeginningOfSentence = true; } - public WordInfo(final String word) { + public WordInfo(final CharSequence word) { mWord = word; mIsBeginningOfSentence = false; } @@ -73,7 +75,7 @@ public class PrevWordsInfo { return mWord == wordInfo.mWord && mIsBeginningOfSentence == wordInfo.mIsBeginningOfSentence; } - return mWord.equals(wordInfo.mWord) + return TextUtils.equals(mWord, wordInfo.mWord) && mIsBeginningOfSentence == wordInfo.mIsBeginningOfSentence; } } |