diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 8bc38c258e..afb2b94f51 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),