From def4551c2a570e7f575b2e9303506d790c2f335f Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Wed, 14 Mar 2012 18:33:57 +0900 Subject: [PATCH] Some code simplification Just write the same thing in a more succint manner Change-Id: I08a2c5edd52a3502914541061fd5b6ee7a92ebc4 --- java/src/com/android/inputmethod/latin/Suggest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 3089625e7..16dd75610 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -22,6 +22,7 @@ import android.util.Log; import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.ProximityInfo; +import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import java.io.File; import java.util.ArrayList; @@ -392,15 +393,15 @@ public class Suggest implements Dictionary.WordCallback { mSuggestions.add(0, typedWord); StringUtils.removeDupes(mSuggestions); - final ArrayList suggestionsList; + final ArrayList suggestionsList; if (DBG) { // TODO: this doesn't take into account the fact that removing dupes from mSuggestions // may have made mScores[] and mSuggestions out of sync. final CharSequence autoCorrectionSuggestion = mSuggestions.get(0); double normalizedScore = BinaryDictionary.calcNormalizedScore( typedWord, autoCorrectionSuggestion.toString(), mScores[0]); - suggestionsList = new ArrayList(); - suggestionsList.add(new SuggestedWords.SuggestedWordInfo(autoCorrectionSuggestion, "+", + suggestionsList = new ArrayList(); + suggestionsList.add(new SuggestedWordInfo(autoCorrectionSuggestion, "+", false)); final int suggestionsSize = mSuggestions.size(); // Note: i here is the index in mScores[], but the index in mSuggestions is one more @@ -413,12 +414,11 @@ public class Suggest implements Dictionary.WordCallback { } else { scoreInfoString = Integer.toString(mScores[i]); } - suggestionsList.add(new SuggestedWords.SuggestedWordInfo(mSuggestions.get(i + 1), + suggestionsList.add(new SuggestedWordInfo(mSuggestions.get(i + 1), scoreInfoString, false)); } for (int i = mScores.length; i < suggestionsSize; ++i) { - suggestionsList.add(new SuggestedWords.SuggestedWordInfo(mSuggestions.get(i), - "--", false)); + suggestionsList.add(new SuggestedWordInfo(mSuggestions.get(i), "--", false)); } } else { suggestionsList = SuggestedWords.getFromCharSequenceList(mSuggestions);