summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-08-08 09:53:36 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-08 09:53:36 -0700
commit3a02ff1300772b0063a7a97ffc0248275603fe7c (patch)
tree81b72b88d5b2efc869908204e4820016701d5d01 /core/java
parente112567b45550e50586002d75bf540763ad21fb9 (diff)
parentec1d60369f751c2d9b60237077ceb9c03e4c0aed (diff)
Merge "Fix bug 5112702 - switches should have "ON" on the right"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/Switch.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 57f73ac4f114..9ac170de284b 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -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;