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

Commit e6ed9c61 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by android-build-merger
Browse files

Merge "Sum up character widths to get the last line width for ellipsis." into...

Merge "Sum up character widths to get the last line width for ellipsis." into nyc-dev am: f2cbf95b
am: 99ac8cb8

* commit '99ac8cb8':
  Sum up character widths to get the last line width for ellipsis.

Change-Id: I417c0962211b858989fabb9d0d09fe536aaae97c
parents 6342049e 99ac8cb8
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -754,15 +754,21 @@ public class StaticLayout extends Layout {
                                && ellipsize != TextUtils.TruncateAt.MARQUEE));
            if (remainingLineCount > 0 && remainingLineCount < breakCount &&
                    ellipsisMayBeApplied) {
                // Treat the last line and overflowed lines as a single line.
                breaks[remainingLineCount - 1] = breaks[breakCount - 1];
                // Calculate width and flag.
                float width = 0;
                int flag = 0;
                for (int i = remainingLineCount - 1; i < breakCount; i++) {
                    if (i == breakCount - 1) {
                        width += lineWidths[i];
                    } else {
                        for (int j = (i == 0 ? 0 : breaks[i - 1]); j < breaks[i]; j++) {
                            width += widths[j];
                        }
                    }
                    flag |= flags[i] & TAB_MASK;
                }
                // Treat the last line and overflowed lines as a single line.
                breaks[remainingLineCount - 1] = breaks[breakCount - 1];
                lineWidths[remainingLineCount - 1] = width;
                flags[remainingLineCount - 1] = flag;