diff options
author | Gilles Debunne <debunne@google.com> | 2012-05-09 11:49:08 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-05-09 11:49:08 -0700 |
commit | 12ff149265ba599627896f6c1a0e3ea9721b54c1 (patch) | |
tree | 13726b2aff85843643098f7028ed5fd57407f5af /core/java/android/widget | |
parent | ca81b7ddebe7654c0f4666e1ba5440c0ec81b3d6 (diff) | |
parent | 41347e9e8bff93f42ac11a88875ce67e64e5c88c (diff) | |
download | frameworks_base-12ff149265ba599627896f6c1a0e3ea9721b54c1.zip frameworks_base-12ff149265ba599627896f6c1a0e3ea9721b54c1.tar.gz frameworks_base-12ff149265ba599627896f6c1a0e3ea9721b54c1.tar.bz2 |
Merge "Spell checker underlines words even when there are no suggestions" into jb-dev
Diffstat (limited to 'core/java/android/widget')
-rw-r--r-- | core/java/android/widget/SpellChecker.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/java/android/widget/SpellChecker.java b/core/java/android/widget/SpellChecker.java index 11e15df..ebf8a4a 100644 --- a/core/java/android/widget/SpellChecker.java +++ b/core/java/android/widget/SpellChecker.java @@ -427,12 +427,6 @@ public class SpellChecker implements SpellCheckerSessionListener { if (spellCheckSpanStart < 0 || spellCheckSpanEnd <= spellCheckSpanStart) return; // span was removed in the meantime - final int suggestionsCount = suggestionsInfo.getSuggestionsCount(); - if (suggestionsCount <= 0) { - // A negative suggestion count is possible - return; - } - final int start; final int end; if (offset != USE_SPAN_RANGE && length != USE_SPAN_RANGE) { @@ -443,9 +437,15 @@ public class SpellChecker implements SpellCheckerSessionListener { end = spellCheckSpanEnd; } - String[] suggestions = new String[suggestionsCount]; - for (int i = 0; i < suggestionsCount; i++) { - suggestions[i] = suggestionsInfo.getSuggestionAt(i); + final int suggestionsCount = suggestionsInfo.getSuggestionsCount(); + String[] suggestions; + if (suggestionsCount > 0) { + suggestions = new String[suggestionsCount]; + for (int i = 0; i < suggestionsCount; i++) { + suggestions[i] = suggestionsInfo.getSuggestionAt(i); + } + } else { + suggestions = ArrayUtils.emptyArray(String.class); } SuggestionSpan suggestionSpan = new SuggestionSpan(mTextView.getContext(), suggestions, @@ -453,7 +453,7 @@ public class SpellChecker implements SpellCheckerSessionListener { // TODO: Remove mIsSentenceSpellCheckSupported by extracting an interface // to share the logic of word level spell checker and sentence level spell checker if (mIsSentenceSpellCheckSupported) { - final long key = TextUtils.packRangeInLong(start, end); + final Long key = Long.valueOf(TextUtils.packRangeInLong(start, end)); final SuggestionSpan tempSuggestionSpan = mSuggestionSpanCache.get(key); if (tempSuggestionSpan != null) { if (DBG) { |