From c9fd978da60f76c0576150c55629a034e1fa19fb Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Fri, 9 Sep 2011 09:20:12 -0700 Subject: 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 --- core/java/android/text/TextLine.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'core/java/android/text/TextLine.java') diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java index 68a6b3e7823e..a52d48e630d1 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); -- cgit v1.2.3