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

Commit 5bf936ac authored by Sebastian Franco's avatar Sebastian Franco
Browse files

Preventing the text on ButtonDropTarget.resizeTextToFit size to go below 0

Bug: 260984829
Test: atest HomeScreenEditStateImageTest
Change-Id: I4aba76de512aedf5b4c921593fe43099700eb773
parent c04120e6
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -423,14 +423,15 @@ public abstract class ButtonDropTarget extends TextView
        float textSize = Utilities.pxToSp(getTextSize());

        int availableWidth = getMeasuredWidth();
        while (textSize > minSize) {
            if (isTextTruncated(availableWidth)) {
        while (isTextTruncated(availableWidth)) {
            textSize -= step;
            if (textSize < minSize) {
                textSize = minSize;
                setTextSize(textSize);
            } else {
                return textSize;
                break;
            }
            setTextSize(textSize);
        }
        return minSize;
        return textSize;
    }
}