diff options
3 files changed, 36 insertions, 24 deletions
diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java index 92e81febeb7c..26cf7abfb9d5 100644 --- a/android/source/src/java/org/libreoffice/InvalidationHandler.java +++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java @@ -616,14 +616,18 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes * Handle a transition to OverlayState.TRANSITION state. */ private void handleTransitionState(OverlayState previous) { - if (previous == OverlayState.SELECTION) { - mDocumentOverlay.hideHandle(SelectionHandle.HandleType.START); - mDocumentOverlay.hideHandle(SelectionHandle.HandleType.END); - mDocumentOverlay.hideSelections(); - } else if (previous == OverlayState.CURSOR) { - mDocumentOverlay.hideHandle(SelectionHandle.HandleType.MIDDLE); - } else if (previous == OverlayState.GRAPHIC_SELECTION) { - mDocumentOverlay.hideGraphicSelection(); + switch (previous) { + case SELECTION: + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.START); + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.END); + mDocumentOverlay.hideSelections(); + break; + case CURSOR: + mDocumentOverlay.hideHandle(SelectionHandle.HandleType.MIDDLE); + break; + case GRAPHIC_SELECTION: + mDocumentOverlay.hideGraphicSelection(); + break; } } diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index 92303f588c2f..d9a617654b17 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -392,12 +392,16 @@ class LOKitThread extends Thread { * Request a change of the handle position. */ private void changeHandlePosition(SelectionHandle.HandleType handleType, PointF documentCoordinate) { - if (handleType == SelectionHandle.HandleType.MIDDLE) { - mTileProvider.setTextSelectionReset(documentCoordinate); - } else if (handleType == SelectionHandle.HandleType.START) { - mTileProvider.setTextSelectionStart(documentCoordinate); - } else if (handleType == SelectionHandle.HandleType.END) { - mTileProvider.setTextSelectionEnd(documentCoordinate); + switch (handleType) { + case MIDDLE: + mTileProvider.setTextSelectionReset(documentCoordinate); + break; + case START: + mTileProvider.setTextSelectionStart(documentCoordinate); + break; + case END: + mTileProvider.setTextSelectionEnd(documentCoordinate); + break; } } diff --git a/android/source/src/java/org/libreoffice/LOKitTileProvider.java b/android/source/src/java/org/libreoffice/LOKitTileProvider.java index bf2c2601e7cd..f094e49f5a8f 100644 --- a/android/source/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/source/src/java/org/libreoffice/LOKitTileProvider.java @@ -540,16 +540,20 @@ class LOKitTileProvider implements TileProvider { */ @Override public void sendKeyEvent(KeyEvent keyEvent) { - if (keyEvent.getAction() == KeyEvent.ACTION_MULTIPLE) { - String keyString = keyEvent.getCharacters(); - for (int i = 0; i < keyString.length(); i++) { - int codePoint = keyString.codePointAt(i); - mDocument.postKeyEvent(Document.KEY_EVENT_PRESS, codePoint, getKeyCode(keyEvent)); - } - } else if (keyEvent.getAction() == KeyEvent.ACTION_DOWN) { - mDocument.postKeyEvent(Document.KEY_EVENT_PRESS, getCharCode(keyEvent), getKeyCode(keyEvent)); - } else if (keyEvent.getAction() == KeyEvent.ACTION_UP) { - mDocument.postKeyEvent(Document.KEY_EVENT_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); + switch (keyEvent.getAction()) { + case KeyEvent.ACTION_MULTIPLE: + String keyString = keyEvent.getCharacters(); + for (int i = 0; i < keyString.length(); i++) { + int codePoint = keyString.codePointAt(i); + mDocument.postKeyEvent(Document.KEY_EVENT_PRESS, codePoint, getKeyCode(keyEvent)); + } + break; + case KeyEvent.ACTION_DOWN: + mDocument.postKeyEvent(Document.KEY_EVENT_PRESS, getCharCode(keyEvent), getKeyCode(keyEvent)); + break; + case KeyEvent.ACTION_UP: + mDocument.postKeyEvent(Document.KEY_EVENT_RELEASE, getCharCode(keyEvent), getKeyCode(keyEvent)); + break; } } |