diff options
author | 2012-10-03 15:19:43 +0900 | |
---|---|---|
committer | 2012-10-22 11:03:28 -0700 | |
commit | bc464e2952e102219f0b977fc1e9140ad5bd03e4 (patch) | |
tree | d471ffc3b1d91eb6b99c9868ed9fd6ccc242dff4 /java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java | |
parent | 243c1fecc61f4cf0a5fda3143987902f0bf4fa9d (diff) | |
download | latinime-bc464e2952e102219f0b977fc1e9140ad5bd03e4.tar.gz latinime-bc464e2952e102219f0b977fc1e9140ad5bd03e4.tar.xz latinime-bc464e2952e102219f0b977fc1e9140ad5bd03e4.zip |
Replace useless CharSequence to String
Change-Id: Idc478f901185ee1b4912acc82d0cbc54fee4e991
Diffstat (limited to 'java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java')
-rw-r--r-- | java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java index 9a89eedd0..c1609ea28 100644 --- a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java +++ b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java @@ -83,14 +83,13 @@ public final class SuggestionSpanUtils { } public static CharSequence getTextWithAutoCorrectionIndicatorUnderline( - Context context, CharSequence text) { + final Context context, final String text) { if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null || OBJ_FLAG_AUTO_CORRECTION == null || OBJ_SUGGESTIONS_MAX_SIZE == null || OBJ_FLAG_MISSPELLED == null || OBJ_FLAG_EASY_CORRECT == null) { return text; } - final Spannable spannable = text instanceof Spannable - ? (Spannable) text : new SpannableString(text); + final Spannable spannable = new SpannableString(text); final Object[] args = { context, null, new String[] {}, (int)OBJ_FLAG_AUTO_CORRECTION, (Class<?>) SuggestionSpanPickedNotificationReceiver.class }; @@ -104,8 +103,9 @@ public final class SuggestionSpanUtils { return spannable; } - public static CharSequence getTextWithSuggestionSpan(Context context, - CharSequence pickedWord, SuggestedWords suggestedWords, boolean dictionaryAvailable) { + public static CharSequence getTextWithSuggestionSpan(final Context context, + final String pickedWord, final SuggestedWords suggestedWords, + final boolean dictionaryAvailable) { if (!dictionaryAvailable || TextUtils.isEmpty(pickedWord) || CONSTRUCTOR_SuggestionSpan == null || suggestedWords.isEmpty() || suggestedWords.mIsPrediction @@ -114,18 +114,13 @@ public final class SuggestionSpanUtils { return pickedWord; } - final Spannable spannable; - if (pickedWord instanceof Spannable) { - spannable = (Spannable) pickedWord; - } else { - spannable = new SpannableString(pickedWord); - } + final Spannable spannable = new SpannableString(pickedWord); final ArrayList<String> suggestionsList = CollectionUtils.newArrayList(); for (int i = 0; i < suggestedWords.size(); ++i) { if (suggestionsList.size() >= OBJ_SUGGESTIONS_MAX_SIZE) { break; } - final CharSequence word = suggestedWords.getWord(i); + final String word = suggestedWords.getWord(i); if (!TextUtils.equals(pickedWord, word)) { suggestionsList.add(word.toString()); } |