Merge "[IL76] Remove a SuggestionStripView dependency"
This commit is contained in:
commit
3aa2043a66
5 changed files with 13 additions and 16 deletions
|
@ -50,8 +50,6 @@ public final class Suggest {
|
|||
// Close to -2**31
|
||||
private static final int SUPPRESS_SUGGEST_THRESHOLD = -2000000000;
|
||||
|
||||
public static final int MAX_SUGGESTIONS = 18;
|
||||
|
||||
private static final boolean DBG = LatinImeLogger.sDBG;
|
||||
|
||||
public final DictionaryFacilitatorForSuggest mDictionaryFacilitator;
|
||||
|
@ -109,7 +107,7 @@ public final class Suggest {
|
|||
final OnGetSuggestedWordsCallback callback) {
|
||||
final int trailingSingleQuotesCount = wordComposer.trailingSingleQuotesCount();
|
||||
final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator,
|
||||
MAX_SUGGESTIONS);
|
||||
SuggestedWords.MAX_SUGGESTIONS);
|
||||
|
||||
final String typedWord = wordComposer.getTypedWord();
|
||||
final String consideredWord = trailingSingleQuotesCount > 0
|
||||
|
@ -226,7 +224,7 @@ public final class Suggest {
|
|||
final int sessionId, final int sequenceNumber,
|
||||
final OnGetSuggestedWordsCallback callback) {
|
||||
final BoundedTreeSet suggestionsSet = new BoundedTreeSet(sSuggestedWordInfoComparator,
|
||||
MAX_SUGGESTIONS);
|
||||
SuggestedWords.MAX_SUGGESTIONS);
|
||||
mDictionaryFacilitator.getSuggestions(wordComposer, prevWordForBigram, proximityInfo,
|
||||
blockOffensiveWords, additionalFeaturesOptions, sessionId, suggestionsSet);
|
||||
for (SuggestedWordInfo wordInfo : suggestionsSet) {
|
||||
|
|
|
@ -31,6 +31,9 @@ public final class SuggestedWords {
|
|||
public static final int INDEX_OF_AUTO_CORRECTION = 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 =
|
||||
CollectionUtils.newArrayList(0);
|
||||
public static final SuggestedWords EMPTY = new SuggestedWords(
|
||||
|
|
|
@ -46,7 +46,6 @@ import com.android.inputmethod.latin.define.ProductionFlag;
|
|||
import com.android.inputmethod.latin.settings.Settings;
|
||||
import com.android.inputmethod.latin.settings.SettingsValues;
|
||||
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.CollectionUtils;
|
||||
import com.android.inputmethod.latin.utils.InputTypeUtils;
|
||||
|
@ -1064,7 +1063,7 @@ public final class InputLogic {
|
|||
final String typedWord = range.mWord.toString();
|
||||
if (includeResumedWordInSuggestions) {
|
||||
suggestions.add(new SuggestedWordInfo(typedWord,
|
||||
SuggestionStripView.MAX_SUGGESTIONS + 1,
|
||||
SuggestedWords.MAX_SUGGESTIONS + 1,
|
||||
SuggestedWordInfo.KIND_TYPED, Dictionary.DICTIONARY_USER_TYPED,
|
||||
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
|
||||
SuggestedWordInfo.NOT_A_CONFIDENCE /* autoCommitFirstWordConfidence */));
|
||||
|
@ -1076,7 +1075,7 @@ public final class InputLogic {
|
|||
++i;
|
||||
if (!TextUtils.equals(s, typedWord)) {
|
||||
suggestions.add(new SuggestedWordInfo(s,
|
||||
SuggestionStripView.MAX_SUGGESTIONS - i,
|
||||
SuggestedWords.MAX_SUGGESTIONS - i,
|
||||
SuggestedWordInfo.KIND_RESUMED, Dictionary.DICTIONARY_RESUMED,
|
||||
SuggestedWordInfo.NOT_AN_INDEX /* indexOfTouchPointOfSecondWord */,
|
||||
SuggestedWordInfo.NOT_A_CONFIDENCE
|
||||
|
|
|
@ -47,10 +47,10 @@ public final class MoreSuggestions extends Keyboard {
|
|||
}
|
||||
|
||||
private static final class MoreSuggestionsParam extends KeyboardParams {
|
||||
private final int[] mWidths = new int[SuggestionStripView.MAX_SUGGESTIONS];
|
||||
private final int[] mRowNumbers = new int[SuggestionStripView.MAX_SUGGESTIONS];
|
||||
private final int[] mColumnOrders = new int[SuggestionStripView.MAX_SUGGESTIONS];
|
||||
private final int[] mNumColumnsInRow = new int[SuggestionStripView.MAX_SUGGESTIONS];
|
||||
private final int[] mWidths = new int[SuggestedWords.MAX_SUGGESTIONS];
|
||||
private final int[] mRowNumbers = new int[SuggestedWords.MAX_SUGGESTIONS];
|
||||
private final int[] mColumnOrders = new int[SuggestedWords.MAX_SUGGESTIONS];
|
||||
private final int[] mNumColumnsInRow = new int[SuggestedWords.MAX_SUGGESTIONS];
|
||||
private static final int MAX_COLUMNS_IN_ROW = 3;
|
||||
private int mNumRows;
|
||||
public Drawable mDivider;
|
||||
|
@ -72,7 +72,7 @@ public final class MoreSuggestions extends Keyboard {
|
|||
int row = 0;
|
||||
int index = 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) {
|
||||
final String word = suggestedWords.getWord(index);
|
||||
// TODO: Should take care of text x-scaling.
|
||||
|
|
|
@ -53,9 +53,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
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;
|
||||
|
||||
private final ViewGroup mSuggestionsStrip;
|
||||
|
@ -91,7 +88,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
inflater.inflate(R.layout.suggestions_strip, this);
|
||||
|
||||
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);
|
||||
word.setOnClickListener(this);
|
||||
word.setOnLongClickListener(this);
|
||||
|
|
Loading…
Reference in a new issue