Commit Graph

6878 Commits

Author SHA1 Message Date
Keisuke Kuroyanagi
a4371bc564 Merge "Fix: Wrong TextView height when DynamicLayout is used." 2017-01-18 05:56:07 +00:00
Phil Weaver
0a78adea72 Merge "Provide hint text to accessibility." 2017-01-17 18:11:22 +00:00
Keisuke Kuroyanagi
c2e38ce281 Fix: Wrong TextView height when DynamicLayout is used.
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
2017-01-16 19:34:41 +09:00
Jason Monk
cd26af7054 Move all time ticks to bg handlers, and post
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
2017-01-13 13:43:22 -05:00
Andrei Stingaceanu
564328b21e AutoSize TextView (part 6) - introduce autoSizeMaxTextSize
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
2017-01-13 11:52:00 +00:00
Keisuke Kuroyanagi
846946ec06 Merge "Make selection end handle stick to selection at line end." 2017-01-13 06:39:22 +00:00
Keisuke Kuroyanagi
7c263ddd58 Make selection end handle stick to selection at line end.
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
2017-01-12 19:24:18 +09:00
Seigo Nonaka
ba3028c1fc Introduce set/getFontVariationSettings.
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
2017-01-12 18:11:03 +09:00
Vadim Tryshev
1abe85c867 Converting action bars to clusters.
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
2017-01-11 17:19:39 -08:00
Seigo Nonaka
88296d221b Merge "Introduce full justification." 2017-01-11 08:24:08 +00:00
Felipe Leme
6d553874be YAMAFFR - Yet Another Major AutoFill Framework Refactoring
- 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
2017-01-10 12:50:47 -08:00
TreeHugger Robot
a2b61657c4 Merge "Add @Nullable to CompoundButton#setOnCheckedChangeListener()." 2017-01-09 18:33:44 +00:00
Seigo Nonaka
09da71a6dc Introduce full justification.
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
2017-01-05 18:14:15 +09:00
Phil Weaver
776afc212e Provide hint text to accessibility.
Bug: 30025621
Test: Adding CTS tests in linked CL.
Change-Id: Ib873352704a23c733a5eac36030a88fc55dc9b04
2016-12-27 13:58:29 -08:00
Roozbeh Pournader
edef8505cb Merge "Expand characters temporarily skipped in spellchecking" 2016-12-20 19:36:54 +00:00
TreeHugger Robot
6fc806b56c Merge "Fix casting issue in use of ICU Measures" 2016-12-20 19:31:10 +00:00
TreeHugger Robot
19e2fb57c9 Merge "Implement requestKeyboardShortcuts for PopupDecorView" 2016-12-20 15:38:27 +00:00
Roozbeh Pournader
63a13cf754 Fix casting issue in use of ICU Measures
Bug: 19418509
Bug: 33670388
Bug: 33750033
Test: manual
Change-Id: I286cfed0cfe34166bd1fd1982089a11eb556fc44
2016-12-19 16:03:30 -08:00
Roozbeh Pournader
f6952b8331 Expand characters temporarily skipped in spellchecking
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
2016-12-19 11:31:07 -08:00
Roozbeh Pournader
d681725437 Merge "Switch Chronometer to use ICU instead of duration_hours etc" 2016-12-16 18:39:06 +00:00
Roozbeh Pournader
241872a93b Switch Chronometer to use ICU instead of duration_hours etc
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
2016-12-15 16:00:45 -08:00
Peeyush Agarwal
50db731b54 Implement requestKeyboardShortcuts for PopupDecorView
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
2016-12-14 18:46:39 +00:00
Andrei Stingaceanu
79ada3015b Merge "AutoSize TextView (part 4) - autosize when layout changes" 2016-12-14 10:51:56 +00:00
Andrei Stingaceanu
7c8ba07ed4 AutoSize TextView (part 4) - autosize when layout changes
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
2016-12-13 16:44:59 +00:00
TreeHugger Robot
d4f08a007d Merge "AutoFill Framework refactoring." 2016-12-13 04:05:51 +00:00
Felipe Leme
1ca634a544 AutoFill Framework refactoring.
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
2016-12-12 18:22:45 -08:00
TreeHugger Robot
cf4d2ce358 Merge "Introduce TextClassificationManager." 2016-12-12 21:42:19 +00:00
Sunny Goyal
c50b1d1022 Merge "Enforcing a maximum depth on nested RemoteViews calls" 2016-12-12 20:19:24 +00:00
Abodunrinwa Toki
8158af53e8 Introduce TextClassificationManager.
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
2016-12-12 19:52:31 +00:00
Alan Viverette
054c172ec6 Show popup transitions when there is no anchor set
Allow anchorRoot to be null when starting exit transition. Pushes
epicenter callback creation into startExitTransition. Adds nullability
annotations.

Bug: 33035511
Test: PopupWindowTest#testEnterExitTransition
Change-Id: Ie752a0d6b29d5eb11c160771d8a78fa6234de5bb
2016-12-07 18:05:35 +00:00
Andrei Stingaceanu
5038d58c83 AutoSize TextView (part 3) - define who supports autosize
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
2016-12-06 13:14:22 +00:00
Jason Long
acdaaea50c Add @Nullable to CompoundButton#setOnCheckedChangeListener().
Test: n/a

Change-Id: I3db93bfcfba528e7271be21356e585e9f9a0799d
2016-12-01 22:56:22 -08:00
Phil Weaver
7584b074ae Don't invalidate list data during layout. am: a9d976f39a
am: 84a0d97b85

Change-Id: I0dc549674ed7e026cbe15ac6d06626305729e7b8
2016-11-30 18:05:26 +00:00
Phil Weaver
84a0d97b85 Don't invalidate list data during layout.
am: a9d976f39a

Change-Id: I865fda193961bb0e5229cba1034b818572662001
2016-11-30 18:00:54 +00:00
Andrei Stingaceanu
5cd7efb267 AutoSize TextView (part 1) - minimal end-to-end
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
2016-11-24 10:59:01 +00:00
Abodunrinwa Toki
d0d9ceb30c Introduce TextAssistant for Smart Text Share feature.
Bug: 30982298
Test: CTS tests to be added in a follow up CL.
Future CLs will add implementation detail.

Change-Id: Iad550447a4b3552340c0ada75fda60f97f0913aa
2016-11-22 14:41:16 +00:00
Abodunrinwa Toki
1b304e4073 TRON logging for TextView gesture - Long press.
Bug: 32572232
Test: Manually confirmed that stats were sent for logging by checking
  adb logs according to go/tron-howto.
Change-Id: I1ea09174190247c219ce42f70c7db75148033685
2016-11-17 10:51:26 +00:00
Sunny Goyal
692f8c9324 Enforcing a maximum depth on nested RemoteViews calls
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
2016-11-16 08:29:57 -08:00
Sunny Goyal
d998c08231 Merge "Preventing widgets from exceeding Bitmap memory limit" 2016-11-15 03:33:46 +00:00
Sunny Goyal
349b412b4b Preventing widgets from exceeding Bitmap memory limit
> 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
2016-11-14 17:19:25 -08:00
Siyamed Sinir
302d57c649 Merge "Update TextView ApiDocs." 2016-11-11 23:31:15 +00:00
Yigit Boyar
a7e523d6fe List all methods that change data in the docs am: 42c69b9ce4 am: 7e6fdaab69 am: 93f130e232
am: 586c7e26f7

Change-Id: I28fb42476eebb0437b58b076574b1119d233ec01
2016-11-11 23:04:10 +00:00
Yigit Boyar
586c7e26f7 List all methods that change data in the docs am: 42c69b9ce4 am: 7e6fdaab69
am: 93f130e232

Change-Id: Id95fff602b22d376cfd81fbafdc22fac376a644c
2016-11-11 22:52:01 +00:00
Yigit Boyar
7e6fdaab69 List all methods that change data in the docs
am: 42c69b9ce4

Change-Id: I0808918c44981da63ace801c486d442ff1a99700
2016-11-11 22:31:15 +00:00
Sunny Goyal
0a1ce4237f Merge "Fixing async inflation for nested RemoteViews" 2016-11-09 20:20:46 +00:00
Sunny Goyal
7b0e2c7659 Fixing async inflation for nested RemoteViews
> 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
2016-11-09 10:02:44 -08:00
Siyamed Sinir
9aba698bd1 Merge "StaticLayout visual fix for maxLines" 2016-11-08 00:56:18 +00:00
Tony Wickham
400ef79b8e Add safety net if StackView duration would be negative.
Bug: 32699754
Change-Id: I00d4b2398fa7f4ab4cdad290a346b0f09c2af242
2016-11-07 18:27:41 +00:00
Seigo Nonaka
4b56177429 Merge "Make sure the Typeface is loaded before calling measureText." 2016-11-07 05:22:52 +00:00
Phil Weaver
a9d976f39a Don't invalidate list data during layout.
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)
2016-11-02 17:37:53 +00:00