diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2020-03-06 10:08:35 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2020-03-06 16:46:57 +0100 |
commit | 23c379a8d6c54264c370e2dc5648fa5c5d34dff0 (patch) | |
tree | db87652bbc65e5132d468461c11bc4e679ab9fac /android | |
parent | 8432df8bd8368b7b3d502e025fdae7d2cad06767 (diff) |
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@posteo.de>
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/libreoffice/InvalidationHandler.java | 8 |
1 files changed, 8 insertions, 0 deletions
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."); |