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

Commit d842e690 authored by Ben Kwa's avatar Ben Kwa Committed by android-build-merger
Browse files

Merge "Handle spacebar events." into nyc-dev

am: 166639ae

* commit '166639ae':
  Handle spacebar events.
parents 0846a991 166639ae
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -52,6 +52,18 @@ class FocusManager implements View.OnFocusChangeListener {
     * @return Whether the event was handled.
     * @return Whether the event was handled.
     */
     */
    public boolean handleKey(DocumentHolder doc, int keyCode, KeyEvent event) {
    public boolean handleKey(DocumentHolder doc, int keyCode, KeyEvent event) {
        boolean extendSelection = false;
        // Translate space/shift-space into PgDn/PgUp
        if (keyCode == KeyEvent.KEYCODE_SPACE) {
            if (event.isShiftPressed()) {
                keyCode = KeyEvent.KEYCODE_PAGE_UP;
            } else {
                keyCode = KeyEvent.KEYCODE_PAGE_DOWN;
            }
        } else {
            extendSelection = event.isShiftPressed();
        }

        if (Events.isNavigationKeyCode(keyCode)) {
        if (Events.isNavigationKeyCode(keyCode)) {
            // Find the target item and focus it.
            // Find the target item and focus it.
            int endPos = findTargetPosition(doc.itemView, keyCode, event);
            int endPos = findTargetPosition(doc.itemView, keyCode, event);