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

Commit 5f7143a7 authored by Annie Lin's avatar Annie Lin Committed by Android (Google) Code Review
Browse files

Merge "Use screen-based coordinates for AE interactive divider." into main

parents 78a10b5e cd3c0b27
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -514,7 +514,12 @@ class DividerPresenter implements View.OnTouchListener {
                        mProperties.mDividerAttributes, mProperties.mIsVerticalSplit,
                        calculateMinPosition(), calculateMaxPosition());
                mRenderer.setDividerPosition(mDividerPosition);
                switch (event.getAction()) {

                // Convert to use screen-based coordinates to prevent lost track of motion events
                // while moving divider bar and calculating dragging velocity.
                event.setLocation(event.getRawX(), event.getRawY());
                final int action = event.getAction() & MotionEvent.ACTION_MASK;
                switch (action) {
                    case MotionEvent.ACTION_DOWN:
                        onStartDragging(event);
                        break;
@@ -713,9 +718,9 @@ class DividerPresenter implements View.OnTouchListener {
            return snap(dividerPosition, possiblePositions);
        }
        if (velocity < 0) {
            return 0;
            return minPosition;
        } else {
            return fullyExpandedPosition;
            return maxPosition;
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ public class DividerPresenterTest {

        // Divider position is greater than minPosition and the velocity is enough for fling
        assertEquals(
                0, // Closed position
                30, // minPosition
                DividerPresenter.dividerPositionWithDraggingToFullscreenAllowed(
                        50 /* dividerPosition */,
                        30 /* minPosition */,
@@ -731,7 +731,7 @@ public class DividerPresenterTest {

        // Divider position is less than maxPosition and the velocity is enough for fling
        assertEquals(
                1200, // Fully expanded position
                900, // maxPosition
                DividerPresenter.dividerPositionWithDraggingToFullscreenAllowed(
                        800 /* dividerPosition */,
                        30 /* minPosition */,