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

Commit 24aba4b9 authored by Siyamed Sinir's avatar Siyamed Sinir
Browse files

Set StaticLayout.maxLines only when ellipsize is set

A partial revert for the CL I5dbc48a6c7f0f4ac4c693d5c95f0a99b989e07f4.
The mentioned CL tried to always set the maxLines attribute of
StaticLayout. However this caused regressions at certain points.

Bug: 28885989
Bug: 28468120
Change-Id: Ic09cb194c8811a06b5d53de50bfb77938b91b88d
parent 0f6363e8
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -6857,11 +6857,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                        .setLineSpacing(mSpacingAdd, mSpacingMult)
                        .setIncludePad(mIncludePad)
                        .setBreakStrategy(mBreakStrategy)
                        .setHyphenationFrequency(mHyphenationFrequency)
                        .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
                        .setHyphenationFrequency(mHyphenationFrequency);
                if (shouldEllipsize) {
                    builder.setEllipsize(mEllipsize)
                            .setEllipsizedWidth(ellipsisWidth);
                            .setEllipsizedWidth(ellipsisWidth)
                            .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
                }
                mHintLayout = builder.build();
            }
@@ -6948,12 +6948,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    .setLineSpacing(mSpacingAdd, mSpacingMult)
                    .setIncludePad(mIncludePad)
                    .setBreakStrategy(mBreakStrategy)
                    .setHyphenationFrequency(mHyphenationFrequency)
                    .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
                    .setHyphenationFrequency(mHyphenationFrequency);
            if (shouldEllipsize) {
                builder.setEllipsize(effectiveEllipsize)
                        .setEllipsizedWidth(ellipsisWidth);

                        .setEllipsizedWidth(ellipsisWidth)
                        .setMaxLines(mMaxMode == LINES ? mMaximum : Integer.MAX_VALUE);
            }
            // TODO: explore always setting maxLines
            result = builder.build();