[Libreoffice-commits] core.git: android/source

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 6 15:47:37 UTC 2020


 android/source/src/java/org/libreoffice/InvalidationHandler.java |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 23c379a8d6c54264c370e2dc5648fa5c5d34dff0
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Mar 6 10:08:35 2020 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Mar 6 16:46:57 2020 +0100

    android: Hide cursor again when selection was done due to search
    
    ... in which case the handling of the previous three callbacks makes the
    cursor (that can be used to do a manual selection) shown in addition
    to the selection rectangle.
    
    As a side note, the cursor previously shown in Calc was incorrect anyway
    when doing a search, it was always at the top-left, and spanning nothing
    (instead of the actual cell that was highlighted by the "selection rectangle").
    
    In a quick test, this worked as expected in Writer with editing
    capability enabled:
    
    * when doing a search, the search result was highlighted, but no cursor
      shown
    * when long-tapping on a word, that word was highlighted and the cursor
      was shown, allowing to adapt text selection as needed (e.g. to do
      copy & paste in the next step).
    
    Since the cursor is shown by handling the other callbacks, and it is just hidden
    again, the cursor can still show up for a short moment before
    being hidden again, but I see no easy way to avoid this, since
    there seems to be no easy way to determine in the
    'CALLBACK_TEXT_SELECTION{,_START,_END}' handling whether this
    was called due to a search or some other event (like long-tapping on
    a word in Writer with editing feature enabled).
    
    Change-Id: I0ae85cd10b91582b2bd8ec9891bae5c832161710
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90093
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/android/source/src/java/org/libreoffice/InvalidationHandler.java b/android/source/src/java/org/libreoffice/InvalidationHandler.java
index 473d8bcb3625..e79fe12f24d4 100644
--- a/android/source/src/java/org/libreoffice/InvalidationHandler.java
+++ b/android/source/src/java/org/libreoffice/InvalidationHandler.java
@@ -97,6 +97,14 @@ public class InvalidationHandler implements Document.MessageCallback, Office.Mes
                 break;
             case Document.CALLBACK_SEARCH_RESULT_SELECTION:
                 searchResultSelection(payload);
+                // when doing a search, CALLBACK_SEARCH_RESULT_SELECTION is called in addition
+                // to the CALLBACK_TEXT_SELECTION{,_START,_END} callbacks and the handling of
+                // the previous 3 makes the cursor shown in addition to the selection rectangle,
+                // so hide the cursor again to just show the selection rectangle for the search result
+                mDocumentOverlay.hideCursor();
+                mDocumentOverlay.hideHandle(SelectionHandle.HandleType.MIDDLE);
+                mDocumentOverlay.hideHandle(SelectionHandle.HandleType.START);
+                mDocumentOverlay.hideHandle(SelectionHandle.HandleType.END);
                 break;
             case Document.CALLBACK_SEARCH_NOT_FOUND:
                 Log.d(LOGTAG, "LOK_CALLBACK: Search not found.");


More information about the Libreoffice-commits mailing list