diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-05-16 16:33:57 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2018-05-16 16:37:18 +0200 |
commit | 912fd109a3857b3a6dae02f65fd4b508ed9c8a11 (patch) | |
tree | b17c27366db453e4d132f6fc1e717f4a230959d7 /android | |
parent | bf07813f6843f257d7de1cc599ecc9b4d310b3f7 (diff) |
android janitor... convert chained ifs to switch statement
Change-Id: I9929bd077a33349a6e57c3a427df7e77b3007c88
Diffstat (limited to 'android')
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; } } |