aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2010-12-09 14:31:17 +0900
committerTadashi G. Takaoka <takaoka@google.com>2010-12-09 14:43:54 +0900
commit8ec36be4f5d7f85a658235ccfeb9c6cb424ddb2a (patch)
tree9e0c4ff4bf831e8dd3c2724550ea6a6b782c7568 /java/src
parent71890a78b0ccf27fbe2cd2c28501d8e0c5be2937 (diff)
downloadlatinime-8ec36be4f5d7f85a658235ccfeb9c6cb424ddb2a.tar.gz
latinime-8ec36be4f5d7f85a658235ccfeb9c6cb424ddb2a.tar.xz
latinime-8ec36be4f5d7f85a658235ccfeb9c6cb424ddb2a.zip
Cleanup calling Spannable.setSpan() to set character style span
This change is followup of Iadc11992 Bug: 3230726 Change-Id: I4f6692c3dbfb42986d478f4315105726ff89723a
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/latin/CandidateView.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java
index bb3c09d60..99f8a6736 100644
--- a/java/src/com/android/inputmethod/latin/CandidateView.java
+++ b/java/src/com/android/inputmethod/latin/CandidateView.java
@@ -55,7 +55,7 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
private final int mColorNormal;
private final int mColorRecommended;
private final int mColorOther;
- private static final StyleSpan BOLD_SPAN = new StyleSpan(Typeface.BOLD);
+ private static final CharacterStyle BOLD_SPAN = new StyleSpan(Typeface.BOLD);
private static final CharacterStyle UNDERLINE_SPAN = new UnderlineSpan();
private boolean mShowingCompletions;
@@ -146,13 +146,15 @@ public class CandidateView extends LinearLayout implements OnClickListener, OnLo
tv.setTextColor(mColorNormal);
if (haveMinimalSuggestion
&& ((i == 1 && !typedWordValid) || (i == 0 && typedWordValid))) {
- final Spannable word = new SpannableString(suggestion);
+ final CharacterStyle style;
if (mConfigCandidateHighlightFontColorEnabled) {
- word.setSpan(BOLD_SPAN, 0, wordLength, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
+ style = BOLD_SPAN;
tv.setTextColor(mColorRecommended);
} else {
- word.setSpan(UNDERLINE_SPAN, 0, wordLength, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
+ style = UNDERLINE_SPAN;
}
+ final Spannable word = new SpannableString(suggestion);
+ word.setSpan(style, 0, wordLength, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
suggestion = word;
existsAutoCompletion = true;
} else if (i != 0 || (wordLength == 1 && count > 1)) {