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

Commit d8053875 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix bug when the hover icon is on the edges, it continues to have the...

Merge "Fix bug when the hover icon is on the edges, it continues to have the hover icon inside the task bounds." into main
parents b24183a3 2ff07513
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -74,8 +74,7 @@ public final class DragResizeWindowGeometry {
        mFineTaskCorners = new TaskCorners(mTaskSize, fineCornerSize, disabledEdge);

        // Save touch areas for each edge.
        mTaskEdges = new TaskEdges(mTaskSize, mResizeHandleEdgeOutset, mResizeHandleEdgeInset,
                mDisabledEdge);
        mTaskEdges = new TaskEdges(mTaskSize, mResizeHandleEdgeOutset, mDisabledEdge);
    }

    /**
@@ -459,7 +458,7 @@ public final class DragResizeWindowGeometry {
        private final @NonNull DisabledEdge mDisabledEdge;

        private TaskEdges(@NonNull Size taskSize, int resizeHandleThickness,
                int resizeHandleEdgeInset, DisabledEdge disabledEdge) {
                DisabledEdge disabledEdge) {
            // Save touch areas for each edge.
            mDisabledEdge = disabledEdge;
            // Save touch areas for each edge.
@@ -471,16 +470,16 @@ public final class DragResizeWindowGeometry {
            mLeftEdgeBounds = new Rect(
                    -resizeHandleThickness,
                    0,
                    resizeHandleEdgeInset,
                    resizeHandleThickness,
                    taskSize.getHeight());
            mRightEdgeBounds = new Rect(
                    taskSize.getWidth() - resizeHandleEdgeInset,
                    taskSize.getWidth() - resizeHandleThickness,
                    0,
                    taskSize.getWidth() + resizeHandleThickness,
                    taskSize.getHeight());
            mBottomEdgeBounds = new Rect(
                    -resizeHandleThickness,
                    taskSize.getHeight() - resizeHandleEdgeInset,
                    taskSize.getHeight() - resizeHandleThickness,
                    taskSize.getWidth() + resizeHandleThickness,
                    taskSize.getHeight() + resizeHandleThickness);

+9 −4
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public class DragResizeWindowGeometryTests extends ShellTestCase {
    private static final int EDGE_RESIZE_HANDLE_INSET = 4;
    private static final int FINE_CORNER_SIZE = EDGE_RESIZE_THICKNESS * 2 + 10;
    private static final int LARGE_CORNER_SIZE = FINE_CORNER_SIZE + 10;
    private static final int SMALL_OFFSET = 10;
    private static final DragResizeWindowGeometry GEOMETRY = new DragResizeWindowGeometry(
            TASK_CORNER_RADIUS, TASK_SIZE, EDGE_RESIZE_THICKNESS, EDGE_RESIZE_HANDLE_INSET,
            FINE_CORNER_SIZE, LARGE_CORNER_SIZE, DragResizeWindowGeometry.DisabledEdge.NONE);
@@ -147,15 +148,19 @@ public class DragResizeWindowGeometryTests extends ShellTestCase {
        assertThat(region.contains(point.x + EDGE_RESIZE_THICKNESS, point.y)).isTrue();
        assertThat(region.contains(point.x - EDGE_RESIZE_THICKNESS, point.y)).isTrue();
        // Vertically along the edge is not contained.
        assertThat(region.contains(point.x, point.y - EDGE_RESIZE_THICKNESS)).isFalse();
        assertThat(region.contains(point.x, point.y + EDGE_RESIZE_THICKNESS + 10)).isFalse();
        assertThat(
                region.contains(point.x, point.y - EDGE_RESIZE_THICKNESS - SMALL_OFFSET)).isFalse();
        assertThat(
                region.contains(point.x, point.y + EDGE_RESIZE_THICKNESS + SMALL_OFFSET)).isFalse();
    }

    private static void verifyVerticalEdge(@NonNull Region region, @NonNull Point point) {
        assertThat(region.contains(point.x, point.y)).isTrue();
        // Horizontally along the edge is not contained.
        assertThat(region.contains(point.x + EDGE_RESIZE_THICKNESS, point.y)).isFalse();
        assertThat(region.contains(point.x - EDGE_RESIZE_THICKNESS, point.y)).isFalse();
        assertThat(
                region.contains(point.x + EDGE_RESIZE_THICKNESS + SMALL_OFFSET, point.y)).isFalse();
        assertThat(
                region.contains(point.x - EDGE_RESIZE_THICKNESS - SMALL_OFFSET, point.y)).isFalse();
        // Vertically along the edge is contained.
        assertThat(region.contains(point.x, point.y - EDGE_RESIZE_THICKNESS)).isTrue();
        assertThat(region.contains(point.x, point.y + EDGE_RESIZE_THICKNESS)).isTrue();