summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/Switch.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-08-07 18:03:39 -0700
committerAdam Powell <adamp@google.com>2011-08-07 18:03:39 -0700
commitec1d60369f751c2d9b60237077ceb9c03e4c0aed (patch)
treeeb138333f8f924dfb1be2405ea35d5bfe159d762 /core/java/android/widget/Switch.java
parent5d4967884132647a75d05bcc2ca1f9ce490b372f (diff)
downloadframeworks_base-ec1d60369f751c2d9b60237077ceb9c03e4c0aed.zip
frameworks_base-ec1d60369f751c2d9b60237077ceb9c03e4c0aed.tar.gz
frameworks_base-ec1d60369f751c2d9b60237077ceb9c03e4c0aed.tar.bz2
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
Diffstat (limited to 'core/java/android/widget/Switch.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 57f73ac..9ac170d 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;