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

Commit 955b9b9c authored by Alex Stetson's avatar Alex Stetson Committed by Android (Google) Code Review
Browse files

Merge "Left align toolbar popup when larger than viewport" into main

parents bd203e0e 06e2d35e
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -435,10 +435,15 @@ public final class LocalFloatingToolbarPopup implements FloatingToolbarPopup {
    private void refreshCoordinatesAndOverflowDirection(Rect contentRectOnScreen) {
        refreshViewPort();

        // Initialize x ensuring that the toolbar isn't rendered behind the nav bar in
        // landscape.
        final int x = Math.clamp(contentRectOnScreen.centerX() - mPopupWindow.getWidth() / 2,
        final int x;
        if (mPopupWindow.getWidth() > mViewPortOnScreen.width()) {
            // Not enough space - prefer to position as far left as possible
            x = mViewPortOnScreen.left;
        } else {
            // Initialize x ensuring that the toolbar isn't rendered behind the system bar insets
            x = Math.clamp(contentRectOnScreen.centerX() - mPopupWindow.getWidth() / 2,
                    mViewPortOnScreen.left, mViewPortOnScreen.right - mPopupWindow.getWidth());
        }

        final int y;