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
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
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
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
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
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
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
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
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
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
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
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