Commit Graph

7371 Commits

Author SHA1 Message Date
Abodunrinwa Toki
78940eb859 Log the "change selected text" gesture.
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
2017-09-12 13:53:04 +01:00
TreeHugger Robot
33e9e7d5e6 Merge "Fix smart selection logging bugs." 2017-09-12 11:00:04 +00:00
Petar Šegina
c975213ddb Merge "Enable smart select animation for multiline scenarios" 2017-09-12 10:24:35 +00:00
Petar Šegina
02b345725b Merge "Filter out empty and unnecessary rectangles" 2017-09-12 10:23:36 +00:00
Evan Rosky
a0cff8b547 Merge "Fixed some small keyboard nav bugs (TabHost, directional focus)" into oc-mr1-dev am: c8b91ecbae
am: 2e7e7a9960

Change-Id: I4843d0b8409909d9b0c1af2950321918adc722bb
2017-09-11 21:24:01 +00:00
Evan Rosky
c8b91ecbae Merge "Fixed some small keyboard nav bugs (TabHost, directional focus)" into oc-mr1-dev 2017-09-11 20:25:50 +00:00
Sunny Goyal
f4b3cbc273 Merge "Adding a copy constructor for RemoteViews" 2017-09-11 19:40:58 +00:00
Andrei Stingaceanu
160d23ece3 Merge "TextView longpress 2 haptic feedback fix" into oc-mr1-dev am: 04b6095082
am: ddb8ced959

Change-Id: Id1ebf69c0f3c94f5c505c2bbe2f2dc52cb342fbf
2017-09-11 17:55:39 +00:00
Abodunrinwa Toki
d62a86e64c Fix smart selection logging bugs.
- 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
2017-09-11 18:23:44 +01:00
Petar Šegina
ba1b8566e4 Filter out empty and unnecessary rectangles
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
2017-09-11 15:41:12 +01:00
Petar Šegina
9b5b70cf20 Enable smart select animation for multiline scenarios
Test: manual - verify that smart select works when the selection spans
multiple lines

Change-Id: I7a8113559560dc4657c36c66c6059a44d03bf1ae
2017-09-11 15:38:22 +01:00
Andrei Stingaceanu
4303f22535 TextView longpress 2 haptic feedback fix
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
2017-09-08 11:18:56 +00:00
TreeHugger Robot
5b730ba2a0 Merge "Emit text direction with selection rectangle" 2017-09-07 13:02:22 +00:00
Sunny Goyal
56333a872a Adding a copy constructor for RemoteViews
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
2017-09-06 08:54:33 -07:00
Petar Šegina
b92c539232 Emit text direction with selection rectangle
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
2017-09-06 15:58:38 +01:00
Petar Šegina
5ab7bb242e Draw SmartSelectSprite in TextView
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
2017-09-06 14:26:28 +01:00
Abodunrinwa Toki
7c5df649d7 Merge "Delete old TEXT_SELECTION_MENU_ITEM_ASSIST logs." into oc-mr1-dev am: f28b8a8de3
am: 48063322b4

Change-Id: I23f8204732f1f166aacf10d5d147bd3f21025c6b
2017-09-05 16:51:19 +00:00
Abodunrinwa Toki
fadd4288df Delete old TEXT_SELECTION_MENU_ITEM_ASSIST logs.
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
2017-09-05 14:19:52 +01:00
Abodunrinwa Toki
5ddd3ed855 TextView text selection interaction logging.
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
2017-09-04 20:47:40 +01:00
Abodunrinwa Toki
57ec6ea1bb TextView text selection interaction logging.
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
2017-09-04 20:40:07 +01:00
Petar Šegina
aee97ac902 Improve and simplify final polygon drawing
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
2017-09-01 11:57:37 +01:00
TreeHugger Robot
95fc70bcec Merge "Changing RemoteViews to using MethodHandles instead of relection" 2017-08-31 20:11:00 +00:00
TreeHugger Robot
25706748aa Merge "Improve rectangle direction generation" 2017-08-31 18:05:23 +00:00
Sunny Goyal
271e32270b Changing RemoteViews to using MethodHandles instead of relection
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I1c1eb58d863e1196a38fadb15e08ad2fdcff1d4d
2017-08-31 17:35:13 +00:00
Petar Šegina
7272925026 Improve rectangle direction generation
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
2017-08-31 17:17:00 +01:00
Petar Šegina
0d37b1a71d Rename roundPercentage to roundRatio
Test: manual - verify smart select animation still works
Change-Id: Ic63236a47563b2daef57eeb52dd4fdbbb2cb1780
2017-08-31 15:03:18 +01:00
TreeHugger Robot
119ce2e2b6 Merge "Replace manual insetting with .inset()" 2017-08-31 13:27:59 +00:00
Petar Šegina
2dff78610a Replace manual insetting with .inset()
Test: manual - verify smart selection animation still works
Change-Id: Iea13ec8962777863121f49f47a13425bb0cc7d42
2017-08-31 12:13:12 +01:00
Petar Šegina
bd54bcbcfb Merge "Do not round corners on tall selection rectangles" 2017-08-31 11:05:10 +00:00
Daichi Hirono
b890523f4b Check LayoutParam before clearing recycled state.
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
2017-08-28 13:26:38 +09:00
Roozbeh Pournader
2be7eff3a4 Merge "Use fallback-based line spacing in TextView etc" 2017-08-24 19:24:06 +00:00
Roozbeh Pournader
612e67323f Merge "Add a builder for DynamicLayout and switch TextView to it" 2017-08-24 17:39:14 +00:00
Roozbeh Pournader
5caf5a690f Use fallback-based line spacing in TextView etc
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
2017-08-23 17:41:06 -07:00
Roozbeh Pournader
22a167cac8 Add a builder for DynamicLayout and switch TextView to it
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
2017-08-23 15:05:06 -07:00
Petar Šegina
29e59d8d74 Do not round corners on tall selection rectangles
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
2017-08-23 20:04:08 +01:00
Petar Šegina
91df3f9e7c Expand the animation from the user's last touch point
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
2017-08-23 19:20:12 +01:00
Selim Cinek
b481c010e6 Merge "Transforming all texts of decorated media custom views" into oc-mr1-dev am: 60a09546c0
am: 0c8a132ea3

Change-Id: Ie7e15d7c4010c0e3cbf0081a1a4084767c83b1fa
2017-08-23 16:23:40 +00:00
Selim Cinek
87c3153dcd Transforming all texts of decorated media custom views
Since otherwise they would be illegible with the color
tranformation.

Change-Id: I5c1fa085fc3d6f682012c267d489a95fc7073f32
Fixes: 64810767
Test: manual, add decoratedMediaCustomView
2017-08-23 02:30:14 +00:00
Selim Cinek
ef89f578f2 Merge "Fixed a bug with decorated custom views" into oc-mr1-dev am: 9d41e8cd47
am: a7ea41c7d7

Change-Id: I91899094a4798d83b8e2e24b41d5f11a3a9bb045
2017-08-23 00:06:29 +00:00
TreeHugger Robot
9d41e8cd47 Merge "Fixed a bug with decorated custom views" into oc-mr1-dev 2017-08-22 22:48:14 +00:00
Selim Cinek
fc8073c4b6 Fixed a bug with decorated custom views
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
2017-08-22 14:58:59 -07:00
Petar Šegina
c6381f7a76 Skip smart select animation if selection result is null
Bug: 64809246
Test: bit CtsAccessibilityServiceTestCases:AccessibilityTextTraversalTest#testTextEditingActions
Change-Id: I4ef9d374e3d4a2889462459f50b673cca8970b5b
2017-08-22 16:15:05 +01:00
Felipe Leme
ee5aa78c2e Merge "Improved autofill support on DatePicker and TimePicker:" into oc-mr1-dev am: 6598a4ed52
am: e6be222bdf

Change-Id: Ib478276e91d26e5040aa1d9e658c155a0d6224e7
2017-08-17 02:16:10 +00:00
TreeHugger Robot
abe61c2a47 Merge "Add deltaX/Y to a11y scroll events" 2017-08-16 23:33:09 +00:00
Petar Šegina
5a239f0113 Load Smart Select stroke color from colorControlActivated
Test: manual - built an app that overrides colorControlActivated in it's
theme and tested the Smart Select animation in it

Change-Id: Ia6112e9e1f49b15a56f8f0455cd55bf3df598508
2017-08-15 20:01:45 +01:00
Felipe Leme
f480e8cad5 Improved autofill support on DatePicker and TimePicker:
- Save autofilled value so UI is properly highlighted.
- Notify TimePicker listener just once.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases
Test: cts-tradefed run commandAndExit cts-dev -m CtsWidgetTestCases -t android.widget.cts.DatePickerTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsWidgetTestCases -t android.widget.cts.TimePickerTest

Fixes: 37098837

Change-Id: I38d64c107f6059b94c92676ea37681006474f519
2017-08-15 10:42:58 -07:00
TreeHugger Robot
b0a22a168c Merge "Enable Smart Select Animation by default" 2017-08-14 21:44:44 +00:00
Chet Haase
f5a87f7058 Merge "Document existing immutable behavior of ArrayAdapter" 2017-08-14 20:16:48 +00:00
Petar Šegina
e2f826387e Enable Smart Select Animation by default
Test: manual - build and verify the Smart Select Animation works in the
single-line case

Change-Id: Ic6e657c6ee06852644b02f14b9547a2b8bcf9860
2017-08-14 18:55:43 +01:00
Petar Šegina
855396d37a 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
2017-08-14 18:55:12 +01:00