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
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
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
The double bidi cursor is not user friendly. Almost no native speaker
of bidi languages likes the double cursor.
Now we always show one cursor.
Change-Id: I249befaf70630bef435c8db9039e8aacf233bf7c
Fixes: 63542996
Test: Manual (no more double cursors, bidi editing feels OK)
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.text.
Test: bit FrameworksCoreTests:android.widget.EditorCursorTest
Test: bit FrameworksCoreTests:android.widget.TextViewTest
AutoSize now takes the text transformation method into
account when measuring the view.
Bug: 63889588
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -t
android.widget.cts.TextViewTest#testAutoSizeCallers_setTransformationMethod
Change-Id: I52f4bf6ea2f45342efa04b742a9debdac69f9c4c
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Test: bit FrameworksCoreTests:android.widget.EditorCursorTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Bug: 30870806
Change-Id: I54f014b06af328c3e9a9c4ddb5a3348a26e290c2