Loading core/java/android/widget/Switch.java +5 −2 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -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; Loading Loading
core/java/android/widget/Switch.java +5 −2 Original line number Diff line number Diff line Loading @@ -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); } Loading @@ -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; Loading