mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
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:
@@ -424,6 +424,13 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
return computeScrollHelper(true);
|
||||
}
|
||||
|
||||
protected void announcePageForAccessibility() {
|
||||
if (isAccessibilityEnabled(getContext())) {
|
||||
// Notify the user when the page changes
|
||||
announceForAccessibility(getCurrentPageDescription());
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean computeScrollHelper(boolean shouldInvalidate) {
|
||||
if (mScroller.computeScrollOffset()) {
|
||||
// Don't bother scrolling if the page does not need to be moved
|
||||
@@ -452,9 +459,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
pageEndTransition();
|
||||
}
|
||||
|
||||
if (isAccessibilityEnabled(getContext())) {
|
||||
// Notify the user when the page changes
|
||||
announceForAccessibility(getCurrentPageDescription());
|
||||
if (canAnnouncePageDescription()) {
|
||||
announcePageForAccessibility();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -1535,6 +1541,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
|
||||
return getCurrentPageDescription();
|
||||
}
|
||||
|
||||
protected boolean canAnnouncePageDescription() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getCurrentPageDescription() {
|
||||
return getContext().getString(R.string.default_scroll_format,
|
||||
getNextPage() + 1, getChildCount());
|
||||
|
||||
Reference in New Issue
Block a user