aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SuggestedWords.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2012-03-13 00:26:06 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-13 00:26:06 -0700
commit95fcb0cce939fa730d90ed975f65bfaa1ffbfbcb (patch)
tree2e4c1e74f453eb168ee25a6768481a6eb81481b6 /java/src/com/android/inputmethod/latin/SuggestedWords.java
parentdabf96896ef4c304c6dad36b307a2a458a58209d (diff)
parentd0d4074392a844602d068b17733fe16b1af94d86 (diff)
downloadlatinime-95fcb0cce939fa730d90ed975f65bfaa1ffbfbcb.tar.gz
latinime-95fcb0cce939fa730d90ed975f65bfaa1ffbfbcb.tar.xz
latinime-95fcb0cce939fa730d90ed975f65bfaa1ffbfbcb.zip
Merge "Remove a useless parameter."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SuggestedWords.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SuggestedWords.java37
1 files changed, 22 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java
index 9959292cb..7dd85f65b 100644
--- a/java/src/com/android/inputmethod/latin/SuggestedWords.java
+++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java
@@ -87,19 +87,17 @@ public class SuggestedWords {
// Nothing to do here.
}
- public Builder addWords(List<CharSequence> words,
- List<SuggestedWordInfo> suggestedWordInfoList) {
- final int N = words.size();
+ // TODO: the following method is a wrapper to satisfy tests. Update tests and remove it.
+ public Builder addWords(final List<CharSequence> words,
+ final List<SuggestedWordInfo> suggestedWordInfoList) {
+ return addWords(suggestedWordInfoList);
+ }
+
+ public Builder addWords(List<SuggestedWordInfo> suggestedWordInfoList) {
+ final int N = suggestedWordInfoList.size();
for (int i = 0; i < N; ++i) {
- final CharSequence word = words.get(i);
- SuggestedWordInfo suggestedWordInfo = null;
- if (suggestedWordInfoList != null) {
- suggestedWordInfo = suggestedWordInfoList.get(i);
- }
- if (suggestedWordInfo == null) {
- suggestedWordInfo = new SuggestedWordInfo(word);
- }
- addWord(word, suggestedWordInfo);
+ SuggestedWordInfo suggestedWordInfo = suggestedWordInfoList.get(i);
+ addWord(suggestedWordInfo.mWord, suggestedWordInfo);
}
return this;
}
@@ -113,11 +111,20 @@ public class SuggestedWords {
return this;
}
- public static List<CharSequence> getFromApplicationSpecifiedCompletions(
+ public static List<SuggestedWordInfo> getFromCharSequenceList(
+ final List<CharSequence> wordList) {
+ final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>();
+ for (CharSequence word : wordList) {
+ if (null != word) result.add(new SuggestedWordInfo(word, null, false));
+ }
+ return result;
+ }
+
+ public static List<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
final CompletionInfo[] infos) {
- final ArrayList<CharSequence> result = new ArrayList<CharSequence>();
+ final ArrayList<SuggestedWordInfo> result = new ArrayList<SuggestedWordInfo>();
for (CompletionInfo info : infos) {
- if (null != info) result.add(info.getText());
+ if (null != info) result.add(new SuggestedWordInfo(info.getText(), null, false));
}
return result;
}