diff options
author | Vadim Tryshev <vadimt@google.com> | 2015-05-08 17:21:03 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2015-05-11 17:40:07 +0000 |
commit | f4715974b80d06993342ca62b1298e4d90e2fab8 (patch) | |
tree | e568fa488f0e73d275709de5f2659632a6a08483 | |
parent | 83f59abc9c566da5deb98afe7ea35cfb061f2920 (diff) | |
download | android_packages_apps_Trebuchet-f4715974b80d06993342ca62b1298e4d90e2fab8.tar.gz android_packages_apps_Trebuchet-f4715974b80d06993342ca62b1298e4d90e2fab8.tar.bz2 android_packages_apps_Trebuchet-f4715974b80d06993342ca62b1298e4d90e2fab8.zip |
Fixing accessibility scrolling events generated by PagedView:
1. Not generating scroll events from snapToPage(). It already gets
generated from computeScrollHelper().
2. Not setting action because doing so is not mentioned here:
http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html.
3. Not generating scroll event when the page stays same (before it was
generated, say, when we simply returned from the AllApps view to
Workspace).
4. From/To index is not the old and new page numbers; they are indices
of the first and last item; in our case, the item is the page, and
both FromIndex and ToIndex should be set to this page number.
Bug: 18761184
Change-Id: I3dadf816c3d45b8bd42a13930344874584467499
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index 0739babea..f77ad0564 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -712,21 +712,15 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); if (am.isEnabled()) { - AccessibilityEvent ev = - AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); - ev.setItemCount(getChildCount()); - ev.setFromIndex(mCurrentPage); - ev.setToIndex(getNextPage()); - - final int action; - if (getNextPage() >= mCurrentPage) { - action = AccessibilityNodeInfo.ACTION_SCROLL_FORWARD; - } else { - action = AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD; + if (mCurrentPage != getNextPage()) { + AccessibilityEvent ev = + AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); + ev.setItemCount(getChildCount()); + ev.setFromIndex(getNextPage()); + ev.setToIndex(getNextPage()); + + sendAccessibilityEventUnchecked(ev); } - - ev.setAction(action); - sendAccessibilityEventUnchecked(ev); } } @@ -2301,8 +2295,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc focusedChild.clearFocus(); } - sendScrollAccessibilityEvent(); - pageBeginMoving(); awakenScrollBars(duration); if (immediate) { |