Fix scrolling accessibility events sent from PagedView

BUG: 11087905
Change-Id: Id4852dc04ee1aca25ccb0eba094b34c6b87d6d41
This commit is contained in:
Alan Viverette committed 2013-10-08 13:13:46 -07:00
1 parent cffa7175f8
commit 254139a3c7
1 file changed
+9 -2
+9 -2
View File
@@ -668,11 +668,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (am.isEnabled()) {
AccessibilityEvent ev =
AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED);
ev.getText().add("");
ev.setItemCount(getChildCount());
ev.setFromIndex(mCurrentPage);
int action = AccessibilityNodeInfo.ACTION_SCROLL_FORWARD;
final int action;
if (getNextPage() >= mCurrentPage) {
action = AccessibilityNodeInfo.ACTION_SCROLL_FORWARD;
} else {
@@ -2751,6 +2750,14 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
@Override
public void sendAccessibilityEvent(int eventType) {
// Don't let the view send real scroll events.
if (eventType != AccessibilityEvent.TYPE_VIEW_SCROLLED) {
super.sendAccessibilityEvent(eventType);
}
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);