Avoid duplicate accessibility announcement upon switching to -1st page
Since -1st window already has accessible description, no need to announce "Page X of Y" for it. Bug: 74210311 Test: Manual Change-Id: I5cbfd763778b5f7049be732a750df4501b5419e0
This commit is contained in:
1 parent
ac6a6b6bf7
commit
2c430b34cb
2 files changed
+30
-6
No files matched your search
@@ -1143,30 +1143,37 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
* The overlay scroll is being controlled locally, just update our overlay effect
|
||||
*/
|
||||
public void onOverlayScrollChanged(float scroll) {
|
||||
|
||||
if (Float.compare(scroll, 1f) == 0) {
|
||||
if (!mOverlayShown) {
|
||||
mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
|
||||
Action.Direction.LEFT, ContainerType.WORKSPACE, 0);
|
||||
}
|
||||
mOverlayShown = true;
|
||||
// Not announcing the overlay page for accessibility since it announces itself.
|
||||
} else if (Float.compare(scroll, 0f) == 0) {
|
||||
if (mOverlayShown) {
|
||||
mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
|
||||
Action.Direction.RIGHT, ContainerType.WORKSPACE, -1);
|
||||
} else if (Float.compare(mOverlayTranslation, 0f) != 0) {
|
||||
// When arriving to 0 overscroll from non-zero overscroll, announce page for
|
||||
// accessibility since default announcements were disabled while in overscroll
|
||||
// state.
|
||||
// Not doing this if mOverlayShown because in that case the accessibility service
|
||||
// will announce the launcher window description upon regaining focus after
|
||||
// switching from the overlay screen.
|
||||
announcePageForAccessibility();
|
||||
}
|
||||
mOverlayShown = false;
|
||||
tryRunOverlayCallback();
|
||||
}
|
||||
|
||||
float offset = 0f;
|
||||
float slip = 0f;
|
||||
|
||||
scroll = Math.max(scroll - offset, 0);
|
||||
scroll = Math.min(1, scroll / (1 - offset));
|
||||
|
||||
float alpha = 1 - Interpolators.DEACCEL_3.getInterpolation(scroll);
|
||||
float transX = mLauncher.getDragLayer().getMeasuredWidth() * scroll;
|
||||
transX *= 1 - slip;
|
||||
|
||||
if (mIsRtl) {
|
||||
transX = -transX;
|
||||
@@ -3344,6 +3351,13 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
? mLauncher.getDeviceProfile().widthPx : getMeasuredWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAnnouncePageDescription() {
|
||||
// Disable announcements while overscrolling potentially to overlay screen because if we end
|
||||
// up on the overlay screen, it will take care of announcing itself.
|
||||
return Float.compare(mOverlayTranslation, 0f) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getCurrentPageDescription() {
|
||||
int page = (mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage;
|
||||
|
||||
Reference in new issue
Block a user