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
Add visible line bounds to CursorAnchorInfo for IME to improve
scribe rich gesture recognization accuracy.
Bug: 215533103
Bug: 239843501
Test: manually tested
Change-Id: I7039b75388ae34d24feb38d18d8da9a91df89504
The ActionMode could be initiated from LinkMovementMethod
which can be handled without Editor instance. So, moving
mLastInputSource member from Editor to TextView.
Test: TextViewIntegrationTest TextViewMouseInteractionTest
Bug: 243922672
Change-Id: I05679f8dbd30fd69e11ed4e315b5b309647ecafb
Cursor continues to blink in a text field even when the text field is
not currently visible. This change checks the visibility of the window
that houses the text field in addition to checking if the view is in
focus.
Bug: 228354442
Test: Added logging to the shouldBlink() method ran following steps:
1: open contacts app
2: tap add new contact, tap in an edit field
3: move back to home screen
4: lock screen, then unlock screen
5: observed logs written out to logcat console when app not
visible.
after change logs no longer printed to console, cursor still blinks
correctly after app is re-opened or when new field becomes in
focus.
Test: CtsWidgetTestCases:EditTextTest#
testCursorNotBlinkingOnNewActivity_WithoutFocus()
testCursorBlinkingOnNewActivity_WithFocus()
testSuspendAndResumeBlinkingCursor()
Change-Id: Iad4396e5f7fd810344c711320d65c57ea25eda70
Merged-In: Iad4396e5f7fd810344c711320d65c57ea25eda70