Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fff5f01 authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by Android (Google) Code Review
Browse files

Merge "Make partially visible widget pages not important for accessibility." into jb-mr1-dev

parents 872965bb a90a18db
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -180,6 +180,22 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
        }
    }

    private void updateWidgetFramesImportantForAccessibility() {
        final int pageCount = getPageCount();
        for (int i = 0; i < pageCount; i++) {
            KeyguardWidgetFrame frame = getWidgetPageAt(i);
            updateWidgetFrameImportantForAccessibility(frame);
        }
    }

    private void updateWidgetFrameImportantForAccessibility(KeyguardWidgetFrame frame) {
        if (frame.getContentAlpha() <= 0) {
            frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
        } else {
            frame.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
        }
    }

    private void userActivity() {
        if (mCallbacks != null) {
            mCallbacks.onUserActivityTimeoutChanged();
@@ -312,6 +328,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
                content.getContentDescription());
            frame.setContentDescription(contentDescription);
        }
        updateWidgetFrameImportantForAccessibility(frame);
    }

    /**
@@ -558,6 +575,12 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
        animateOutlinesAndSidePages(true, -1);
    }

    @Override
    void setCurrentPage(int currentPage) {
        super.setCurrentPage(currentPage);
        updateWidgetFramesImportantForAccessibility();
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
@@ -669,6 +692,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
                    }
                    mWidgetToResetAfterFadeOut = -1;
                }
                updateWidgetFramesImportantForAccessibility();
            }
        });
        mChildrenOutlineFadeAnimation.start();