summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-07-23 19:52:17 -0700
committerSvetoslav Ganov <svetoslavganov@google.com>2011-07-23 19:52:22 -0700
commit63bce03cc69be4a45230aa8bbd89dbde60681067 (patch)
tree60068291abc0cf397a1cccbe8217fb670e8d01c4
parentd24cd90486821535fb058531fac54aa5b9360693 (diff)
downloadframeworks_base-63bce03cc69be4a45230aa8bbd89dbde60681067.zip
frameworks_base-63bce03cc69be4a45230aa8bbd89dbde60681067.tar.gz
frameworks_base-63bce03cc69be4a45230aa8bbd89dbde60681067.tar.bz2
Switch state text not added to accessibility events.
1. Adding the text to the events now. bug:5071053 Change-Id: If36afb1f5327720fc002b8c49e5d7b00c5f189f7
-rw-r--r--core/java/android/widget/Switch.java8
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)),