Bug 5916225
Duplicates were removed when received from SpellChecker, in a way
that could move the top candidates lower in the list.
Moved that code to the part that creates the actual suggestion list,
to make it more generic. The order of the first SuggestionSpan is
guaranteed to be respected.
Also mentionned non null suggestions and fixed a problem in SuggestionSpan
constructor.
Change-Id: Iaa3b1b84ae512451e439e5c5e63448c2a19145b5
Bug 5753061
https://android-git.corp.google.com/g/#/c/154756/1 revealed an
other bug in SpanSet. The fitered (non empty) spans were added
in their original position instead of being indexed by count.
The nullation on recycle hence left null holes in the array.
Change-Id: If5c1435cee9a2cb88a608aa8e5f4f2f23382154c
Bug 5740435
The new SpanSet cached objects should be recycled when the TextLine is
recycled to prevent a reference to their span, which may lead to the
entire activity.
Change-Id: I4469e418a228bd71eb8be1d43ed86de49baba165
TextLine objects are already stored in a pool to limit allocation.
Associate SpanSet objects to each TextLine to further limit the
allocation of these and re-use their internal arrays (re-sized if needed).
Drastically reduces new objects allocation during rendering.
Priority code removed in init: priorities are already handled by getSpans.
This is a duplicate of the already accepted
https://android-git.corp.google.com/g/#/c/153970/
but without the dependency on an other CL.
Change-Id: Iaa7e2f7a8ea4337c8d60c3a9a620e9e3e60caf12
One SuggestionSpan constructor provide null as the default context.
This will always create an NPE in initStyle. Prevent this.
Change-Id: Ic2acffd2c8b9cda9c99b689d1b1a7f15d17b65d0
Using a SpanSet to minimize the number the calls to getSpans.
This is a cherry pick of 145653 in ICS-MR1
Change-Id: I0a6e1fc7bd7a89325c2925bf98d59626d5e12995
Measuring line widths, glyph by glyph slows down the scrolling
process for long text (for some reason, width measure efficiency
is affectedi by text length, maybe because the whole text has to
be passed to JNI layers).
This optimization avoids this computation in the case where there
is no possible horizontal scroll.
This is a cherry pick of 145957 into ICS-MR1
Change-Id: I2082e3d0eedace1a86122a03e4b21f90f3bc8522
Measuring line widths, glyph by glyph slows down the scrolling
process for long text (for some reason, width measure efficiency
is affectedi by text length, maybe because the whole text has to
be passed to JNI layers).
This optimization avoids this computation in the case where there
is no possible horizontal scroll.
Change-Id: I2082e3d0eedace1a86122a03e4b21f90f3bc8522
Bug 5185017: when the line length is exceeded at a space character,
we use the previous ok width, and the last word is wrapped to next line
although it fits.
This back-track also generates problem with the span parsing, where the
spanStart indexes are no longer monotonuously increasing.
Plus some refactoring in this code (unused parameters, calls to out())
Change-Id: Ia8cd310a732752af3bd370bf0a16db23d40e83f2
Bug 5379440. The spell check is now using the IME's language to
do the spell checking. Changing the input language triggers a
new spell check of the entire text.
Optimizations: ArrowKeyMovementMethod re-uses the TextView's
wordIterator, already set to the correct language.
One wordIterator shared by all SpellParsers in SpellChecker.
Cannot re-use TextView's because of concurrency issues.
With the current implementation, one has to type a new character
to see the new spell checking take place.
Change-Id: I0e460c0a6777548f89d03d6b68f3deea6606c17f
Removed unnecessary CharSequenceIterator and made the WordIterator
work on String instead of CharSequence
Submit words to the spell checker by batches.
Refactored WordIterator to make it intrinsically local.
Change-Id: Ie9e30691985a130fa55cd052005ddb22a21761cb
- make DynamicLayout honor max lines
- make StaticLayout.generate() take maxLines as a parameter instead of using the field mMaximumVisibleLineCount
Change-Id: I9eafb1be4b8bb2aa881514955a6903f559cb6a1e
Profiling showed that the bottle neck was in the word iterator.
Now initializing the word iteerator to only a window around the region
of interest to reduce the text analysis.
Change-Id: Ibfa4952cbf52a1b36726f965143ac7a6dc63673e
Removed the Runnable in SpellChecker, spell check is triggered at the end
of updateSpellCheckSpans instead of when a new SpellCheckSpan is created.
Cache the spans in updateSpellCheckSpans to limit the calls to getSpans.
When typing, every new letter in a word will create a SpellCheckSpan
(this is needed in case the user taps somewhere else on the screen)
The SpellCheckSpans are pooled in SpellChecker to limit unnecessary new
SpellCheckSpan creation.
Minor optimization on test order in getSpans to avoid some calculation.
Spell check is not started everytime the selection is changed (would be
triggered when the insertion handle is moved). Explicitely do that only
on tap.
Change-Id: Ibacf80dd4ba098494e0b5ba0e58a362782fc8f71
- make the StaticLayout constructor not depending on the text as we just need the "generate()" call to be done
Change-Id: I65249e65ed6446b6ac13dbf8c8f58fcdf54046cb