diff options
author | Winson Chung <winsonc@google.com> | 2011-09-29 12:07:42 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-09-30 12:10:19 -0700 |
commit | c27d1bbb26f774a14122bc0b1d2ac33675439038 (patch) | |
tree | 801faa2a79aa0f1fbe975006cc0e9659d8f350c3 /src | |
parent | 2f6a86e9db6609fc96ccbe2e67438e52d93a2d78 (diff) | |
download | android_packages_apps_Trebuchet-c27d1bbb26f774a14122bc0b1d2ac33675439038.tar.gz android_packages_apps_Trebuchet-c27d1bbb26f774a14122bc0b1d2ac33675439038.tar.bz2 android_packages_apps_Trebuchet-c27d1bbb26f774a14122bc0b1d2ac33675439038.zip |
Fixing issue where we were adding text to each scroll event. (Bug: 5328362)
Change-Id: I9e716535cdf06a2955167b53d788dffc724d1133
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 8bc38c258..afb2b94f5 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -39,6 +39,7 @@ import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.ViewParent; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.Interpolator; import android.widget.Checkable; @@ -402,6 +403,14 @@ public abstract class PagedView extends ViewGroup { if (mTouchState == TOUCH_STATE_REST) { pageEndMoving(); } + + // Notify the user when the page changes + if (AccessibilityManager.getInstance(getContext()).isEnabled()) { + AccessibilityEvent ev = + AccessibilityEvent.obtain(AccessibilityEvent.TYPE_VIEW_SCROLLED); + ev.getText().add(getCurrentPageDescription()); + sendAccessibilityEventUnchecked(ev); + } return true; } return false; @@ -1860,27 +1869,6 @@ public abstract class PagedView extends ViewGroup { } } - @Override - public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) { - // Do not append text content to scroll events they are fired frequently - // and the client has already received another event type with the text. - if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_SCROLLED) { - super.dispatchPopulateAccessibilityEvent(event); - } - - onPopulateAccessibilityEvent(event); - return false; - } - - @Override - public void onPopulateAccessibilityEvent(AccessibilityEvent event) { - super.onPopulateAccessibilityEvent(event); - - if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) { - event.getText().add(getCurrentPageDescription()); - } - } - protected String getCurrentPageDescription() { int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage; return String.format(mContext.getString(R.string.default_scroll_format), |