Commit Graph

9538 Commits

Author SHA1 Message Date
Ziqi Chen
ae9337c1d0 Merge "Introduce FontStyle.FONT_WEIGHT_UNSPECIFIED constant" 2022-11-14 07:22:01 +00:00
TreeHugger Robot
f34bcf9d00 Merge "Use SOURCE_TOUCHSCREEN as the default last input source." 2022-11-09 00:52:29 +00:00
czq
2111954aaa Introduce FontStyle.FONT_WEIGHT_UNSPECIFIED constant
Introduce a new constant FontStyle.FONT_WEIGHT_UNSPECIFIED = -1, which is used when text weight is not specified. Also replace -1 with it in TextView, TextAppearanceSpan.

Bug: 256995042

Test: manually test
Change-Id: Ia8334f5513cc3e5b7383b67b24b27bf2866d05ad
2022-11-08 13:27:17 +08:00
Jon Eckenrode
bfe114fb84 Merge "Removed outdated link." am: f74a4b312b am: 634c1751a1 am: 5ab93bcc34
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2280480

Change-Id: I692267daaf2aa17adad5dca413c19e2f39d4216f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-03 00:19:59 +00:00
Jon Eckenrode
634c1751a1 Merge "Removed outdated link." am: f74a4b312b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2280480

Change-Id: I2a34b19dd8f6cb7da46de69f36391a84028b8abf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-02 23:31:54 +00:00
Jon Eckenrode
4b376be8df Removed outdated link.
Change-Id: I01db8876d591efad358957269e4e358282943e40
2022-11-02 20:36:35 +00:00
Ziqi Chen
6745a77c6c Merge "Add a new API CursorAnchorInfo#getTextAppearanceInfo()." 2022-11-02 08:18:02 +00:00
czq
50f792e09d Add a new API CursorAnchorInfo#getTextAppearanceInfo().
Add a new group of information related to text appearance in
CursorAnchorInfo, which is extracted from TextView.

Bug: 231894524

Test: atest android.view.inputmethod.cts.CursorAnchorInfoTest#testBuilder
atest android.view.inputmethod.cts.CursorAnchorInfoTest#testEquality
atest android.view.inputmethod.cts.InputMethodServiceTest#testOnUpdateCursorAnchorInfo

Change-Id: I8b96f055506b0a426dcfc6334db867dda7073868
2022-11-02 11:40:08 +08:00
Haoyu Zhang
bfdf3ddb5f Support TextBoundsInfo for TextView
Bug: 239843501
Test: atest TextViewTextBoundsInfoTest
Change-Id: Id3e46e8c8a9df294dc449064d7dfd68eafbd578d
2022-11-01 09:48:17 +00:00
Seigo Nonaka
84af38145b Use SOURCE_TOUCHSCREEN as the default last input source.
To keep the old behavior in case of API call or a11y events, use
SOURCE_TOUCHSCREEN as the last input source to be able to show
existing ActionMode UI.

Bug: 244175906
Test: atest TextViewTest
Change-Id: Ie20b37e851b4600a6ad86ad7fffb9e2d466e0be1
2022-11-01 09:16:59 +09:00
Justin Ghan
9d0b39c24a Update Layout#getRangeForRect to not use Range
android.util.Range is not suitable for text ranges since it uses
inclusive boundaries, whereas the convention in text is to represent
ranges with an inclusive start boundary and exclusive end boundary. So
the API is updated to use an array of two ints to represent the text
range.

Bug: 251085162
Test: atest android.text.cts.LayoutGetRangeForRectTest
Change-Id: I54ab6d2741d1cfbbb743e477de4fa7299382fcfb
2022-10-20 17:02:18 -07:00
Justin Ghan
316f451fb6 Merge "TextView implementation of select range and delete range gestures" 2022-10-19 20:48:54 +00:00
TreeHugger Robot
94cc29a128 Merge "Add PageDown, PageUp, End, Home key handler to ScrollView" 2022-10-19 08:19:36 +00:00
Justin Ghan
1ce033402e TextView implementation of select range and delete range gestures
Bug: 247570808
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I2cfd579c1dd213fa1847f302b56d22bda0c96f19
2022-10-19 00:32:21 -07:00
Seigo Nonaka
72716ed677 Add PageDown, PageUp, End, Home key handler to ScrollView
Bug: 244260144
Test: ScrollViewTest
Change-Id: I8f73f62ff5fb712411e588c032abed3638d3beb0
2022-10-17 12:26:40 +00:00
Justin Ghan
e709f0a4ed Handwriting gesture line margin
Point-based handwriting gestures are supported for points within text
line bounds. With this change, they will also be supported for points
which are outside the line bounds but within a margin of the line bounds.

The margin is added to ViewConfiguration so that the value can be
accessed by other UI toolkits so that they can implement the same
behavior.

The dimension resource is added as a @SystemApi so that OEMs may
override the value.

Bug: 243967209
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I0e64f20c670808580346a485d06a0da0f21d3ed2
2022-10-13 17:54:20 -07:00
Justin Ghan
b34559a74a Remove space gesture: improve range calculation
The initial implementation using Layout#getOffsetForHorizontal could
miss whitespace characters at the endpoints. This new implementation
using Layout#getRangeForRect ensures all whitespace characters touched
are included in the range.

Bug: 247557062
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I800407a6d89d77cd5e750530d9dae8ccb268869f
2022-10-10 00:19:00 -07:00
Justin Ghan
4212ebb0e9 Layout#getRangeForRect API changes
- Layout#getRangeForRect returns Range<Integer> instead of int[].
- WordSegmentFinder takes ULocale instead of Locale
- Additional Javadoc

Bug: 251085162
Test: atest android.text.cts.LayoutGetRangeForRectTest
Change-Id: Id51f5b23885dc93addc44b81d641c963c58505c8
2022-10-07 14:41:39 -07:00
Justin Ghan
83162821c7 Fix whitespace removal bug
The implementation of whitespace removal in
performHandwritingDeleteGesture had a bug causing an
IndexOutOfBoundsException when the whitespace was at the start or end of
the text.

This also fixes the whitespace removal code in
performHandwritingJoinOrSplitGesture to properly handle supplementary
characters.

Bug: 243983058
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I3cfef91d05d5619668ccfc0d1259b6b1fd96bed9
2022-10-04 12:17:28 -07:00
Justin Ghan
3cc4fa15eb Merge changes from topics "inclusion-strategy", "segment-finder"
* changes:
  Rename SegmentIterator to SegmentFinder
  Layout#getRangeForRect support different text inclusion strategies
2022-10-03 23:24:00 +00:00
Xin Li
4b1dc6dbf6 Merge TP1A.221005.003
Merged-In: I6ffbb7510e6854f18bc427d1ae1e782918c799dc
Change-Id: I32d05cdabc6579f00bb4af0657b38539ec81a588
2022-10-03 13:38:22 -07:00
Justin Ghan
88cd111ca8 Rename SegmentIterator to SegmentFinder
Also clean up some helper methods by inlining the logic.

These APIs will be made public in a follow up change.

Bug: 243969224
Test: atest android.text.LayoutGetRangeForRectTest
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I7991ef1f3abdf575b9adc0c5dc971f0cdd09fc87
2022-10-03 12:17:06 -07:00
Justin Ghan
339e9492d5 Layout#getRangeForRect support different text inclusion strategies
These APIs will be made public in a follow up change.

Bug: 243969224
Test: atest android.text.LayoutGetRangeForRectTest
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I65ddda9d60c486ca8f53bbd9f0d97209d56bec62
2022-10-03 12:14:54 -07:00
Treehugger Robot
67457fc6c1 Merge "Reorganize text related owners" am: 5e89e54398 am: 95ea173c85 am: 38eb872609 am: a35e8a8e8d am: 0605a3c8b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2226540

Change-Id: I4df8d1492e2e8727896a674460f77e99e7779909
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 19:42:10 +00:00
Treehugger Robot
0605a3c8b6 Merge "Reorganize text related owners" am: 5e89e54398 am: 95ea173c85 am: 38eb872609 am: a35e8a8e8d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2226540

Change-Id: I3ecf084064583b0920becb5bd994fe43a14a7b1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 18:53:36 +00:00
Treehugger Robot
38eb872609 Merge "Reorganize text related owners" am: 5e89e54398 am: 95ea173c85
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2226540

Change-Id: Ib9cc543d2d3cf6f2bedd5e05f1e86e06a60d1cf0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-29 17:56:49 +00:00
Zeyin Wu
8bda3be985 Merge "Add CONTENT_CHANGE_TYPE_CONTENT_INVALID CONTENT_CHANGE_TYPE_ERROR" 2022-09-27 21:41:44 +00:00
Justin Ghan
23af096ba2 Merge "Disable handwriting initiation for password fields" 2022-09-27 20:59:51 +00:00
Zeyin Wu
9eef24a570 Add CONTENT_CHANGE_TYPE_CONTENT_INVALID CONTENT_CHANGE_TYPE_ERROR
Bug: 230141621
Test: cts tests & manually verified on talkback_tests
Change-Id: Ifebb197340b9e22b7451eb2292b22bce41a2cc9e
2022-09-26 22:59:46 +00:00
TreeHugger Robot
08b9eefa9a Merge "Add Layout#getLineBottom with includeLineSpacing parameter" 2022-09-26 20:53:57 +00:00
Justin Ghan
5bfd33e89c Add Layout#getLineBottom with includeLineSpacing parameter
Bug: 247609599
Test: atest android.text.cts.StaticLayoutTest
Test: atest android.text.LayoutGetRangeForRectTest
Change-Id: I7363fe3974d712f992bca5aaefa5ca76499656d2
2022-09-26 09:25:26 -07:00
Justin Ghan
e51ef4024c Delete gesture: remove extra whitespace around deleted text
Bug: 243983058
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I759bbb99e94a373390c77cb28fb71aa641c63560
2022-09-23 01:06:09 -07:00
Justin Ghan
25e455e640 Merge "TextView implementation of remove space gesture, and join or split gesture" 2022-09-23 02:44:40 +00:00
Seigo Nonaka
5916f347b3 Reorganize text related owners
Update list of owners of the text team.

Bug: N/A
Test: N/A
Change-Id: Iae227284d69b1251f26f549850909f44c7639c8f
2022-09-22 16:12:23 +09:00
Justin Ghan
b65e9d1c5a Disable handwriting initiation for password fields
Bug: 222375667
Test: atest android.widget.cts.TextViewTest
Change-Id: I93274c14ec607f5b09fc483133cc83e618d9ce3b
2022-09-21 16:11:16 -07:00
Justin Ghan
52b915f439 TextView implementation of remove space gesture, and join or split gesture
Bug: 240436909
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: I0a899f0aecd953f67b398df6b48b90f09c73e4d1
2022-09-19 14:24:31 -07:00
Steven Terrell
da54b2835e Merge changes from topic "cursor-bg-blink-cp" into tm-qpr-dev am: 131fb1ff89 am: b2eba6b95d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19955684

Change-Id: I61543684ba63c8a2aa9ee5c9e1b6f9df92d5d2a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-17 12:16:58 +00:00
Steven Terrell
b2eba6b95d Merge changes from topic "cursor-bg-blink-cp" into tm-qpr-dev am: 131fb1ff89
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19955684

Change-Id: I896302084978f6f22cc52167f981d62feaedc31a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-16 03:15:41 +00:00
Steven Terrell
e23d904d4a Stop cursor from blinking when not visible am: 4ec6dfc389
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19758504

Change-Id: Id4fd25b59737a3095366280de62ab484bda75193
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-16 03:15:20 +00:00
Steven Terrell
131fb1ff89 Merge changes from topic "cursor-bg-blink-cp" into tm-qpr-dev
* changes:
  Add Ability to Check if Cursor is Blinking
  Stop cursor from blinking when not visible
2022-09-16 02:46:30 +00:00
TreeHugger Robot
085455fd72 Merge "Fix: EditText returns wrong CursorAnchorInfo matrix" 2022-09-16 00:39:48 +00:00
Steven Terrell
d2acc476d0 Add Ability to Check if Cursor is Blinking
adds a method for returning whether the cursor is blinking based on the
current value of the mCancelled property in the Blink class.  This
method is only inteded to be used for testing purposes.

Bug: 228354442
Test: manual, method is called in CtsWidgetTestCases:EditTextTest#
      testSuspendAndResumeBlinkingCursor,
      testCursorBlinkingOnNewActivity_WithFocus,
      testCursorNotBlinkingOnNewActivity_WithoutFocus
Change-Id: I02849f6e105cbfe7af78dfb34ffbf1ebbb4a82ae
2022-09-15 22:42:43 +00:00
Haoyu Zhang
85dfb5e356 Fix: EditText returns wrong CursorAnchorInfo matrix
Bug: 245025737
Test: tested manually
Change-Id: Ia8b0b25582cc89b5729cebc27426f54bc3d8007d
2022-09-15 08:06:09 -07:00
TreeHugger Robot
268f971575 Merge "Cancel selection animation when new selection arrives" 2022-09-13 12:56:07 +00:00
Zeyin Wu
8d937f340a Merge "Send AccessibilityEvent.CONTENT_CHANGE_TYPE_INVALID when TextView set errors" 2022-09-12 16:45:38 +00:00
Seigo Nonaka
8a147ba6dc Merge "Implement Ctrl+B/I/U shorcut" 2022-09-09 04:19:47 +00:00
Zeyin Wu
7f8a4a2ff3 Send AccessibilityEvent.CONTENT_CHANGE_TYPE_INVALID when TextView set
errors

Bug: 230141621
Test: atest android.widget.cts.TextViewTest & verified on talkback_tests
Change-Id: I35f60820a5f366f186ff500cbbc77f45c278660d
2022-09-08 19:52:12 +00:00
Seigo Nonaka
9a13cec9a1 Cancel selection animation when new selection arrives
The onAnimationEnd callback will set the selection but there is a race
condition that the new selection may arrive during animation.
The later selection should be honored, so cancel the ongoing animation
before starting new selection.

Bug: 244273440
Test: Manually done on the Pixel 5 with wireless mouse
Change-Id: I977f6cc9244e571caddfe0d79e10ee1c6c8a413d
2022-09-08 18:03:04 +09:00
Seigo Nonaka
66260c6045 Implement Ctrl+B/I/U shorcut
These shortcut works as follows:

- If the selected region is empty, do nothing.
- If the selected region has at least one character that is not styled,
  e.g. bold, apply bold style.
- If the selected region is fully styled, e.g. bold, remove bold style
  from the region.

The default TextView/EditText supports styled editing, but it is used
commonly as plain text fields, e.g. email address in the form, etc.
So, not to style the text in such places, disable styled shortcut by
 default and let developers to enable it when necessary.

Bug: 240628246
Test: TextViewStyleShortcutTest
Change-Id: Id0f1cd85eb198553a852c5c2b628f5d03a2741e1
2022-09-08 13:41:42 +09:00
Haoyu Zhang
7cf6d0618c Merge "Checking TextOperationUser when initialize stylus handwriting" 2022-09-02 09:05:15 +00:00