am cbc7acb6: Merge "Expand suggestion strip when center suggestion is long"

* commit 'cbc7acb6f521fb680564a4fc6132c1913491de77':
  Expand suggestion strip when center suggestion is long
This commit is contained in:
Tadashi G. Takaoka 2013-06-03 07:46:42 -07:00 committed by Android Git Automerger
commit 15aab5b1fe

View file

@ -302,6 +302,23 @@ final class SuggestionStripLayoutHelper {
final int countInStrip = mSuggestionsCountInStrip; final int countInStrip = mSuggestionsCountInStrip;
setupWordViewsTextAndColor(suggestedWords, countInStrip); setupWordViewsTextAndColor(suggestedWords, countInStrip);
final TextView centerWordView = mWordViews.get(mCenterPositionInStrip);
final int stripWidth = placerView.getWidth();
final int centerWidth = getSuggestionWidth(mCenterPositionInStrip, stripWidth);
if (getTextScaleX(centerWordView.getText(), centerWidth, centerWordView.getPaint())
< MIN_TEXT_XSCALE) {
// Layout only the most relevant suggested word at the center of the suggestion strip
// by consolidating all slots in the strip.
mMoreSuggestionsAvailable = (suggestedWords.size() > 1);
layoutWord(mCenterPositionInStrip, stripWidth);
stripView.addView(centerWordView);
setLayoutWeight(centerWordView, 1.0f, ViewGroup.LayoutParams.MATCH_PARENT);
if (SuggestionStripView.DBG) {
layoutDebugInfo(mCenterPositionInStrip, placerView, stripWidth);
}
return;
}
mMoreSuggestionsAvailable = (suggestedWords.size() > countInStrip); mMoreSuggestionsAvailable = (suggestedWords.size() > countInStrip);
int x = 0; int x = 0;
for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) { for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) {
@ -312,7 +329,7 @@ final class SuggestionStripLayoutHelper {
x += divider.getMeasuredWidth(); x += divider.getMeasuredWidth();
} }
final int width = getSuggestionWidth(positionInStrip, placerView.getWidth()); final int width = getSuggestionWidth(positionInStrip, stripWidth);
final TextView wordView = layoutWord(positionInStrip, width); final TextView wordView = layoutWord(positionInStrip, width);
stripView.addView(wordView); stripView.addView(wordView);
setLayoutWeight(wordView, getSuggestionWeight(positionInStrip), setLayoutWeight(wordView, getSuggestionWeight(positionInStrip),