Merge "Don\'t read state twice ("on on"/"off off") in Settings Toggle preferences. Bug: 26967006" into nyc-dev
am: 18f8712634
* commit '18f87126341e4cef5da4514c57990f7fdf31ed04':
Don't read state twice ("on on"/"off off") in Settings Toggle preferences. Bug: 26967006
This commit is contained in:
@@ -318,11 +318,15 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CharSequence getAccessibilityClassName() {
|
||||||
|
return Switch.class.getName();
|
||||||
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
|
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
|
||||||
super.onInitializeAccessibilityNodeInfoInternal(info);
|
super.onInitializeAccessibilityNodeInfoInternal(info);
|
||||||
info.setClassName(Switch.class.getName());
|
|
||||||
info.setText(mTextView.getText());
|
info.setText(mTextView.getText());
|
||||||
info.setCheckable(true);
|
info.setCheckable(true);
|
||||||
info.setChecked(mSwitch.isChecked());
|
info.setChecked(mSwitch.isChecked());
|
||||||
@@ -332,7 +336,10 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
|||||||
@Override
|
@Override
|
||||||
public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) {
|
public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) {
|
||||||
super.onInitializeAccessibilityEventInternal(event);
|
super.onInitializeAccessibilityEventInternal(event);
|
||||||
event.setClassName(Switch.class.getName());
|
// Don't say "on on" or "off off" - rather, speak the state only once. We need to specify
|
||||||
|
// this explicitly as each of our children (the textview and the checkbox) contribute to
|
||||||
|
// the state once, giving us duplicate text by default.
|
||||||
|
event.setContentDescription(mTextView.getText());
|
||||||
event.setChecked(mSwitch.isChecked());
|
event.setChecked(mSwitch.isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user