Commit Graph

428 Commits

Author SHA1 Message Date
Alon Albert
815af1ff59 Merge "Throw NPE if s is null" 2012-01-26 17:05:58 -08:00
Alon Albert
11afa8a466 Throw NPE if s is null
Bug: 5926510
Change-Id: I3d0a38d31695a8b103b3d153d90d83474f56990e
2012-01-26 14:25:19 -08:00
Gilles Debunne
6e0b22bea9 Modified algorithm to remove duplicated suggestions
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
2012-01-25 15:07:50 -08:00
Gilles Debunne
ba3634f355 Fix for AOOB in MeasuredText
Bug 5707593

Change-Id: I3c21343b2938119d7ae9d7892733dc83a209c991
2012-01-23 16:36:35 -08:00
Gilles Debunne
004b02d626 Touch moves cursor in text refactored
Code was moved back from the movement method to the touch event code in TextView.

Change-Id: I7dc0d957554ddce08e810d20e0385f98802ef1a4
2012-01-19 14:18:17 -08:00
Gilles Debunne
78efa026c7 am 0d3a5e4c: am 67d54ac0: Merge "NPE in GMail / TextLine" into ics-mr1
* commit '0d3a5e4cbddc9a6a0a551698b5152c815842952a':
  NPE in GMail / TextLine
2011-12-13 13:42:07 -08:00
Gilles Debunne
fc997b4f78 NPE in GMail / TextLine
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
2011-12-13 12:37:02 -08:00
Gilles Debunne
ba36428502 am 8e22ec9b: am a1277de3: Merge "Prevent a memory leak in TextLine." into ics-mr1
* commit '8e22ec9bc6c59d9e54a6b48f1133881be97af1a7':
  Prevent a memory leak in TextLine.
2011-12-12 17:49:31 -08:00
Gilles Debunne
c3fb7a11ad Prevent a memory leak in TextLine.
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
2011-12-12 14:03:40 -08:00
Gilles Debunne
e495cc3fd9 am e912a16b: am 316ca505: Merge "Re-use SpanSets in TextLine" into ics-mr1
* commit 'e912a16ba2a6e913b47893bc99c9a846d7ce80a9':
  Re-use SpanSets in TextLine
2011-12-12 13:15:46 -08:00
Joe Malin
c789b60076 am 8e94d912: am 556e4ca5: am 0a9005ed: Merge "DOC CHANGE: Package text and Formatter javadoc" into ics-mr0
* commit '8e94d912c6e0fc3c6d5e992b6559a0efc20372be':
  DOC CHANGE: Package text and Formatter javadoc
2011-12-12 13:15:36 -08:00
Gilles Debunne
2afcfa4239 resolved conflicts for merge of 5371a165 to master
Change-Id: I61830ec96c277ebba9db3e40842597b9c98d53c7
2011-12-09 18:06:34 -08:00
Gilles Debunne
47a4b78eb7 am 9f4b70c7: am 89f2e8a0: Merge "Prevent NPE in SuggestionSpan" into ics-mr1
* commit '9f4b70c72508077f39a71bb17df265eb883c7a20':
  Prevent NPE in SuggestionSpan
2011-12-09 14:25:53 -08:00
Gilles Debunne
316ca5059e Merge "Re-use SpanSets in TextLine" into ics-mr1 2011-12-08 17:58:24 -08:00
Joe Malin
556e4ca541 am 0a9005ed: Merge "DOC CHANGE: Package text and Formatter javadoc" into ics-mr0
* commit '0a9005ed58d3a6173e8fffbd72933f7646c6fdba':
  DOC CHANGE: Package text and Formatter javadoc
2011-12-08 17:44:34 -08:00
Gilles Debunne
c1f4483080 Re-use SpanSets in TextLine
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
2011-12-08 16:03:00 -08:00
Gilles Debunne
0e7b8020fd Merge "Limit created string size in Spell Checker" into ics-mr1 2011-12-08 11:56:28 -08:00
Joe Malin
41e2e1f991 DOC CHANGE: Package text and Formatter javadoc
Change-Id: Ia34bf38d07b474522f65b89db4991c32909ecff2
2011-12-07 15:24:25 -08:00
Gilles Debunne
653d3a2787 Limit created string size in Spell Checker
Change-Id: I2f4e7a8b0022d76bc30199ff80c2fe637dbe03ef
2011-12-07 10:40:09 -08:00
Gilles Debunne
c5436f204b Prevent NPE in SuggestionSpan
One SuggestionSpan constructor provide null as the default context.

This will always create an NPE in initStyle. Prevent this.

Change-Id: Ic2acffd2c8b9cda9c99b689d1b1a7f15d17b65d0
2011-12-06 10:29:08 -08:00
Gilles Debunne
58d8953958 Merge "Scroll performance improved in multiline TextEdit" into ics-mr1 2011-12-01 15:04:35 -08:00
Gilles Debunne
8a439ac7a3 Performance improvement in TextView
Using a SpanSet to minimize the number the calls to getSpans.

This is a cherry pick of 145653 in ICS-MR1

Change-Id: I0a6e1fc7bd7a89325c2925bf98d59626d5e12995
2011-11-29 17:53:40 -08:00
Gilles Debunne
70b34a1e05 Scroll performance improved in multiline TextEdit
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
2011-11-29 17:48:19 -08:00
Owen Lin
4cf8a3914a am 85c38af1: am 8bb56180: Merge "Fix 5654631. It forgot to consider the year in formatDateRange." into ics-mr1
* commit '85c38af1d47e288775052cd188e3f014fa40e8a2':
  Fix 5654631. It forgot to consider the year in formatDateRange.
2011-11-22 17:48:49 -08:00
Owen Lin
b193e35ed1 Fix 5654631. It forgot to consider the year in formatDateRange.
Change-Id: I494e3ecc7a2e7c418ed61930ffd7311338c11783
fix: 5654631
2011-11-22 15:36:50 +08:00
Jesse Wilson
99a64f4b1d Document our potentially suprising behavior on date ranges ending at midnight.
Bug: http://code.google.com/p/android/issues/detail?id=18512
Change-Id: I968ca1cfcef79273ee856624a640d56b038b96be
2011-11-11 11:03:21 -05:00
Gilles Debunne
e03ba026c6 Merge "Performance improvement in TextView" 2011-10-28 15:26:22 -07:00
Gilles Debunne
4e13ebed6b Merge changes I2082e3d0,Ibf8e9827
* changes:
  Scroll performance improved in multiline TextEdit
  Performance improvements for long text edition.
2011-10-28 15:26:07 -07:00
Gilles Debunne
f2a02018e2 Scroll performance improved in multiline TextEdit
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
2011-10-27 14:00:56 -07:00
Gilles Debunne
a30946e820 Performance improvement in TextView
Using a SpanSet to minimize the number the calls to getSpans.

Change-Id: I0a6e1fc7bd7a89325c2925bf98d59626d5e12995
2011-10-26 16:41:30 -07:00
satok
0f0a3945ef Make FLAG_AUTO_CORRECTION public
Bug: 5440299

Change-Id: Ia82745e793be741c1558ce15b189b63872107ddb
2011-10-26 15:13:28 +09:00
Gilles Debunne
d300e75eff Wrong word cut at end of lines with spaces
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
2011-10-18 15:10:31 -07:00
Gilles Debunne
9d8d3f1539 Spell checher's language synced with keyboard.
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
2011-10-13 16:52:42 -07:00
Gilles Debunne
59ba2b2fab Merge "Bug 5250788: LatinIME slows down as amount of Text increases" 2011-10-10 10:54:51 -07:00
satok
9ca4b4377c Add a hidden flag for the auto correction indicator in SuggestionSpan
Bug: 5245468

Change-Id: Ic111554da86fefd47dd9a26c1bd41e4ee57dc552
2011-10-10 16:38:33 +09:00
Gilles Debunne
287d6c6e12 Bug 5250788: LatinIME slows down as amount of Text increases
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
2011-10-07 13:27:52 -07:00
Fabrice Di Meglio
e921572bda Merge "Revert "Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)"" 2011-10-04 17:24:37 -07:00
Fabrice Di Meglio
ad0b051b13 Revert "Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)"
This reverts commit a130e5f59d
2011-10-04 17:21:26 -07:00
Gilles Debunne
67ed574cdb Merge "Bug 5250788: EditText gets slower has the entered text gets longer" 2011-09-30 10:57:51 -07:00
Fabrice Di Meglio
46c78b4de1 Merge "Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)" 2011-09-29 17:53:09 -07:00
Fabrice Di Meglio
a130e5f59d Fix bug #5387832 [UI/Visual] Address of the website is not displayed properly(second line of the address is partly shown)
- make DynamicLayout honor max lines
- make StaticLayout.generate() take maxLines as a parameter instead of using the field mMaximumVisibleLineCount

Change-Id: I9eafb1be4b8bb2aa881514955a6903f559cb6a1e
2011-09-29 12:44:16 -07:00
Gilles Debunne
f4314dffbd Merge "Too many SpellCheckSpans are created." 2011-09-29 10:20:46 -07:00
Scott Main
31e04656e7 docs: add some more info to Time javadocs
Change-Id: I3c5ca668acda734f8a0da0ffbbc1bfa77ed72c2a
2011-09-28 21:36:51 -07:00
Gilles Debunne
d5ea0a1bc2 Bug 5250788: EditText gets slower has the entered text gets longer
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
2011-09-28 19:04:30 -07:00
Gilles Debunne
b062e81e3a Too many SpellCheckSpans are created.
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
2011-09-27 15:06:52 -07:00
Gilles Debunne
52edaa9cfb Merge "Bug 5250788: TextView gets slower as the text length grows" 2011-09-26 14:18:14 -07:00
Fabrice Di Meglio
8013290dd0 Merge "Fix bug #5366547 TruncateAt.MARQUEE should be replaces with "two dot" ellipsis on hardware that dont support MARQUEE" 2011-09-26 12:16:41 -07:00
Fabrice Di Meglio
09175735c5 Fix bug #5344067 android.text.DynamicLayout.sStaticLayout can hold onto an Activity, potential memory leak
- make the StaticLayout constructor not depending on the text as we just need the "generate()" call to be done

Change-Id: I65249e65ed6446b6ac13dbf8c8f58fcdf54046cb
2011-09-25 16:48:04 -07:00
Fabrice Di Meglio
cb332649e4 Fix bug #5366547 TruncateAt.MARQUEE should be replaces with "two dot" ellipsis on hardware that dont support MARQUEE
- introduce TruncateAt.END_SMALL
- code refactoring for suppressing use of hardcoded constants

Change-Id: I70e24857cd5d6bd012a743cbc0ba46fbd06d5457
2011-09-25 14:39:27 -07:00
Fabrice Di Meglio
ba7bc59101 Merge "Fix bug #5349461 TextView: text that ends with an ImageSpan causes line height to shrink to ImageSpan height" 2011-09-23 15:18:37 -07:00