diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-03-09 10:09:03 -0800 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-03-09 10:17:16 -0800 |
| commit | 55249c8601e04928d4e8afb17233596a3ed4e0ce (patch) | |
| tree | 2768755525494a2a4a1a3519c9e609de74af7935 /core/java/android/widget/Switch.java | |
| parent | 4b97257979034a8031040b84d8f016d8f3175313 (diff) | |
Removing checked state description text for accessibility from some widgets.
1. The framework was appending some text to convey the state of a
a CheckedTextView or a RadioButton or a ToggleButton or a Switch
but the checked property already conveys that information. It is
responsibility of the screen reader developer to append the state
text based on the checked property. This change is requested by a
few screen reader developers.
bug:5951683
Change-Id: Ieba6797770201155c48e37147ae375dfcb5238aa
Diffstat (limited to 'core/java/android/widget/Switch.java')
| -rw-r--r-- | core/java/android/widget/Switch.java | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 334b9c450ef2..56b953251008 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -367,17 +367,8 @@ public class Switch extends CompoundButton { @Override public void onPopulateAccessibilityEvent(AccessibilityEvent event) { super.onPopulateAccessibilityEvent(event); - if (isChecked()) { - CharSequence text = mOnLayout.getText(); - if (TextUtils.isEmpty(text)) { - text = mContext.getString(R.string.switch_on); - } - event.getText().add(text); - } else { - CharSequence text = mOffLayout.getText(); - if (TextUtils.isEmpty(text)) { - text = mContext.getString(R.string.switch_off); - } + CharSequence text = isChecked() ? mOnLayout.getText() : mOffLayout.getText(); + if (!TextUtils.isEmpty(text)) { event.getText().add(text); } } |
