summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tony Mak <tonymak@google.com> 2021-02-03 12:28:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-02-03 12:28:14 +0000
commit2b2f788072a7f1def5edf08089c0be46ae409a4a (patch)
tree3cf1fc93615f8f46c6640b609e575203940bd2e9
parente89f8f970dd455b62db42ceabccaf5d9895bbb85 (diff)
parent90e8a19f7c6d2fe2da69ce113ddae4efa6ef6279 (diff)
Merge "Do not invoke textclassifier when dimissing the selection" into sc-dev
-rw-r--r--core/java/android/widget/Editor.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 26dd5e309fa7..012352d0a0f5 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -1705,15 +1705,23 @@ public class Editor {
}
private void updateFloatingToolbarVisibility(MotionEvent event) {
- if (mTextActionMode != null) {
- switch (event.getActionMasked()) {
- case MotionEvent.ACTION_MOVE:
- hideFloatingToolbar(ActionMode.DEFAULT_HIDE_DURATION);
- break;
- case MotionEvent.ACTION_UP: // fall through
- case MotionEvent.ACTION_CANCEL:
+ if (mTextActionMode == null) {
+ return;
+ }
+ switch (event.getActionMasked()) {
+ case MotionEvent.ACTION_MOVE:
+ hideFloatingToolbar(ActionMode.DEFAULT_HIDE_DURATION);
+ break;
+ case MotionEvent.ACTION_UP: // fall through
+ case MotionEvent.ACTION_CANCEL:
+ final SelectionModifierCursorController selectionController =
+ getSelectionController();
+ final InsertionPointCursorController insertionController = getInsertionController();
+ if ((selectionController != null && selectionController.isCursorBeingModified())
+ || (insertionController != null
+ && insertionController.isCursorBeingModified())) {
showFloatingToolbar();
- }
+ }
}
}