DateUtils.formatSameDayTime() test is also updated, because the javadoc
refers to j.t.DateFormat directly. It makes sense to follow
j.t.DateFormat behavior.
The rest of a.t.f.DateUtils is not updated because it's used for
different purposes, e.g. date/time interval, relative date/time, duration, etc.
'\u202f' NNBS character use is acceptable in this case because
it's unlikely being parsed.
Bug: 266731719
Test: atest FrameworksCoreTests:android.text.format
Test: atest CtsTextTestCases:android.text.format
Change-Id: Ib5c916e2b7a66a5faef7bf214be25db88213d91d
Any key that outputs a Unicode character will allow the user to
exit the "active mode" that allows them to compose special
characters. However, pressing Escape doesn't do anything, as it
will not output any Unicode character.
This change adds an extra condition to exit active mode by pressing
the Escape key.
Bug: 271671045
Test: Flashed phone, confirmed that pressing Escape will cancel the
input of an accented character
Change-Id: Id3d04758c9fd4cdb65016cca3af30f611b7011e4
This CL utilized minikin:isGraphemeBreak to compute all grapheme break indices when creating GraphemeClusterSegmentFinder. This makes all methods (such as #nextStartBoundary) of GraphemeClusterSegmentFinder O(1) instead of O(n).
Bug: 271004887
Test: atest TextViewHandwritingGestureTest
Change-Id: I61c1f2c45123a584456b4860b72cd4fdc84c5f1c
At the moment, holding a dead key will result in the insertion of
multiple characters. However, it's likely that was not the user
intention, so this CL addresses that.
Test: Built and tested on a test device
Bug: 266536908
Change-Id: I10b2d1865a3e789a3ee7c27a0358bfc8b9bd4d71
This CL supports OffsetMapping internally for the TextView's
TransformationMethod. It make it possible for TransformationMethod to
alter the original text's length. It'll be mainly used for the insertion
mode feature requested by stylus handwriting.
This CL checked all index access to Layout from Editor, TextView and
MovementMethod. And make sure they are aware of the text transformation.
When there isn't a TransformationMethod or the TransformationMethod
returns a text that's not an instance of OffsetMapping, the existing
behavior is not impacted.
The following classes will support a transformed text with OffsetMapping:
- InsertionPointCursorController, SelectionModifierCursorController
- InsertionHandleView, SelectionHandleView, HandleView
- PinnedPopupWindow, EasyEditPopupWindow, SuggestionsPopupWindow
- SelectionActionModeHelper
The following parts don't support OffsetMapping, but instead will
direclty return false/null or become no-op when OffsetMapping is used:
- CursorAnchorInfoNotifier, CursorAnchorInfo
- TextBoundsInfo
- TextView HandwritingGesture
- Selection move methods
- LinkMovementMethod
- BaseKeyListener
Bug: 242089987
Test: atest DynamicLayoutTransformedTextTest
Test: manually test
Change-Id: I2ad2c2148353e69214efd9aae04a69a6367d0981
To be used by unbundled glyph drawing code to filter codepoint sequences
excluded on this platform.
Bug: b/242678495
Test: CodepointExclusionsTest
Merged-In: If928e35a162f5c9bda506a641ce6595855e3e399
(cherry-pick)
Change-Id: I5d43adddba59619b479fe096a656c796380fc97d
CommonTypos linter complained about this in the generated reference doc.
No changes to source code, just doc comment.
Bug: 263824202
Change-Id: I715f841f1d8d5680472bca1d92f754781f1c8bf9
Test: [go/abtd test]
To be used by unbundled glyph drawing code to filter codepoint sequences
excluded on this platform.
Bug: b/242678495
Test: CodepointExclusionsTest
Change-Id: If928e35a162f5c9bda506a641ce6595855e3e399
family-list can be used as a named font family definition.
Multiple families can be used as a fallback for the named
family.
Bug: 249787583
Test: atest TypefaceSystemFallbackTest FontListParserTest
Test: atest UpdatableFontDirTest UpdatableSystemFontTest
Test: atest GtsFontHostTestCases FontManagerTest
Change-Id: Ic459a533ac4b5081660c0a4a7519ef7e87a6b628
This commit is part of a large scale change to fix errorprone
errors that have been downgraded to warnings in the android
source tree, so that they can be promoted to errors again.
The full list of changes include the following, but not all
will be present in any one individual commit:
BadAnnotationImplementation
BadShiftAmount
BanJNDI
BoxedPrimitiveEquality
ComparableType
ComplexBooleanConstant
CollectionToArraySafeParameter
ConditionalExpressionNumericPromotion
DangerousLiteralNull
DoubleBraceInitialization
DurationFrom
DurationTemporalUnit
EmptyTopLevelDeclaration
EqualsNull
EqualsReference
FormatString
FromTemporalAccessor
GetClassOnAnnotation
GetClassOnClass
HashtableContains
IdentityBinaryExpression
IdentityHashMapBoxing
InstantTemporalUnit
InvalidTimeZoneID
InvalidZoneId
IsInstanceIncompatibleType
JUnitParameterMethodNotFound
LockOnBoxedPrimitive
MathRoundIntLong
MislabeledAndroidString
MisusedDayOfYear
MissingSuperCall
MisusedWeekYear
ModifyingCollectionWithItself
NoCanIgnoreReturnValueOnClasses
NonRuntimeAnnotation
NullableOnContainingClass
NullTernary
OverridesJavaxInjectableMethod
ParcelableCreator
PeriodFrom
PreconditionsInvalidPlaceholder
ProtoBuilderReturnValueIgnored
ProtoFieldNullComparison
RandomModInteger
RectIntersectReturnValueIgnored
ReturnValueIgnored
SelfAssignment
SelfComparison
SelfEquals
SizeGreaterThanOrEqualsZero
StringBuilderInitWithChar
TreeToString
TryFailThrowable
UnnecessaryCheckNotNull
UnusedCollectionModifiedInPlace
XorPower
See https://errorprone.info/bugpatterns for more
information on the checks.
Bug: 253827323
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I8446f9076a45ebf7e7ffa06cb0d4ddb1001b6c00
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
Since Unicode 12, emoji modifier sequences (such as human + light skin
tone) can be combined with zwj. However, current backspace state machine
ignores that and stops when one emoji modifier sequence is found. This
CL make the state machine continue exploration as long as a zwj is found
before an emoji modifier sequence.
BYPASS_INCLUSIVE_LANGUAGE_REASON="man" is the name of the emoji
Bug: 171495034
Test: Do the following:
- Enter an emoji from the "family" subgroup with different skin tones
combined such as 1F468 1F3FE 200D 2764 FE0F 200D 1F48B 200D 1F468
"kiss: man, man, medium-dark skin tone, light skin tone"
- Press the backspace key and confirm that the entire emoji is deleted.
Change-Id: I260f509832cb24486665019d68a25db0ad089d7e
This is an API for IME to request text bounds information from editor to
perform handwriting rich gestures. It's useful for IMEs to create custom
handwriting gesture that's not supported the HandwritingGesture. And
it can also be used to provide default rich gesture implementation for
handwriting gesture compatibility.
Bug: 239843501
Test: atest TextBoundsInfoTest
Change-Id: Ia7522371976a4e1fcdff4cc0d244ea427ad3d7c9
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
To avoid making WordIterator public, WordSegmentFinder has a public
constructor taking a Locale parameter. The constructor taking a
WordIterator parameter is kept but hidden so TextView can use it.
LayoutGetRangeForRectTest is moved to CTS.
Bug: 243969224
Test: atest android.text.cts.LayoutGetRangeForRectTest
Test: atest android.widget.cts.TextViewHandwritingGestureTest
Change-Id: Ibb829af0324c47e4d275b0ccd69d0f95601e3c08
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
It was supposed to be enabled in S, but we missed it due to
https://r.android.com/1490737
Test: android.text.format.DateFormatTest
Change-Id: I0f6495bf2e4434396606743da1e32a39a54a0b19
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