diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2011-07-25 11:23:56 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-25 11:23:56 -0700 |
commit | 0d1d96272025f30f40c49c387f2fe9daaf6133c9 (patch) | |
tree | 67a44fd3f1beb9869f6f6e918b9d8586602a4631 | |
parent | 184dd03c81e924f610cf88dae266f2e5629b114d (diff) | |
parent | 63bce03cc69be4a45230aa8bbd89dbde60681067 (diff) | |
download | frameworks_base-0d1d96272025f30f40c49c387f2fe9daaf6133c9.zip frameworks_base-0d1d96272025f30f40c49c387f2fe9daaf6133c9.tar.gz frameworks_base-0d1d96272025f30f40c49c387f2fe9daaf6133c9.tar.bz2 |
Merge "Switch state text not added to accessibility events."
-rw-r--r-- | core/java/android/widget/Switch.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index b7565f3..0c80a11 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -34,6 +34,7 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; +import android.view.accessibility.AccessibilityEvent; import com.android.internal.R; @@ -360,6 +361,13 @@ public class Switch extends CompoundButton { } } + @Override + public void onPopulateAccessibilityEvent(AccessibilityEvent event) { + super.onPopulateAccessibilityEvent(event); + Layout switchText = getTargetCheckedState() ? mOnLayout : mOffLayout; + event.getText().add(switchText.getText()); + } + private Layout makeLayout(CharSequence text) { return new StaticLayout(text, mTextPaint, (int) Math.ceil(Layout.getDesiredWidth(text, mTextPaint)), |