Instead of the SmartSelectSprite drawing its contents into a View's
ViewOverlay, the SmartSelectSprite can now be drawn on any Canvas. In
order to perform the smart select animation, it is now the TextView that
performs the actual drawing.
Since the TextView can adjust the canvas for its padding and offset,
there is no more need to manually transform the selection rectangles, so
that part can be removed.
Test: manual - verify smart select animation still works
Change-Id: Ibaccf59fd44d5701e6f37d6b4fa97f2b05fd77cc
This field is now being used for new smart selection logging.
See: Icc9d5b542140bdb01b2ad4211048bd83eae2ce83
Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsAccessibilityServiceTestCases:android.accessibilityservice.cts.AccessibilityTextTraversalTest
Change-Id: If1ce8ca038b089500cd7adb9a146330abe909407
TODO: Log typing over selection
Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsAccessibilityServiceTestCases:android.accessibilityservice.cts.AccessibilityTextTraversalTest
Merged-In: Icc9d5b542140bdb01b2ad4211048bd83eae2ce83
Change-Id: Icc9d5b542140bdb01b2ad4211048bd83eae2ce83
TODO: Log typing over selection
Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit
CtsAccessibilityServiceTestCases:android.accessibilityservice.cts.AccessibilityTextTraversalTest
Change-Id: Icc9d5b542140bdb01b2ad4211048bd83eae2ce83
The final step of the smart select animation, drawing the outline of all
the rectangles, was not working properly in cases where the rectangles
would touch or intersect, which we cannot guarantee that they won't.
Instead of the previous implementation, we now rely on Path to create
the outline of the rectangles, making much of the code simpler.
Now the polygon generation should work in the general case, which is one
of the prerequisites in getting the smart select animation to work
properly in multiline scenarios.
Test: manual - test the smart select animation with various rectangle
sets
(100, 100, 500, 500), (300, 300, 700, 700)
(100, 100, 500, 500), (500, 100, 900, 500)
(100, 100, 500, 500), (500, 300, 900, 700)
(100, 100, 500, 500), (300, 300, 700, 500), (200, 500, 400, 700)
Change-Id: I51dd72e18c5efe36df734aa62ab47d57a5946399
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I1c1eb58d863e1196a38fadb15e08ad2fdcff1d4d
The previous solution didn't take into account that the source rectangle
might be at either end of the selection, thus giving it the wrong
direction of CENTER, while it should have been RIGHT or LEFT.
Test: manual - verify that the rectangles expand properly in a smart
select animation when there are multiple rectangles and the source is
not in the center - e.g. a multiline case with the selection starting on
the first line
Change-Id: Id18ab8f9918e74a576503620dae2f7cdd593fb0e
If header view / footer view is added to ListView before setting
adapter, the ListView regards the item count is zero even it has header
/ footer views.
Thus ListView invokes resetList(), and it invokes clearRecycledState() for
header / footer views. But in this method, there is no guarantee the
views has proper layout param.
The CL adds guard to check if the layout param is correct or not. If the
view does not have proepr layout param, it should do nothing because the
view has not been added to the ListView, and the LayoutParam will be
updated when ListView invokes obtainView for the view.
Bug: 65035699
Test: CTS ListViewTest
Change-Id: I4449d4bbcdba8e7cc10ec64d711f937a0f3375ca
In TextView and Switch, version-gate the use of
setUseLineSpacingFromFallbacks() to apps targeting Android P and
later for backward compatibility.
In internal widgets, ImageFloatingTextView and SubtitleView, always
turn it on, since there is no backward compatibility concerns.
Bug: 28963299
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.SwitchTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Change-Id: Icfe4e71ba26bbc6755ba12ddab72e6bf20b3ce25
The builder mostly copies the structure and the logic of
StaticLayout.
We also improve various parts of code and documentation in
StaticLayout's builder.
Bug: 28963299
Test: bit FrameworksCoreTests:android.text.
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Change-Id: I5c4a6e031bd0f41f765a3d85e0b9b7e9be42ad4b
When performing the smart select animation, some of the selection
rectangles may be taller than they are wide (e.g. due to a very large
line-height). Since in these cases we cannot properly round the corners
and the effect looks off, the agreed upon action is to not round the
corners of these selection rectangles at all.
Test: manual - run SmartSelectSprite on a manually constructed set of
rectangles and verify that it behaves correctly
Change-Id: Ifd02005e3d2709736c34f6d07671a4eb7a9557db
The Smart Select animation now expands from the spot the user last
lifted their finger.
In order to achieve this, the last up event coordinates need to be
tracked in Editor.
Since it's possible to trigger Smart Select by having the second of the
two taps outside any of the rectangles, the touch point gets moved into
the nearest rectangle and the animation starts from that point.
Test: manual - try out Smart Select by touching different words at
different points
Test: manual - try to trigger Smart Select with a double tap where the
second tap is outside of the word
Test: bit FrameworksCoreTests:android.widget.SelectionActionModeHelperTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsAccessibilityServiceTestCases:android.accessibilityservice.cts.AccessibilityTextTraversalTest
Change-Id: I96844e8307554b010b476673820f98dae09c0cc3
Since otherwise they would be illegible with the color
tranformation.
Change-Id: I5c1fa085fc3d6f682012c267d489a95fc7073f32
Fixes: 64810767
Test: manual, add decoratedMediaCustomView
Even if their layout still maches, the content was unrecoverably
destroyed, so we can't just reapply it anymore.
Fixes: 62911941
Test: runtest -x packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationInflaterTest.java
Change-Id: I3a50c96484686958570ac5e4949df3ad4b8a421a
Test: manual - built an app that overrides colorControlActivated in it's
theme and tested the Smart Select animation in it
Change-Id: Ia6112e9e1f49b15a56f8f0455cd55bf3df598508
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
Test: manual - trigger smart select in a TextView
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I2b147a9cc4cbb79118bb78d948bac76a63cf4253
Various methods on ArrayAdapter throw exceptions if run on an adapter
created with one of the varargs constructors. This is because those contructors
create an Arrays.ArrayList, which does not allow modification. It is not
worth changing the existing behavior, but it is worth making the behavior
clearer in the docs.
Bug: 63802412 ArrayAdapter crashes when calling clear() directly after constructor
Test: docs-only fix. Verified with unit test that the docs apply correctly to the
newly-documented methods. Built the docs target successfully.
Change-Id: I75ae233879cc7db10853f93d78625a00675594b2
Previously, measures all paragraph for deciding view width.
However, in case AT_MOST measurment, we can stop calculating measure if
the measured paragraph already exceeds the upper limit.
Bug: 64389125
Test: bit CtsWidgetTestCases:*
Test: CorePerfTest. Here is a result before and after this patch.
Before:
INSTRUMENTATION_STATUS: measure_AtMost_median=50332114
INSTRUMENTATION_STATUS: measure_Exactly_median=28276317
INSTRUMENTATION_STATUS: measure_Unspecified_median=50193036
After:
INSTRUMENTATION_STATUS: measure_AtMost_median=28475187
INSTRUMENTATION_STATUS: measure_Exactly_median=26944710
INSTRUMENTATION_STATUS: measure_Unspecified_median=50880088
Change-Id: I2a39eb39817a8f845c4fa2e174a905a2d057096e
Bug 64359848
Monkey found a divide-by-zero error caused by the width not set
when focus was changed before layout. This CL just ensures that
there is no divide by zero by selecting the first row/column.
Test: manually launched Date Picker and it didn't crash
Change-Id: Id6dd12cd20b052af71ab980c8a694020ea679e7c