am 3aa2043a: Merge "[IL76] Remove a SuggestionStripView dependency"

* commit '3aa2043a66f7fcb5eaba3adae16abf5aa862d652':
  [IL76] Remove a SuggestionStripView dependency
main
Jean Chalard 2014-01-23 02:09:31 -08:00 committed by Android Git Automerger
commit b8c71e2fa3
5 changed files with 13 additions and 16 deletions

View File

@ -50,8 +50,6 @@ public final class Suggest {
// Close to -2**31 // Close to -2**31
private static final int SUPPRESS_SUGGEST_THRESHOLD = -2000000000; private static final int SUPPRESS_SUGGEST_THRESHOLD = -2000000000;
public static final int MAX_SUGGESTIONS = 18;
private static final boolean DBG = LatinImeLogger.sDBG; private static final boolean DBG = LatinImeLogger.sDBG;
public final DictionaryFacilitatorForSuggest mDictionaryFacilitator; public final DictionaryFacilitatorForSuggest mDictionaryFacilitator;
@ -109,7 +107,7 @@ public final class Suggest {
final OnGetSuggestedWordsCallback callback) { final OnGetSuggestedWordsCallback callback) {
final int trailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount(); final int trailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator, final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator,
MAX_SUGGESTIONS); SuggestedWords.MAX_SUGGESTIONS);
final String typedWord = wordComposer.getTypedWord(); final String typedWord = wordComposer.getTypedWord();
final String consideredWord = trailingSingleQuotesCount > 0 final String consideredWord = trailingSingleQuotesCount > 0
@ -226,7 +224,7 @@ public final class Suggest {
final int sessionId, final int sequenceNumber, final int sessionId, final int sequenceNumber,
final OnGetSuggestedWordsCallback callback) { final OnGetSuggestedWordsCallback callback) {
final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator, final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator,
MAX_SUGGESTIONS); SuggestedWords.MAX_SUGGESTIONS);
mDictionaryFacilitator.getSuggestions(wordComposer, prevWordForBigram, proximityInfo, mDictionaryFacilitator.getSuggestions(wordComposer, prevWordForBigram, proximityInfo,
blockOffensiveWords, additionalFeaturesOptions, sessionId, suggestionsSet); blockOffensiveWords, additionalFeaturesOptions, sessionId, suggestionsSet);
for (SuggestedWordInfo wordInfo : suggestionsSet) { for (SuggestedWordInfo wordInfo : suggestionsSet) {

View File

@ -31,6 +31,9 @@ public final class SuggestedWords {
public static final int INDEX_OF_AUTO_CORRECTION = 1; public static final int INDEX_OF_AUTO_CORRECTION = 1;
public static final int NOT_A_SEQUENCE_NUMBER = -1; public static final int NOT_A_SEQUENCE_NUMBER = -1;
// The maximum number of suggestions available.
public static final int MAX_SUGGESTIONS = 18;
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST = private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST =
CollectionUtils.newArrayList(0); CollectionUtils.newArrayList(0);
public static final SuggestedWords EMPTY = new SuggestedWords( public static final SuggestedWords EMPTY = new SuggestedWords(

View File

@ -46,7 +46,6 @@ import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.settings.Settings;
import com.android.inputmethod.latin.settings.SettingsValues; import com.android.inputmethod.latin.settings.SettingsValues;
import com.android.inputmethod.latin.settings.SpacingAndPunctuations; import com.android.inputmethod.latin.settings.SpacingAndPunctuations;
import com.android.inputmethod.latin.suggestions.SuggestionStripView;
import com.android.inputmethod.latin.utils.AsyncResultHolder; import com.android.inputmethod.latin.utils.AsyncResultHolder;
import com.android.inputmethod.latin.utils.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.InputTypeUtils; import com.android.inputmethod.latin.utils.InputTypeUtils;
@ -1064,7 +1063,7 @@ public final class InputLogic {
final String typedWord = range.mWord.toString(); final String typedWord = range.mWord.toString();
if (includeResumedWordInSuggestions) { if (includeResumedWordInSuggestions) {
suggestions.add(new SuggestedWordInfo(typedWord, suggestions.add(new SuggestedWordInfo(typedWord,
SuggestionStripView.MAX_SUGGESTIONS + 1, SuggestedWords.MAX_SUGGESTIONS + 1,
SuggestedWordInfo.KIND_TYPED, Dictionary.DICTIONARY_USER_TYPED, SuggestedWordInfo.KIND_TYPED, Dictionary.DICTIONARY_USER_TYPED,
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */)); SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */));
@ -1076,7 +1075,7 @@ public final class InputLogic {
++i; ++i;
if (!TextUtils.equals(s, typedWord)) { if (!TextUtils.equals(s, typedWord)) {
suggestions.add(new SuggestedWordInfo(s, suggestions.add(new SuggestedWordInfo(s,
SuggestionStripView.MAX_SUGGESTIONS - i, SuggestedWords.MAX_SUGGESTIONS - i,
SuggestedWordInfo.KIND_RESUMED, Dictionary.DICTIONARY_RESUMED, SuggestedWordInfo.KIND_RESUMED, Dictionary.DICTIONARY_RESUMED,
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */, SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
SuggestedWordInfo.NOT_A_CONFIDENCE SuggestedWordInfo.NOT_A_CONFIDENCE

View File

@ -47,10 +47,10 @@ public final class MoreSuggestions extends Keyboard {
} }
private static final class MoreSuggestionsParam extends KeyboardParams { private static final class MoreSuggestionsParam extends KeyboardParams {
private final int[] mWidths = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mWidths = new int[SuggestedWords.MAX_SUGGESTIONS];
private final int[] mRowNumbers = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mRowNumbers = new int[SuggestedWords.MAX_SUGGESTIONS];
private final int[] mColumnOrders = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mColumnOrders = new int[SuggestedWords.MAX_SUGGESTIONS];
private final int[] mNumColumnsInRow = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mNumColumnsInRow = new int[SuggestedWords.MAX_SUGGESTIONS];
private static final int MAX_COLUMNS_IN_ROW = 3; private static final int MAX_COLUMNS_IN_ROW = 3;
private int mNumRows; private int mNumRows;
public Drawable mDivider; public Drawable mDivider;
@ -72,7 +72,7 @@ public final class MoreSuggestions extends Keyboard {
int row = 0; int row = 0;
int index = fromIndex; int index = fromIndex;
int rowStartIndex = fromIndex; int rowStartIndex = fromIndex;
final int size = Math.min(suggestedWords.size(), SuggestionStripView.MAX_SUGGESTIONS); final int size = Math.min(suggestedWords.size(), SuggestedWords.MAX_SUGGESTIONS);
while (index < size) { while (index < size) {
final String word = suggestedWords.getWord(index); final String word = suggestedWords.getWord(index);
// TODO: Should take care of text x-scaling. // TODO: Should take care of text x-scaling.

View File

@ -53,9 +53,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
public void pickSuggestionManually(int index, SuggestedWordInfo word); public void pickSuggestionManually(int index, SuggestedWordInfo word);
} }
// The maximum number of suggestions available. See {@link Suggest#mPrefMaxSuggestions}.
public static final int MAX_SUGGESTIONS = 18;
static final boolean DBG = LatinImeLogger.sDBG; static final boolean DBG = LatinImeLogger.sDBG;
private final ViewGroup mSuggestionsStrip; private final ViewGroup mSuggestionsStrip;
@ -91,7 +88,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
inflater.inflate(R.layout.suggestions_strip, this); inflater.inflate(R.layout.suggestions_strip, this);
mSuggestionsStrip = (ViewGroup)findViewById(R.id.suggestions_strip); mSuggestionsStrip = (ViewGroup)findViewById(R.id.suggestions_strip);
for (int pos = 0; pos < MAX_SUGGESTIONS; pos++) { for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) {
final TextView word = (TextView)inflater.inflate(R.layout.suggestion_word, null); final TextView word = (TextView)inflater.inflate(R.layout.suggestion_word, null);
word.setOnClickListener(this); word.setOnClickListener(this);
word.setOnLongClickListener(this); word.setOnLongClickListener(this);