Fix when to show more suggestions dot hint

Bug: 17742406
Change-Id: Ifdf5d196778da2bb9bb9e3ca9250d23857d90bab
main
Tadashi G. Takaoka 2014-10-01 16:14:55 +09:00
parent 9586d69bdf
commit 23b35a9689
1 changed files with 7 additions and 3 deletions

View File

@ -365,17 +365,21 @@ final class SuggestionStripLayoutHelper {
(PunctuationSuggestions)suggestedWords, stripView); (PunctuationSuggestions)suggestedWords, stripView);
} }
final boolean shouldShowUiToAcceptTypedWord = Settings.getInstance().getCurrent()
.mShouldShowUiToAcceptTypedWord;
final int suggestionsCount = suggestedWords.size()
- (shouldShowUiToAcceptTypedWord ? /* typed word */ 1 : 0);
final int startIndexOfMoreSuggestions = setupWordViewsAndReturnStartIndexOfMoreSuggestions( final int startIndexOfMoreSuggestions = setupWordViewsAndReturnStartIndexOfMoreSuggestions(
suggestedWords, mSuggestionsCountInStrip); suggestedWords, mSuggestionsCountInStrip);
final TextView centerWordView = mWordViews.get(mCenterPositionInStrip); final TextView centerWordView = mWordViews.get(mCenterPositionInStrip);
final int stripWidth = stripView.getWidth(); final int stripWidth = stripView.getWidth();
final int centerWidth = getSuggestionWidth(mCenterPositionInStrip, stripWidth); final int centerWidth = getSuggestionWidth(mCenterPositionInStrip, stripWidth);
if (suggestedWords.size() == 1 || getTextScaleX(centerWordView.getText(), centerWidth, if (suggestionsCount == 1 || getTextScaleX(centerWordView.getText(), centerWidth,
centerWordView.getPaint()) < MIN_TEXT_XSCALE) { centerWordView.getPaint()) < MIN_TEXT_XSCALE) {
// Layout only the most relevant suggested word at the center of the suggestion strip // Layout only the most relevant suggested word at the center of the suggestion strip
// by consolidating all slots in the strip. // by consolidating all slots in the strip.
final int countInStrip = 1; final int countInStrip = 1;
mMoreSuggestionsAvailable = (suggestedWords.size() > countInStrip); mMoreSuggestionsAvailable = (suggestionsCount > countInStrip);
layoutWord(mCenterPositionInStrip, stripWidth - mPadding); layoutWord(mCenterPositionInStrip, stripWidth - mPadding);
stripView.addView(centerWordView); stripView.addView(centerWordView);
setLayoutWeight(centerWordView, 1.0f, ViewGroup.LayoutParams.MATCH_PARENT); setLayoutWeight(centerWordView, 1.0f, ViewGroup.LayoutParams.MATCH_PARENT);
@ -387,7 +391,7 @@ final class SuggestionStripLayoutHelper {
} }
final int countInStrip = mSuggestionsCountInStrip; final int countInStrip = mSuggestionsCountInStrip;
mMoreSuggestionsAvailable = (suggestedWords.size() > countInStrip); mMoreSuggestionsAvailable = (suggestionsCount > countInStrip);
int x = 0; int x = 0;
for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) { for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) {
if (positionInStrip != 0) { if (positionInStrip != 0) {