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

Commit 9725710a authored by Joe Onorato's avatar Joe Onorato Committed by Android Git Automerger
Browse files

am 539802e7: Merge "The switch widget didn\'t work properly until after...

am 539802e7: Merge "The switch widget didn\'t work properly until after onMeasure had run." into honeycomb

* commit '539802e7':
  The switch widget didn't work properly until after onMeasure had run.
parents bd0a9bdb 539802e7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -479,9 +479,9 @@ public class Switch extends CompoundButton {
    }

    private void animateThumbToCheckedState(boolean newCheckedState) {
        float targetPos = newCheckedState ? 0 : getThumbScrollRange();
        // TODO animate!
        mThumbPosition = targetPos;
        //float targetPos = newCheckedState ? 0 : getThumbScrollRange();
        //mThumbPosition = targetPos;
        setChecked(newCheckedState);
    }

@@ -493,12 +493,15 @@ public class Switch extends CompoundButton {
    public void setChecked(boolean checked) {
        super.setChecked(checked);
        mThumbPosition = checked ? 0 : getThumbScrollRange();
        invalidate();
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        super.onLayout(changed, left, top, right, bottom);

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

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