This logs when the selected text is changed e.g. by typing on
the hard or soft keyboard.
Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I82b3b2157856c607d08a82c0a3d9fb938af4c06a
- Fix count with selection start index inside a word
- Properly handle whitespace characters
- Set the model version tag
Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Manually tested that logs are correct. Will follow up with automated tests.
Change-Id: Ib73b52ebce999f2cb6e5734e556cd09e47c89a29
Layout::getSelection will sometimes give us rectangles which are
redundant - specifically, those with dimension zero and those that may
already be contained in some other rectangles. In order to keep the
smart select animation simple and in line with what the user would
visually expect, we remove these rectangles.
Test: manual - verify smart select animation over multiple lines
Test: bit FrameworksCoreTests:android.widget.SelectionActionModeHelperTest
Change-Id: Ia4406d9505366245609b44e3ec3743f84820ba0a
TextView#performLongClick() calls View#performLongClick which
calls View#performLongClickInternal() which, if handled, performs
the longpress haptic feedback and returns handled. TextView
looks at this return value and if it is true then makes another
call to perform longpress haptic feedback. Remove the duplicate
call in TextView as the one in the parent (View) is sufficient.
Bug: 65397911
Test: manual
Change-Id: Ic73a86637486d5382b63f1c1b37783e238452841
Copying a remoteView will not longer mutate the original views
Simplifying bitmap cache and memory measurement for remoteViews. A
remoteView tree will have a common bitmapCache, and hence ite memory
estimate would be same as the total bytes allocated to all the bitmaps.
Bug: 62629395
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I7ea6ce476f19f425431ed01ef22cc97764626230
In order to properly perform the smart select animation on right-to-left
and mixed text, we need the information about the direction of the text
that is present below the selection rectangle.
Test: manual - verify selection still works and that the generated
directions match the directions of the text on the screen
Test: bit FrameworksCoreTests:android.text.LayoutTest
Change-Id: I564ee2db59ab583c9bff807ad0d0dfeacaf1386f
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