From 6190fbff58d847bb2759c928966677df304ba371 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Wed, 17 Jul 2024 09:40:13 +0200 Subject: android: Handle cursor keys In Android Viewer, forward the left/right/up/down keys as such by adding the corresponding mapping to `LOKitTileProvider#getKeyCode`. This allows navigating through the document using those keys e.g. on a hardware keyboard. This addresses this comment from a Google Play Review: > Editing, the cursor doesn't respond to the cursor keys Change-Id: I688e5d0cc1db4f9315f9c9cb2139c22117a210e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170605 Tested-by: Jenkins Reviewed-by: Michael Weghorn (cherry picked from commit 053d9feec432ca4dff4d85593d9cad0d975388b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170561 Reviewed-by: Adolfo Jayme Barrientos --- android/source/src/java/org/libreoffice/LOKitTileProvider.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'android') diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index c8a055206dd0..bbdc9456cf4c 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -11,7 +11,6 @@ package org.libreoffice; import android.content.Context; import android.graphics.Bitmap; import android.graphics.PointF; -import android.os.Build; import android.print.PrintAttributes; import android.print.PrintDocumentAdapter; import android.print.PrintManager; @@ -630,6 +629,14 @@ class LOKitTileProvider implements TileProvider { switch (keyEvent.getKeyCode()) { case KeyEvent.KEYCODE_DEL: return com.sun.star.awt.Key.BACKSPACE; + case KeyEvent.KEYCODE_DPAD_DOWN: + return com.sun.star.awt.Key.DOWN; + case KeyEvent.KEYCODE_DPAD_LEFT: + return com.sun.star.awt.Key.LEFT; + case KeyEvent.KEYCODE_DPAD_RIGHT: + return com.sun.star.awt.Key.RIGHT; + case KeyEvent.KEYCODE_DPAD_UP: + return com.sun.star.awt.Key.UP; case KeyEvent.KEYCODE_ENTER: return com.sun.star.awt.Key.RETURN; } -- cgit