diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2011-09-29 19:31:06 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2011-09-30 19:55:27 -0700 |
commit | 82e236d72ac197d6673d0b4d484fe5f0b9436731 (patch) | |
tree | 9ec5d12badff2a82048c354ba2b23edfcd405d16 /core/java/android/widget/AdapterView.java | |
parent | 3fd8275c0a35157fccc10063da3ce6f775c17d4c (diff) | |
download | frameworks_base-82e236d72ac197d6673d0b4d484fe5f0b9436731.zip frameworks_base-82e236d72ac197d6673d0b4d484fe5f0b9436731.tar.gz frameworks_base-82e236d72ac197d6673d0b4d484fe5f0b9436731.tar.bz2 |
The logic for not populating text to some accessibility events is scattered.
1. Some accessibility evenents should not and were not dispatched for
text population but there was no centralized location for enforcing
this - rather the system was firing them in a specific way or there
were conditions in a few places enforcing that. Now this is centralized
and clean.
2. Updated the documentation with some new event types the were lacking.
3. Explicitly stated in the documentaition which events are dispatched to
the sub-tree of the source for text populatation.
bug:5394527
Change-Id: I86e383807d777019ac98b970c7d9d02a2f7afac6
Diffstat (limited to 'core/java/android/widget/AdapterView.java')
-rw-r--r-- | core/java/android/widget/AdapterView.java | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index a4b4e78..61c5dd4 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -881,20 +881,14 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { @Override public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { - final int eventType = event.getEventType(); - switch (eventType) { - case AccessibilityEvent.TYPE_VIEW_SCROLLED: - // Do not populate the text of scroll events. - return true; - case AccessibilityEvent.TYPE_VIEW_FOCUSED: - // This is an exceptional case which occurs when a window gets the - // focus and sends a focus event via its focused child to announce - // current focus/selection. AdapterView fires selection but not focus - // events so we change the event type here. - if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED) { - event.setEventType(AccessibilityEvent.TYPE_VIEW_SELECTED); - } - break; + if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED) { + // This is an exceptional case which occurs when a window gets the + // focus and sends a focus event via its focused child to announce + // current focus/selection. AdapterView fires selection but not focus + // events so we change the event type here. + if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED) { + event.setEventType(AccessibilityEvent.TYPE_VIEW_SELECTED); + } } View selectedView = getSelectedView(); |