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

Commit ec1d6036 authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 5112702 - switches should have "ON" on the right

Make Switches obey the Grand Unified Theory of Button Ordering.
This also matches their behavior with volume/brightness sliders.

Change-Id: I4e72801e81b10002542a05f61c99a57991f130ff
parent 5d496788
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -507,13 +507,13 @@ public class Switch extends CompoundButton {
    }

    private boolean getTargetCheckedState() {
        return mThumbPosition <= getThumbScrollRange() / 2;
        return mThumbPosition >= getThumbScrollRange() / 2;
    }

    @Override
    public void setChecked(boolean checked) {
        super.setChecked(checked);
        mThumbPosition = checked ? 0 : getThumbScrollRange();
        mThumbPosition = checked ? getThumbScrollRange() : 0;
        invalidate();
    }

@@ -521,7 +521,7 @@ public class Switch extends CompoundButton {
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);

        mThumbPosition = isChecked() ? 0 : getThumbScrollRange();
        mThumbPosition = isChecked() ? getThumbScrollRange() : 0;

        int switchRight = getWidth() - getPaddingRight();
        int switchLeft = switchRight - mSwitchWidth;