diff options
author | Gilles Debunne <debunne@google.com> | 2011-09-09 09:20:12 -0700 |
---|---|---|
committer | Gilles Debunne <debunne@google.com> | 2011-09-09 17:01:31 -0700 |
commit | c9fd978da60f76c0576150c55629a034e1fa19fb (patch) | |
tree | 09bbf3fd67ab777213d699006c240ea0dc884efc /core/java/android/text/TextLine.java | |
parent | 51322732739b355dd842abc9cef34df8613b2626 (diff) | |
download | frameworks_base-c9fd978da60f76c0576150c55629a034e1fa19fb.zip frameworks_base-c9fd978da60f76c0576150c55629a034e1fa19fb.tar.gz frameworks_base-c9fd978da60f76c0576150c55629a034e1fa19fb.tar.bz2 |
Bug 5281947: add to dictionnary option promoted in suggestions.
When several SuggestionSpans are available at a given position, their
content are merged, in creation time order.
As a result, the IME's suggestions are picked before the spell check, and
no add to dictionnary option is created.
This CL modifies the comparator to make easy correction spans appear first
(Voice IME), then misspelled words and then regular suggestions.
Also avoids the creation of a new comparator and length hash map on every display.
Change-Id: I1f9f031a6fdcbbc09f248a192b83051092765f8e
Diffstat (limited to 'core/java/android/text/TextLine.java')
-rw-r--r-- | core/java/android/text/TextLine.java | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java index 68a6b3e..a52d48e 100644 --- a/core/java/android/text/TextLine.java +++ b/core/java/android/text/TextLine.java @@ -723,7 +723,7 @@ class TextLine { float ret = 0; int contextLen = contextEnd - contextStart; - if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineCount != 0 || runIsRtl))) { + if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) { int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR; if (mCharsValid) { ret = wp.getTextRunAdvances(mChars, start, runLen, @@ -753,7 +753,7 @@ class TextLine { wp.setColor(previousColor); } - if (wp.underlineCount != 0) { + if (wp.underlineColor != 0) { // kStdUnderline_Offset = 1/9, defined in SkTextFormatParams.h float underlineTop = y + wp.baselineShift + (1.0f / 9.0f) * wp.getTextSize(); @@ -764,11 +764,8 @@ class TextLine { wp.setStyle(Paint.Style.FILL); wp.setAntiAlias(true); - for (int i = 0; i < wp.underlineCount; i++) { - wp.setColor(wp.underlineColors[i]); - c.drawRect(x, underlineTop, x + ret, underlineTop + wp.underlineThicknesses[i], - wp); - } + wp.setColor(wp.underlineColor); + c.drawRect(x, underlineTop, x + ret, underlineTop + wp.underlineThickness, wp); wp.setStyle(previousStyle); wp.setColor(previousColor); |