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

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

Merge "Fix width calculation of TextView" into main

parents 8bbfc25c 02d8ee41
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -477,7 +477,12 @@ public class TextLine {
            }
            drawBounds.setEmpty();
            float w = measure(mLen, false, fmi, drawBounds, lineInfo);
            float boundsWidth = drawBounds.width();
            float boundsWidth;
            if (w >= 0) {
                boundsWidth = Math.max(drawBounds.right, w) - Math.min(0, drawBounds.left);
            } else {
                boundsWidth = Math.max(drawBounds.right, 0) - Math.min(w, drawBounds.left);
            }
            if (Math.abs(w) > boundsWidth) {
                return w;
            } else {
+4 −2
Original line number Diff line number Diff line
@@ -11254,8 +11254,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                width = des;
            } else {
                if (mUseBoundsForWidth) {
                    width = Math.max(boring.width,
                            (int) Math.ceil(boring.getDrawingBoundingBox().width()));
                    RectF bbox = boring.getDrawingBoundingBox();
                    float rightMax = Math.max(bbox.right, boring.width);
                    float leftMin = Math.min(bbox.left, 0);
                    width = Math.max(boring.width, (int) Math.ceil(rightMax - leftMin));
                } else {
                    width = boring.width;
                }