When DynamicLayout is used, max line is not set for
computing layout even if TextView has the limit. So, we
still need to use getLineTop in getDesiredHeight.
This bug was introduced by I1e1cae31cf33d503a8cf.
Bug: 34279529
Test: manually tested
Test: android.widget.cts.TextViewTest
Change-Id: I9b7a3c46e7671a84e6a830eb962a49d2b0856eab
This will hopefully avoid blaming sysui for ANRs when the system
is hosed.
Test: Manual, build, push, wait for time to change
Change-Id: I1661ac1a997ad8917b449dd175229d8b77f583c9
Using textSize as maxTextSize for autosizing is buggy and
unclean. Introduce and use new autoSizeMaxTextSize attribute for
TextView.
Also while doing this optimized the auto-size process by removing
unnecessary computations:
1. If auto-size is enabled than setTextSize(...) is no-op.
2. After setting the text size internally and from the auto-size
context onMeasure() will stop doing another round of redundant
measurements..
Bug: 33449596
Bug: 32221168
Test: atttached in the same topic
Change-Id: Ieecaea6df0aebb4c182bdd1114e3c6fc5066bed1
At line break, one offset can be mapped to two phisical
position: previous line end and next line start.
Previously, all cursor handles are placed at next line
start.
With this CL, selection end handle is placed at the
previous line end in such cases.
Test: FrameworksCoreTests
Bug: 21305922
Change-Id: I00d9f9a0cd417ca92534e93b3d3f655cd62f25d3
This CL enables developers to specify axis values to the underlying
font collection. The specification of the font variation settings is
the same as the CSS font-variation-settings attribute in CSS working
draft as of 2016-11-30.
Code example: Here is an example to set width 100 and weight 1.5.
TextView tv = (TextView) findViewById(R.id.textView);
tv.setFontVariationSettings("'wdth' 100, 'wght' 1.5");
Bug: 33062398
Test: Manually done. Ran FrameworksGraphicsTests, CtsGraphicsTestCases
and CtsWidgetTestCases
Change-Id: I249d464f8cdaa56017a987588b94ed685aadeb58
ActionBar keyboard navigation logic is now implemented via clusters.
Old implementation using setTouchscreenBlocksFocus and Ctrl+Shift+<
shortcut is removed.
Looking at the code, I can’t rule out existence of all 3 categories
(1) action bars with a nested toolbar, (2) action bars without a
nested toolbar and (3) Toolbars outside of action bars.
Because of this, I set “cluster” attribute both on action bar and
toolbar, and have code to avoid nested clusters in case (1).
Support lib’s action/tool bars aren’t converted, however, they
didn’t regress since Ctrl+Shift+< never worked for them. Will be
done after feature freeze.
Bug: 32151632
Test: Manual checks.
Change-Id: Ieb93980088c0fb385a9bc8a5d218ffc269b94dc5
- Explicitly split View methods into Assist and AutoFill methods, rather
than use an overloaded method that takes flags.
- Simarly, renamed ASSIST_FLAG_SANITIZED_TEXT and
ASSIST_FLAG_NON_SANITIZED_TEXT flags to
AUTO_FILL_FLAG_TYPE_FILL and AUTO_FILL_FLAG_TYPE_SAVE respectively.
- Created a AutoFillUI class to host the auto-fill bar and other UI
affordances.
- Moved the temporary notifications to AutoFillUI (eventually that
class will host the real UI).
- Moved FillData to android.app.view.autofill package.
- Split IAutoFillCallback in 2 (IAutoFillAppCallback and
IAutoFillServerCallback, residing at the app and system_server
respectively), so service cannot fill the app directly (which lets
the framework control the UI).
- Moved assist's IResultReceiver to AutoFillServiceImpl so
system_server can act as a mediator between the AutoFillService
implementation and the app being auto-filled.
- Replaced FillData and FillableInputFields by a bunch of new objects:
- FillResponse contains a group of Datasets, each representing
different values
that can be used to auto-fill an activity (for example, different
user accounts), optional id of fields the service is interested
to save, and an optional bundle for service-side extras.
- Dataset contains a name, Fields, and an optional bundle for
service-side extras.
- Fields contain an AutoFillId (parcelable) and a value (Bundle)
- Changed the temporary notifications to emulate the new workflow:
- Initial notification requests the auto-fill data but do not
auto-fill.
- Once service calls back, a new notification is shown with the
results.
- Then if the user selects a dataset, the activity is auto-filled
with it.
- It also shows a notification to emulate what can be saved.
- Created an VirtualViewDelegate for views that uses a virtual
hierarchy for assist data.
- Added new methods on ViewStructure to add children with virtual ids.
- Added 2 methods on View to support auto-fill:
- autoFill(Bundle) to auto-fill the view.
- getAutoFillType() to return how the view can be auto-filled.
- AutoFillType defines the input fields that support auto-fill:
- Text fields (like EditText)
- Toggle fields (like CheckBox)
- Lists (like RadioGroup)
- AutoFillType can also have a sub-type representing its semantic (for
now only text fields have it, and it's the same as getInputType()).
- etc :-)
Bug: 31001899
Test: manual verification
Change-Id: I2dd2fdedcb3ecd1e4403f9c32fa644cb914e186f
Adds a new get/setJustify API to TextView and StaticLayout.Builder for
justification, and fully justifies text when it's enabled.
This is based on a patch by Raph Levien (raph@google.com).
Bug: 31707212
Test: Manually done and CTS will introduced with
I0f3bbf39d60a66b71b30e1351f7c741208f05dce passes.
Change-Id: Icbfab2faa11a6a0b52e6f0a77a9c9b5ef6e191da
An earlier patch (I4d09576a31df551c96f820242fd2cbc675506dae)
special-cased apostrophe as a character to defer spellchecking on,
since it could cause a word break which could later get removed.
This patch updates that earlier patch to include all characters that
could cause such a behavior according the Unicode word breaking
algorithm defined in UAX #29.
Bug: 17641350
Bug: 17673522
Test: manual
Change-Id: I4029e3d91dfcf96665b003f6fdd30d1208b0ac7c
The data in ICU has higher quality and is more comprehensive.
(Additionally, the old code was using spaces to separate hours,
minutes, and seconds, which was not correct for some locales.)
Finally, remove duration_hours etc, since there is no longer any user
of it.
Bug: 33670388
Bug: 19418509
Test: manual and CTS (cts-tradefed run cts-dev --module CtsWidgetTestCases --test android.widget.cts.ChronometerTest)
Change-Id: I97efa62186b94ed444fff90fa26bf71ac1599261
A call to requestKeyboardShortcuts from popup menu might be dispatched
to PopupDecorView or DecorView depending on WindowManagerService's
focusedWindow at that moment.
In case it gets dispatched to PopupDecorView, we would like to resend it
to parent activity's decor view (which can then handle it
appropriately). The change adds a notion of mParentRootView which keeps
track of popup's parent's decor view. The request is then routed
appropriately so as to display the corresponding shortcuts. mAnchor
cannot be used as it gets nulled (by dismiss) by the time
requestKeyboardShortcuts gets called.
Bug: 31850671
Change-Id: I0ee3a1c7801c6d3fce8748bc7513382f250c5c63
Fixes: 31850671
Test: cts-tradefed run cts-dev -m CtsAppTestCases -t
android.app.cts.ActivityKeyboardShortcutsTest#testRequestShowKeyboardShortcuts
Whenever TextView#onMeasure(...) gets called make sure to
also autosize is enabled. Also fixes the available space
calculation by taking the drawables padding into consideration
too.
Bug: 32221168
Bug: 33573642
Test: attached in topic
Change-Id: I1a01454f3863e51afd7e16cfa27f544db6ca0783
The AutoFill Framework uses the same AssitStructure provided by the Assist API
and so far it was using the same methods as well, both internally and externally
(public API).
Sharing that internal code internally is fine, but the public APIs must distinguish between the 2 cases so they can fill the assist structures accordingly (although the initial implementation still shares the same logic).
This CL also splits the original 'auto-fill' request in 2 types of requests,
which are set by View flags:
- ASSIST_FLAG_SANITIZED_TEXT
- ASSIST_FLAG_NON_SANITIZED_TEXT
It also added new methods and callbacks to handle save requests.
Bug: 31001899
Test: manual verification
Change-Id: I4eb09099dc19a43cb7e053e64d939aed3704b410
This handles smart selection and language detection features.
This CL only contains code to integrate the TextClassificationManager.
Implementation will be added in a follow up CL.
Test: Test will be added when TextClassificationManager is added.
Bug:32503402
Change-Id: I5f22150ff998156fbc91b51c733d93478efaa51f
Introduces a new protected hidden method that
specifies if the TextView (or descendant) widget
supports the autosize feature. All direct children of
TextView (besides EditText) support it.
Bug: 33098425
Bug: 32221168
Test: attached in the topic
Change-Id: I6f0092b4c9948afb427fe597b0515a39b1f258f6
Introduced the minimal number of attributes needed
to do autosizing and the autosize functions
bundled in TextView (for now). Note that in this
first version the autosizing can only be controlled
via construction.
Next: introduce getters/setters for the new attributes.
Bug: 32221168
Test: added a minimal smoke-ish CTS which exercises the
new attributes.
Change-Id: Idf2195f6a600bfb7908b703ea046209b5868c521
Bug: 30982298
Test: CTS tests to be added in a follow up CL.
Future CLs will add implementation detail.
Change-Id: Iad550447a4b3552340c0ada75fda60f97f0913aa
Bug: 32572232
Test: Manually confirmed that stats were sent for logging by checking
adb logs according to go/tron-howto.
Change-Id: I1ea09174190247c219ce42f70c7db75148033685
An unchecked read from parcel can lead to StackOverflowError
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 26755067
Change-Id: I36ea253846d5c823899097821270dcfca2472b65
> Moving the size check to a comman place so that it is executed in
all related code
> Fixing size calculation when views are merged as a result of partial
update
Test: Manually tested with a dummy app
Bug: 31790171
Change-Id: Id0ea776796f156455d2cba31c8392d4875116949
> Fixing isRootNamespace check
> Updating ViewTree when ViewStub is inflated
> Applying ViewGroupAction on previously found views instead of finding it again
as the viewTree might have changed.
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 32639592
Change-Id: I0815fb3a981efbc04fb0d080b81949985c2d9bc3
When a FastScroller is enabled, we were invalidating the
list data during layout, which left the UI in a bad state.
Long-presses didn't work properly, and TalkBack touches
were impossible to perform.
Bug: 31160338
Test: Manually tested long pressing, and verified
that TalkBack now works with the TestActivity in ag/1567328.
Change-Id: Iecd2d597259748a3ecbf5573950e565a0e9faa42
(cherry picked from commit 2112742be6)