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

Commit b18296c8 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Fixed that indents on an ellipsis of a staticlayout were dropped"

parents aca8d4cd 365ec096
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1031,6 +1031,7 @@ public class StaticLayout extends Layout {
                                   float avail, TextUtils.TruncateAt where,
                                   int line, float textWidth, TextPaint paint,
                                   boolean forceEllipsis) {
        avail -= getTotalInsets(line);
        if (textWidth <= avail && !forceEllipsis) {
            // Everything fits!
            mLines[mColumns * line + ELLIPSIS_START] = 0;
@@ -1134,6 +1135,17 @@ public class StaticLayout extends Layout {
        mLines[mColumns * line + ELLIPSIS_COUNT] = ellipsisCount;
    }

    private float getTotalInsets(int line) {
        int totalIndent = 0;
        if (mLeftIndents != null) {
            totalIndent = mLeftIndents[Math.min(line, mLeftIndents.length - 1)];
        }
        if (mRightIndents != null) {
            totalIndent += mRightIndents[Math.min(line, mRightIndents.length - 1)];
        }
        return totalIndent;
    }

    // Override the base class so we can directly access our members,
    // rather than relying on member functions.
    // The logic mirrors that of Layout.getLineForVertical