Merge "Mark off-screen pages as unimportant for accessibility" into ub-launcher3-dorval-polish

This commit is contained in:
TreeHugger Robot
2017-07-11 01:01:26 +00:00
committed by Android (Google) Code Review
+9 -4
View File
@@ -1632,16 +1632,21 @@ public class Workspace extends PagedView
}
private void updatePageAlphaValues() {
if (mWorkspaceFadeInAdjacentScreens &&
!workspaceInModalState() &&
!mIsSwitchingState) {
if (!workspaceInModalState() && !mIsSwitchingState) {
int screenCenter = getScrollX() + getViewportWidth() / 2;
for (int i = numCustomPages(); i < getChildCount(); i++) {
CellLayout child = (CellLayout) getChildAt(i);
if (child != null) {
float scrollProgress = getScrollProgress(screenCenter, child, i);
float alpha = 1 - Math.abs(scrollProgress);
child.getShortcutsAndWidgets().setAlpha(alpha);
if (mWorkspaceFadeInAdjacentScreens) {
child.getShortcutsAndWidgets().setAlpha(alpha);
} else {
// Pages that are off-screen aren't important for accessibility.
child.getShortcutsAndWidgets().setImportantForAccessibility(
alpha > 0 ? IMPORTANT_FOR_ACCESSIBILITY_AUTO
: IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
}
}
}
}