From 30401328c1026389171d454c934c15875c3f7ff0 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Thu, 12 May 2011 18:53:45 -0700 Subject: Factored out the Accessibility vertical initialization. 1. Accessibility events were filled with data in dispatchPopulateAccessibilityEvent and onPopulateAccessibilityEvent. These events have two axis of population 1) up the class hierarchy to populate information for the event source; 2) down the view hierarchy to populated all the text contained in the source including its descendants. These two axis of population were done in on population pass now the populating the source properties happens in initializeAccessiblityEvent and the text in onPopulateAccessibilityEvent which is called from dispatchPopulateAccessiblityEvent. 2. Removed the string description from events fired from CompoundButton since the event has isChecked() property and it is responsibility of the clients to decide what utterrance to use and if to use such for announcing the checked state. Change-Id: I5d7f75cf8a87a7a4b3bb7b311e8e642ec9a0faa5 --- core/java/android/widget/CompoundButton.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'core/java/android/widget/CompoundButton.java') diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index f050d41e3c55..a73001868396 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -208,17 +208,8 @@ public abstract class CompoundButton extends Button implements Checkable { } @Override - public void onPopulateAccessibilityEvent(AccessibilityEvent event) { - super.onPopulateAccessibilityEvent(event); - - int resourceId = 0; - if (mChecked) { - resourceId = R.string.accessibility_compound_button_selected; - } else { - resourceId = R.string.accessibility_compound_button_unselected; - } - String state = getResources().getString(resourceId); - event.getText().add(state); + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); event.setChecked(mChecked); } -- cgit v1.2.3