Commit Graph

7349 Commits

Author SHA1 Message Date
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
Petar Šegina
701ba333f6 Add animation for Semantic Lift
Test: manual - trigger smart select in a TextView
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I2b147a9cc4cbb79118bb78d948bac76a63cf4253
2017-08-11 12:19:53 +01:00
Abodunrinwa Toki
d762f32201 Merge "Fix failing Framework TextView tests." 2017-08-10 15:31:54 +00:00
Chet Haase
b7c6a5d7e9 Document existing immutable behavior of ArrayAdapter
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
2017-08-09 20:03:56 +00:00
Abodunrinwa Toki
4a056a5895 Fix failing Framework TextView tests.
. Fix TextViewActivityTest.testToolbarAndInsertionHandle
 . Suppress TextViewActivityMouseTest

Bug: 29591177
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityMouseTest
Change-Id: I51edcf4d7e4f179a8b02316cc1cb6314b209baad
2017-08-09 15:34:13 +01:00
TreeHugger Robot
0591b8ccc5 Merge "Fix monkey bug when focus change before layout" 2017-08-07 15:02:53 +00:00
Jeff Sharkey
1fb3a312e7 Merge "Fix broken javadocs." into oc-mr1-dev am: b79eb54d36
am: 1ad38fe278

Change-Id: I21266d20be036196dbeddb9c4366d641ab1b68a8
2017-08-06 17:00:09 +00:00
Jeff Sharkey
67f9d5070a Fix broken javadocs.
Bug: 64337634
Test: make -j32 doc-comment-check-docs
Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
2017-08-06 07:37:08 -06:00
TreeHugger Robot
b186823314 Merge "Improve TextView.onMeasure() for multiline text." 2017-08-04 19:24:01 +00:00
Seigo Nonaka
917748ef50 Improve TextView.onMeasure() for multiline text.
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
2017-08-04 17:21:06 +00:00
George Mount
45362a6b72 Fix monkey bug when focus change before layout
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
2017-08-04 10:17:36 -07:00
Andrei Stingaceanu
b969b3eb98 Merge "AutoSize TextView - fix transformation method" into oc-mr1-dev am: 8719c2a8e6
am: 45d18e2834

Change-Id: Ie161f8b1065791c1523f981a955561d810417097
2017-08-04 13:32:21 +00:00
Andrei Stingaceanu
8719c2a8e6 Merge "AutoSize TextView - fix transformation method" into oc-mr1-dev 2017-08-04 13:08:40 +00:00
TreeHugger Robot
680a74c056 Merge "Refactor TextView TextAppearance attributes reading" 2017-08-04 07:58:00 +00:00
Eugene Susla
cb45ddfec5 Add deltaX/Y to a11y scroll events
Test: cts-tradefed run singleCommand cts -d --module CtsAccessibilityServiceTestCases
cts-tradefed run singleCommand cts -d --module CtsAccessibilityTestCases
cts-tradefed run singleCommand cts -d --module CtsUiAutomationTestCases
Bug: 18359705
Change-Id: Ia07af93ef93a6fd327e3c14de6e25a7022d2f358
2017-08-02 15:25:25 -07:00
Siyamed Sinir
8b7053dd45 Merge "Fix EditText cursor when line spacing is set" 2017-08-01 22:37:55 +00:00
Clara Bayarri
d2781160f1 Refactor TextView TextAppearance attributes reading
Attributes that can appear in a TextAppearance are read in 3
different places inside TextView:
- Within the TextAppearance in the constructor
- Within the Style in the constructor
- Within setTextAppearance

This change simplifies the attribute reading code so it only
happens in one place. Note the way TextView reads these attributes
is first populating them from the TextAppearance and then allowing
them to be overriden by the style. The same is accomplished here.

For testing purposes and for API consistency, this change also adds
the missing APIs
- isAllCaps
- isElegantTextHeight

Bug: 64053645
Test: bit CtsWidgetTestCases:.TextViewTest
Change-Id: Iad6c1c6515992a51020c656edabea4e2927572f3
2017-08-01 17:12:01 +01:00
Sergey Vasilinets
ee73c957a5 Merge "Revert "Revert "Update overscroll and toast UI""" into oc-dr1-dev am: 2cf8f91637 am: 3c9c422d33
am: 98e73b856a

Change-Id: I633ca5e543781eb86f25fe82c9bae91e7af7979e
2017-07-28 23:08:13 +00:00
Sergey Vasilinets
3c9c422d33 Merge "Revert "Revert "Update overscroll and toast UI""" into oc-dr1-dev
am: 2cf8f91637

Change-Id: Ia0f4dc6193776e0b37eb7e2d2048918510cae535
2017-07-28 22:02:14 +00:00
Sergey Vasilinets
2cf8f91637 Merge "Revert "Revert "Update overscroll and toast UI""" into oc-dr1-dev 2017-07-28 21:46:43 +00:00
TreeHugger Robot
4ecf2de06b Merge "Remove secondary bidi cursor" 2017-07-27 23:58:07 +00:00
Sergey Vasilinets
ebfaca5246 Revert "Revert "Update overscroll and toast UI""
This reverts commit 45c493f2c2.

Change-Id: Idefc8e1b6f954def7ef4cdf08b687042a6091a0d
2017-07-27 23:29:34 +00:00