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

Commit 139b8743 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ellipsize text only if needed" into main

parents 34773092 89435ebe
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2495,8 +2495,14 @@ public class TextUtils {

                // Even if the argument name is `ellipsizeDip`, the unit of this argument is pixels.
                final int charCount = (int) ((ellipsizeDip + 0.5f) / assumedCharWidthInPx);
                return TextUtils.trimToSize(gettingCleaned.toString(), charCount)

                final String text = gettingCleaned.toString();
                if (TextUtils.isEmpty(text) || text.length() <= charCount) {
                    return text;
                } else {
                    return TextUtils.trimToSize(text, charCount)
                            + getEllipsisString(TruncateAt.END);
                }
            } else {
                // Truncate
                final TextPaint paint = new TextPaint();