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

Commit 25f6ae27 authored by Longbo Wei's avatar Longbo Wei Committed by Android (Google) Code Review
Browse files

Merge "a11y: Clicking exit to exit scroll mode" into main

parents 791d5515 90fd5c0e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ public class AutoclickScrollPanel {
        setupHoverListenerForButton(mRightButton, DIRECTION_RIGHT);
        setupHoverListenerForButton(mDownButton, DIRECTION_DOWN);
        setupHoverListenerForButton(mExitButton, DIRECTION_EXIT);

       // Add click listener for exit button.
        mExitButton.setOnClickListener(v -> hide());
    }

    /**
+15 −0
Original line number Diff line number Diff line
@@ -335,6 +335,21 @@ public class AutoclickScrollPanelTest {
        assertThat(params.y).isLessThan(cursorY);
    }

    @Test
    public void exitButton_click_hidesPanel() {
        float cursorX = 300;
        float cursorY = 300;

        mScrollPanel.show(cursorX, cursorY);
        assertThat(mScrollPanel.isVisible()).isTrue();

        // Simulate clicking the exit button.
        mExitButton.performClick();

        // Verify the panel is hidden.
        assertThat(mScrollPanel.isVisible()).isFalse();
    }

    // Helper method to simulate a hover event on a view.
    private void triggerHoverEvent(View view, int action) {
        MotionEvent event = MotionEvent.obtain(