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

Commit a601d44b authored by Roozbeh Pournader's avatar Roozbeh Pournader Committed by Android Git Automerger
Browse files

am a4d1e250: am 9787039d: Merge "Fudge getRightPaddingOffset in TextView to...

am a4d1e250: am 9787039d: Merge "Fudge getRightPaddingOffset in TextView to match clipRect." into lmp-mr1-dev

* commit 'a4d1e250':
  Fudge getRightPaddingOffset in TextView to match clipRect.
parents 97c18827 a4d1e250
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -5018,9 +5018,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        return (int) Math.max(0, mShadowDy + mShadowRadius);
        return (int) Math.max(0, mShadowDy + mShadowRadius);
    }
    }


    private int getFudgedPaddingRight() {
        // Add sufficient space for cursor and tone marks
        int cursorWidth = 2 + (int)mTextPaint.density; // adequate for Material cursors
        return Math.max(0, getCompoundPaddingRight() - (cursorWidth - 1));
    }

    @Override
    @Override
    protected int getRightPaddingOffset() {
    protected int getRightPaddingOffset() {
        return -(getCompoundPaddingRight() - mPaddingRight) +
        return -(getFudgedPaddingRight() - mPaddingRight) +
                (int) Math.max(0, mShadowDx + mShadowRadius);
                (int) Math.max(0, mShadowDx + mShadowRadius);
    }
    }


@@ -5374,13 +5380,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop;
        final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop;
        final int maxScrollY = mLayout.getHeight() - vspace;
        final int maxScrollY = mLayout.getHeight() - vspace;


        // Add sufficient space for cursor and tone marks
        int cursorWidth = 2 + (int)mTextPaint.density; // adequate for Material cursors
        int fudgedPaddingRight = Math.max(0, compoundPaddingRight - (cursorWidth - 1));

        float clipLeft = compoundPaddingLeft + scrollX;
        float clipLeft = compoundPaddingLeft + scrollX;
        float clipTop = (scrollY == 0) ? 0 : extendedPaddingTop + scrollY;
        float clipTop = (scrollY == 0) ? 0 : extendedPaddingTop + scrollY;
        float clipRight = right - left - fudgedPaddingRight + scrollX;
        float clipRight = right - left - getFudgedPaddingRight() + scrollX;
        float clipBottom = bottom - top + scrollY -
        float clipBottom = bottom - top + scrollY -
                ((scrollY == maxScrollY) ? 0 : extendedPaddingBottom);
                ((scrollY == maxScrollY) ? 0 : extendedPaddingBottom);