Merge "Bug 5237623: word no longer underlined after replacement"
This commit is contained in:
committed by
Android (Google) Code Review
commit
ba25c01335
@@ -249,7 +249,6 @@ public class SpellChecker implements SpellCheckerSessionListener {
|
|||||||
final int spanEnd = editable.getSpanEnd(suggestionSpans[i]);
|
final int spanEnd = editable.getSpanEnd(suggestionSpans[i]);
|
||||||
if (spanStart != start || spanEnd != end) {
|
if (spanStart != start || spanEnd != end) {
|
||||||
suggestionSpans[i] = null;
|
suggestionSpans[i] = null;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9607,15 +9607,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
SpannableStringBuilder text = new SpannableStringBuilder();
|
SpannableStringBuilder text = new SpannableStringBuilder();
|
||||||
TextAppearanceSpan highlightSpan = new TextAppearanceSpan(mContext,
|
TextAppearanceSpan highlightSpan = new TextAppearanceSpan(mContext,
|
||||||
android.R.style.TextAppearance_SuggestionHighlight);
|
android.R.style.TextAppearance_SuggestionHighlight);
|
||||||
|
|
||||||
void removeMisspelledFlag() {
|
|
||||||
int suggestionSpanFlags = suggestionSpan.getFlags();
|
|
||||||
if ((suggestionSpanFlags & SuggestionSpan.FLAG_MISSPELLED) > 0) {
|
|
||||||
suggestionSpanFlags &= ~SuggestionSpan.FLAG_MISSPELLED;
|
|
||||||
suggestionSpanFlags &= ~SuggestionSpan.FLAG_EASY_CORRECT;
|
|
||||||
suggestionSpan.setFlags(suggestionSpanFlags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SuggestionAdapter extends BaseAdapter {
|
private class SuggestionAdapter extends BaseAdapter {
|
||||||
@@ -9931,6 +9922,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
suggestionSpansStarts[i] = editable.getSpanStart(suggestionSpan);
|
suggestionSpansStarts[i] = editable.getSpanStart(suggestionSpan);
|
||||||
suggestionSpansEnds[i] = editable.getSpanEnd(suggestionSpan);
|
suggestionSpansEnds[i] = editable.getSpanEnd(suggestionSpan);
|
||||||
suggestionSpansFlags[i] = editable.getSpanFlags(suggestionSpan);
|
suggestionSpansFlags[i] = editable.getSpanFlags(suggestionSpan);
|
||||||
|
|
||||||
|
// Remove potential misspelled flags
|
||||||
|
int suggestionSpanFlags = suggestionSpan.getFlags();
|
||||||
|
if ((suggestionSpanFlags & SuggestionSpan.FLAG_MISSPELLED) > 0) {
|
||||||
|
suggestionSpanFlags &= ~SuggestionSpan.FLAG_MISSPELLED;
|
||||||
|
suggestionSpanFlags &= ~SuggestionSpan.FLAG_EASY_CORRECT;
|
||||||
|
suggestionSpan.setFlags(suggestionSpanFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final int suggestionStart = suggestionInfo.suggestionStart;
|
final int suggestionStart = suggestionInfo.suggestionStart;
|
||||||
@@ -9939,8 +9938,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
|||||||
suggestionStart, suggestionEnd).toString();
|
suggestionStart, suggestionEnd).toString();
|
||||||
editable.replace(spanStart, spanEnd, suggestion);
|
editable.replace(spanStart, spanEnd, suggestion);
|
||||||
|
|
||||||
suggestionInfo.removeMisspelledFlag();
|
|
||||||
|
|
||||||
// Notify source IME of the suggestion pick. Do this before swaping texts.
|
// Notify source IME of the suggestion pick. Do this before swaping texts.
|
||||||
if (!TextUtils.isEmpty(
|
if (!TextUtils.isEmpty(
|
||||||
suggestionInfo.suggestionSpan.getNotificationTargetClassName())) {
|
suggestionInfo.suggestionSpan.getNotificationTargetClassName())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user