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

Commit 0dc9646e authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix again bug #6887370 ListPreference shows misaligned radio drawables (in CheckedTextView?)

Change-Id: Ia377cc95cd64f2df0a258b9ea3f709e6094f395e
parent fc6baa83
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -175,11 +175,7 @@ public class CheckedTextView extends TextView implements Checkable {
    @Override
    protected void internalSetPadding(int left, int top, int right, int bottom) {
        super.internalSetPadding(left, top, right, bottom);
        if (isLayoutRtl()) {
            mBasePadding = mUserPaddingLeft;
        } else {
            mBasePadding = mUserPaddingRight;
        }
        setBasePadding(isLayoutRtl());
    }

    @Override
@@ -201,13 +197,21 @@ public class CheckedTextView extends TextView implements Checkable {
    @Override
    public void setPadding(int left, int top, int right, int bottom) {
        super.setPadding(left, top, right, bottom);
        mBasePadding = getPaddingEnd();
        setBasePadding(isLayoutRtl());
    }

    @Override
    public void setPaddingRelative(int start, int top, int end, int bottom) {
        super.setPaddingRelative(start, top, end, bottom);
        mBasePadding = getPaddingEnd();
        setBasePadding(isLayoutRtl());
    }

    private void setBasePadding(boolean isLayoutRtl) {
        if (isLayoutRtl) {
            mBasePadding = mPaddingLeft;
        } else {
            mBasePadding = mPaddingRight;
        }
    }

    @Override
@@ -237,11 +241,11 @@ public class CheckedTextView extends TextView implements Checkable {
            final int left;
            final int right;
            if (isLayoutRtl) {
                right = getPaddingEnd();
                left = right - mCheckMarkWidth;
            } else {
                left = width - getPaddingEnd();
                left = mBasePadding;
                right = left + mCheckMarkWidth;
            } else {
                right = width - mBasePadding;
                left = right - mCheckMarkWidth;
            }
            checkMarkDrawable.setBounds( left, top, right, bottom);
            checkMarkDrawable.draw(canvas);