Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 043273b0 authored by Tadashi G. Takaoka's avatar Tadashi G. Takaoka
Browse files

Expand suggestion strip when center suggestion is long

Bug: 9059710
Change-Id: I7fa2658cc6442e86f69c991f1e99db6fb1ef909c
parent 0e66ab74
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -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),