diff options
author | 2013-06-03 14:45:05 +0000 | |
---|---|---|
committer | 2013-06-03 14:45:05 +0000 | |
commit | cbc7acb6f521fb680564a4fc6132c1913491de77 (patch) | |
tree | 996b5cfc5ff3ef996bed74cfd56753102ec95e2f /java/src | |
parent | 763fd9d5e9a3136a4a7300219b8094df089fe5b6 (diff) | |
parent | 043273b00fb0f42761a38eb53c9911ef022dd5ae (diff) | |
download | latinime-cbc7acb6f521fb680564a4fc6132c1913491de77.tar.gz latinime-cbc7acb6f521fb680564a4fc6132c1913491de77.tar.xz latinime-cbc7acb6f521fb680564a4fc6132c1913491de77.zip |
Merge "Expand suggestion strip when center suggestion is long"
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java index e4c5a06a2..f434a1211 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripLayoutHelper.java @@ -302,6 +302,23 @@ final class SuggestionStripLayoutHelper { final int countInStrip = mSuggestionsCountInStrip; 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); int x = 0; for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) { @@ -312,7 +329,7 @@ final class SuggestionStripLayoutHelper { x += divider.getMeasuredWidth(); } - final int width = getSuggestionWidth(positionInStrip, placerView.getWidth()); + final int width = getSuggestionWidth(positionInStrip, stripWidth); final TextView wordView = layoutWord(positionInStrip, width); stripView.addView(wordView); setLayoutWeight(wordView, getSuggestionWeight(positionInStrip), |