- Remove mouse selection related logic from
ArrowKeyMovementMethod and Touch.
- Extend drag accelerator to support character based
selection by dragging and use it for mouse drag selection.
- Enable word based drag accelerator even if the clicked
position is not on a word.
- Disable y-coordinate adjustment for word based drag
accelerator when the user is using a mouse.
Bug: 19544351
Change-Id: I1b29a65be3d321ac472f8c5b70ab6fee4e895964
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.
Bug: 25757239
Change-Id: Ib38a0fa2dd2a3d68e467f78a812071e763d7e881
Previously, paragraphs with ImageSpans in their middle would continue to
carry the height of the image into the line height of next lines. This was
a regression from L.
The bug was due to StaticLayout's out() method almost always
modifying the value of its parameter "fm", although that was only
intended when there were LineHeightSpans in the text. The method
generate() was assuming that it can restore fmTop etc to metrics of
the current span by setting them from "fm" after out() was run, while
"fm" was modified by out() and its original values was lost!
The fix makes sure to set chooseHt back to null if there were no
LineHeightSpans, so out() would not modify "fm" unless necessary.
AOSP bug: https://code.google.com/p/android/issues/detail?id=188042
Bug: 24548073
Change-Id: I0d00af384c35a9d863377972318da9db7668118f
Support for loading the pre-compiled binary format for hyphenation
patterns.
Bug: 21562869
Bug: 21826930
Bug: 24570591
Change-Id: Iaeaa9c9ac9dac236af6b0d7894c2e2396bc8447d
(cherry picked from commit 091dba2de1)
Previously, a native pointer was returned. After this change, callers
should call getNativePtr() if they want to get the native pointer instead.
Bug: 21492297
Bug: 24570591
Change-Id: I745bd88e6e8c86078fffb07f90f8d8f24215410c
(cherry picked from commit e7eac6f540)
When a mouse is used, isTouchSelecting for ACTION_UP always
returns false with current implementation because all
DragState spans have been removed in Touch#onTouchEvent.
Change-Id: Ie27a2bb860e9ddeb71dafff361c734a7c727102d
Support for loading the pre-compiled binary format for hyphenation
patterns.
Bug: 21562869
Bug: 21826930
Change-Id: Iaeaa9c9ac9dac236af6b0d7894c2e2396bc8447d
"getLineEnd(line) - 1" is used as the return value when the
"horiz" is beyond the line end for multiple line text.
In this case, the returned value can point an invalid
offset like the middle point of a surrogate pair.
Bug: 23069901
Change-Id: I1afef7205a15079a42bb0018df73f70fe9ada862
This updates the tests to match the older commit
f723017481 and also adds support for
negative values.
Bug: 23191381
Bug: 11237727
Change-Id: Ib9a1f10031b730ee460658949b388c779cefa041
- Clarify that getTrimmedLength() only considers ASCII control
characters as control characters.
- Deprecate getReverse() instead of trying to fix it, as it's really
not meaningful for internationalized text.
- Support non-BMP characters in isDigitsOnly().
Change-Id: I947c449b48c252ecc7f7299145f6f8fbad86004f
Previously, when getSpans() was called with a null parameter, an
unintentional NullPointerException would be thrown.
Now, we explicitly return an empty array of Objects.
Bug: 19805521
Change-Id: I52f3ae08c2bcf62f6a4d0c01f0fe08ad1134abb8
All the three tags, <del>, <s>, and <strike> are now converted to
strikethrough text.
Bug: 21025743
Change-Id: I62dc9793223e266f6e2181169766fde8be0e2aa7
Also deprecate TextUtils.isGraphic(char), since one-code-unit APIS
should not be used for anything in the modern Unicode era.
Bug: 7381642
Change-Id: If4dc573fe5ac870152374ded64fc83594e8dd37e
Previously, BidiFormatter.getInstance() created an unnecessary
pass-through builder object, which was used to return a static
already existing BidiFormatter.
Now, we just return the same static BidiFormatter, without going
through a builder, so we can save some extra allocations.
Bug: 10022222
Change-Id: Ibcb6aac1c1e16d9ec00e93824fa063f8dccdf8cb
The method was deprecated and had only one caller, which is being
replaced with an inline copy of this at the same time.
Bug: 6823087
Change-Id: I7c5b9840ba50c1a9f167102966de63ef1040ab88
There seems to be only one caller of this signature, and even that is
in a deprecated method, so it should be safe to deprecate this.
The new implementation uses ICU for the format string and so removes
the need for a localized string, although it's still a hack and is
probably slower. It's added here since we may actually want to clean
it up later and use it for an improved simple list formatter.
Bug: 6823087
Change-Id: I2aa1af9b170e41da840d9d7bc663df06fb96d136
Previously, a native pointer was returned. After this change, callers
should call getNativePtr() if they want to get the native pointer instead.
Bug: 21492297
Change-Id: I745bd88e6e8c86078fffb07f90f8d8f24215410c
Previously, only the languages written in Arabic and Hebrew were
considered right-to-left. Now, ICU is used to return the direction
of the language, which not only support other right-to-left scripts
(such as Thaana), but also has better logic to determine the
direction of the locale and uses caching to improve the speed.
Bug: 22559274
Change-Id: I760be7984a9b35ea77d59ca84a220798e205af36
DynamicLayout reuses a StaticLayout.Builder object to avoid having to
allocate. There is a "finish" method that releases any expensive
internal state of the builder object, but it didn't release a
reference to the text object (which in turn may contain references to
lots of other things, especially if it's a Spannable).
This patch releases the text, as well as a few other arrays, at time
of finish.
Bug: 22822416
Change-Id: Icc8b6cd41a9a2d11689df7bd1b9f524c6524f706
This patch sets up an "empty" hyphenator, which it uses by default
for locales in which there is no hyphenation pattern data. This has
the effect of enabling soft hyphens (U+00AD), which were otherwise
disabled, because the "no-hyphen" code path didn't consider them.
Bug: 19605972
Change-Id: I4dcb95cee8edc48495f7c38736f5abf26fa04935
The existing implementation of handleText() in TextLine laid out
text to the end of the context. However, in cases where the text is
broken into multiple style spans, it's only valid to lay out up to
the end of the style span. This can lead to inconsistent
measurements, especially in the presence of legitimate zero-width
characters such as bidi control characters and zero width space.
This patch changes the invocation of getRunAdvance to measure only
within the style span.
Bug: 22589743
Change-Id: I027f5e77db27ddf9596ef20adcad7e62a82b41de
The default has been 'true' for eternity in the code. But the
documentation was mistakenly saying it was 'false'. Going with the
code, since there are people out there relying on the code continuing
to work the same way.
Bug: 22557371
Change-Id: I6f4e7b2052d0cc30d41e8ccf2b9a5c6111fa0ab7
Previously, users of the results of formatFileSize() and
formatShortFileSize() needed to unicodeWrap the results themselves
using BidiFormatter, which resulted in several bugs and
inconsistencies across the platform when they didn't, especially in
Hebrew and Urdu locales:
Hebrew and Urdu use Latin abbreviations like 'MB' for file sizes
which cause undesired reorderings (or incorrect detection of the
string direction when the formatted file size starts the string).
With this patch, the results are now bidi-wrapped before being
returned if the locale of the context passed in to the formatter is a
right-to-left locale.
Bug: 22237132
Bug: 22273176
Change-Id: If076636d15828fc810feef6f0fa8806ef52aed5d
The existing documentation is very terse and users were getting
confused whether the method escapes HTML metacharacters or not. Expand
the description a bit and explicitly state that metacharacters are
escaped.
Bug: 17456925
Change-Id: Icaae7fe1344629de5c0860674f3913781de18013
An app setting maxLines = 0 is an edge case, but it can happen. We
had some logic that would index an array at -1 in that case. This
patch just skips the fixup of the ellipsis line break in that case.
Bug: 22353342
Change-Id: I940cf0782b319010f5aedf75b9291df4ac2976d8
Bug: 22378829
Every time setText is called a BoringLayout is created.
BoringLayout internally creates a new Paint called mWorkPaint.
However, creating a Paint turns out to be somewhat substantial
amount of work, and mWorkPaint is never actually used. Deleting
this shaves off roughly 50ms and 1,000 object creations during
a fling on a listview.
Change-Id: I5d03402b9027df6ce0f3e58160752c66c69a4d2d
This patch refines the crude check for potential RTL characters, based
on ranges containing RTL scripts and format characters that affect
bidi. This will make it much less likely that a StaticLayout will be
chosen instead of a BoringLayout.
Bug: 22328919
Change-Id: I9a0ed9b3f3373069052de21c836b3372f175430f