Don't run Smart Select Animation on multiple lines
This behavior is currently broken due to the format of the rectangles
returned by Layout::getSelection. Let's disable the animation in
multiline scenarios until this behavior is fixed.
Test: manual - enable Smart Select flag and test over single and
multiple lines
Change-Id: Id0c49a0d69a8f2bdb449cfc8f0ed43e529f41cc1
diff --git a/core/java/android/widget/SelectionActionModeHelper.java b/core/java/android/widget/SelectionActionModeHelper.java
index 240271e..18eeab3 100644
--- a/core/java/android/widget/SelectionActionModeHelper.java
+++ b/core/java/android/widget/SelectionActionModeHelper.java
@@ -201,6 +201,17 @@
convertSelectionToRectangles(layout, result.mStart, result.mEnd);
/*
+ * Do not run the Smart Select animation when there are multiple lines involved, as this
+ * behavior is currently broken.
+ *
+ * TODO fix Smart Select Animation when the selection spans multiple lines
+ */
+ if (selectionRectangles.size() != 1) {
+ onAnimationEndCallback.run();
+ return;
+ }
+
+ /*
* TODO Figure out a more robust approach for this
* We have to translate all the generated rectangles by the top-left padding of the
* TextView because the padding influences the rendering of the ViewOverlay, but is not