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

Commit 77b3eb0a authored by Andras Kloczl's avatar Andras Kloczl
Browse files

Fix two panel accessibility issues

When two panel home was enabled in Launcher the items on
the left panel weren't able to get selected while on Talkback
because of an incorrect calculation in getScrollProgress.
Also the user was unable to jump to other workspaces by doing
simple one finger swipes because the page jump count was
only 1.

Test: manual
Bug: 174464170
Change-Id: I6cfe39b5059e8e7e7a32c9b0d372c658e796c3e8
parent e23dd92a
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -1087,19 +1087,18 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou

    protected float getScrollProgress(int screenCenter, View v, int page) {
        final int halfScreenSize = getMeasuredWidth() / 2;

        int delta = screenCenter - (getScrollForPage(page) + halfScreenSize);
        int count = getChildCount();

        final int totalDistance;
        int panelCount = getPanelCount();
        int pageCount = getChildCount();

        int adjacentPage = page + 1;
        int adjacentPage = page + panelCount;
        if ((delta < 0 && !mIsRtl) || (delta > 0 && mIsRtl)) {
            adjacentPage = page - 1;
            adjacentPage = page - panelCount;
        }

        if (adjacentPage < 0 || adjacentPage > count - 1) {
            totalDistance = v.getMeasuredWidth() + mPageSpacing;
        final int totalDistance;
        if (adjacentPage < 0 || adjacentPage > pageCount - 1) {
            totalDistance = (v.getMeasuredWidth() + mPageSpacing) * panelCount;
        } else {
            totalDistance = Math.abs(getScrollForPage(adjacentPage) - getScrollForPage(page));
        }
@@ -1649,7 +1648,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou

    public boolean scrollLeft() {
        if (getNextPage() > 0) {
            snapToPage(getNextPage() - 1);
            snapToPage(getNextPage() - getPanelCount());
            return true;
        }
        return mAllowOverScroll;
@@ -1657,7 +1656,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou

    public boolean scrollRight() {
        if (getNextPage() < getChildCount() - 1) {
            snapToPage(getNextPage() + 1);
            snapToPage(getNextPage() + getPanelCount());
            return true;
        }
        return mAllowOverScroll;