aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SuggestedWords.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2014-02-06 15:51:04 +0900
committerJean Chalard <jchalard@google.com>2014-02-06 16:14:41 +0900
commita49f61f8a73e64cb4db4f7ee5c0fe54fc40b367c (patch)
tree13098eb57369547a1298622960a1fb1a03305faf /java/src/com/android/inputmethod/latin/SuggestedWords.java
parent58eed6360db7f8d2ba12ab34d18656f8ec7b6116 (diff)
downloadlatinime-a49f61f8a73e64cb4db4f7ee5c0fe54fc40b367c.tar.gz
latinime-a49f61f8a73e64cb4db4f7ee5c0fe54fc40b367c.tar.xz
latinime-a49f61f8a73e64cb4db4f7ee5c0fe54fc40b367c.zip
Conditionally store the raw suggestions.
Bug: 12913520 Change-Id: Ie15f97d90c142c51089280252b35b5ad1d226e19
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index dbaf822e4..b2efc4a86 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -37,7 +37,7 @@ public final class SuggestedWords {
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST =
CollectionUtils.newArrayList(0);
public static final SuggestedWords EMPTY = new SuggestedWords(
- EMPTY_WORD_INFO_LIST, false, false, false, false, false);
+ EMPTY_WORD_INFO_LIST, null /* rawSuggestions */, false, false, false, false, false);
public final String mTypedWord;
public final boolean mTypedWordValid;
@@ -50,25 +50,29 @@ public final class SuggestedWords {
public final boolean mIsPrediction;
public final int mSequenceNumber; // Sequence number for auto-commit.
private final ArrayList<SuggestedWordInfo> mSuggestedWordInfoList;
+ public final ArrayList<SuggestedWordInfo> mRawSuggestions;
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,
+ final ArrayList<SuggestedWordInfo> rawSuggestions,
final boolean typedWordValid,
final boolean willAutoCorrect,
final boolean isPunctuationSuggestions,
final boolean isObsoleteSuggestions,
final boolean isPrediction) {
- this(suggestedWordInfoList, typedWordValid, willAutoCorrect, isPunctuationSuggestions,
- isObsoleteSuggestions, isPrediction, NOT_A_SEQUENCE_NUMBER);
+ this(suggestedWordInfoList, rawSuggestions, typedWordValid, willAutoCorrect,
+ isPunctuationSuggestions, isObsoleteSuggestions, isPrediction,
+ NOT_A_SEQUENCE_NUMBER);
}
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,
+ final ArrayList<SuggestedWordInfo> rawSuggestions,
final boolean typedWordValid,
final boolean willAutoCorrect,
final boolean isPunctuationSuggestions,
final boolean isObsoleteSuggestions,
final boolean isPrediction,
final int sequenceNumber) {
- this(suggestedWordInfoList,
+ this(suggestedWordInfoList, rawSuggestions,
suggestedWordInfoList.isEmpty() ? null
: suggestedWordInfoList.get(INDEX_OF_TYPED_WORD).mWord,
typedWordValid, willAutoCorrect, isPunctuationSuggestions,
@@ -76,6 +80,7 @@ public final class SuggestedWords {
}
public SuggestedWords(final ArrayList<SuggestedWordInfo> suggestedWordInfoList,
+ final ArrayList<SuggestedWordInfo> rawSuggestions,
final String typedWord,
final boolean typedWordValid,
final boolean willAutoCorrect,
@@ -84,6 +89,7 @@ public final class SuggestedWords {
final boolean isPrediction,
final int sequenceNumber) {
mSuggestedWordInfoList = suggestedWordInfoList;
+ mRawSuggestions = rawSuggestions;
mTypedWordValid = typedWordValid;
mWillAutoCorrect = willAutoCorrect;
mIsPunctuationSuggestions = isPunctuationSuggestions;
@@ -306,9 +312,9 @@ public final class SuggestedWords {
}
// We should never autocorrect, so we say the typed word is valid. Also, in this case,
// no auto-correction should take place hence willAutoCorrect = false.
- return new SuggestedWords(newSuggestions, typedWord, true /* typedWordValid */,
- false /* willAutoCorrect */, mIsPunctuationSuggestions, mIsObsoleteSuggestions,
- mIsPrediction, NOT_A_SEQUENCE_NUMBER);
+ return new SuggestedWords(newSuggestions, null /* rawSuggestions */, typedWord,
+ true /* typedWordValid */, false /* willAutoCorrect */, mIsPunctuationSuggestions,
+ mIsObsoleteSuggestions, mIsPrediction, NOT_A_SEQUENCE_NUMBER);
}
// Creates a new SuggestedWordInfo from the currently suggested words that removes all but the
@@ -326,7 +332,7 @@ public final class SuggestedWords {
info.mSourceDict, SuggestedWordInfo.NOT_AN_INDEX,
SuggestedWordInfo.NOT_A_CONFIDENCE));
}
- return new SuggestedWords(newSuggestions, mTypedWordValid,
+ return new SuggestedWords(newSuggestions, null /* rawSuggestions */, mTypedWordValid,
mWillAutoCorrect, mIsPunctuationSuggestions, mIsObsoleteSuggestions,
mIsPrediction);
}