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

Verified Commit 37bf6de2 authored by Kshitij's avatar Kshitij Committed by Saalim Quadri
Browse files

fix: Properly track minus one progress and indicator translation

parent 1c4d69a7
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -1435,10 +1435,10 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
        }
    }

    @SuppressLint("NewApi")
    private void firstPageItemHideHotseat() {
        final int index = mScreenOrder.indexOf(FIRST_SCREEN_ID);
        final int scrollDelta = getScrollX() - getScrollForPage(index) -
                getLayoutTransitionOffsetForPage(index);
        final int scrollDelta = getScrollX() - getScrollForPage(index);
        float scrollRange = getScrollForPage(index + 1) - getScrollForPage(index);

        if (scrollRange == 0)
@@ -1449,12 +1449,25 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
        if (progress < 0)
            return;

        int dockHeight = getHotseat().getHeight() + getPageIndicator().getHeight();
        boolean isVerticalBar = mLauncher.getDeviceProfile().isVerticalBarLayout();
        // Dock translation in vertical-bar does not depend on indicator and vice versa
        int dockHeight = getHotseat().getHeight() + (isVerticalBar ? 0 : getPageIndicator().getHeight());
        float dockTranslationY = progress * dockHeight;

        getHotseat().setForcedTranslationY(dockTranslationY);
        if (isVerticalBar) {
            // Initialize with safe height to completely hide indicator (2 * indicator height)
            int safeBottomInset = getPageIndicator().getHeight();
            WindowInsets rootInsets = mLauncher.getWindow().getDecorView().getRootWindowInsets();
            // rootInsets may be null in case launcher restarts and view hasn't yet been inflated
            if (rootInsets != null) {
                safeBottomInset = rootInsets.getInsetsIgnoringVisibility(WindowInsets.Type.systemBars()).bottom;
            }
            float pageIndicatorTranslationY = progress * (getPageIndicator().getHeight() + safeBottomInset);
            ((PageIndicatorDots) getPageIndicator()).setForcedTranslationY(pageIndicatorTranslationY);
        } else {
            ((PageIndicatorDots) getPageIndicator()).setForcedTranslationY(dockTranslationY);

        }
        mLauncher.mBlurLayer.setAlpha(progress);
    }