aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
diff options
context:
space:
mode:
authorYohei Yukaw <yukawa@google.com>2015-04-22 08:00:45 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-22 08:00:45 +0000
commit4acd7177dd95ac3d27636c3f73f89d53e7320bf5 (patch)
treec82d17e5ca4de615e1882c7b0bbe16767d690584 /java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
parentf76430ddb9d0a9c5f7c6612b135d433532b3fa2f (diff)
parent490fa47a46015f2c8bd8f9010d236bfe5aecd4bb (diff)
downloadlatinime-4acd7177dd95ac3d27636c3f73f89d53e7320bf5.tar.gz
latinime-4acd7177dd95ac3d27636c3f73f89d53e7320bf5.tar.xz
latinime-4acd7177dd95ac3d27636c3f73f89d53e7320bf5.zip
am 490fa47a: Always specify non-null Locale object to SuggestionSpan
* commit '490fa47a46015f2c8bd8f9010d236bfe5aecd4bb': Always specify non-null Locale object to SuggestionSpan
Diffstat (limited to 'java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java')
-rw-r--r--java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
index 4d2925d30..3f621913c 100644
--- a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
+++ b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
@@ -33,6 +33,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Locale;
+import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public final class SuggestionSpanUtils {
@@ -57,13 +58,12 @@ public final class SuggestionSpanUtils {
@UsedForTesting
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(
- final Context context, final String text) {
+ final Context context, final String text, @Nonnull final Locale locale) {
if (TextUtils.isEmpty(text) || OBJ_FLAG_AUTO_CORRECTION == null) {
return text;
}
final Spannable spannable = new SpannableString(text);
- // TODO: Set locale if it is feasible.
- final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null /* locale */,
+ final SuggestionSpan suggestionSpan = new SuggestionSpan(context, locale,
new String[] {} /* suggestions */, OBJ_FLAG_AUTO_CORRECTION, null);
spannable.setSpan(suggestionSpan, 0, text.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
@@ -72,7 +72,7 @@ public final class SuggestionSpanUtils {
@UsedForTesting
public static CharSequence getTextWithSuggestionSpan(final Context context,
- final String pickedWord, final SuggestedWords suggestedWords) {
+ final String pickedWord, final SuggestedWords suggestedWords, final Locale locale) {
if (TextUtils.isEmpty(pickedWord) || suggestedWords.isEmpty()
|| suggestedWords.isPrediction() || suggestedWords.isPunctuationSuggestions()) {
return pickedWord;
@@ -92,8 +92,7 @@ public final class SuggestionSpanUtils {
suggestionsList.add(word.toString());
}
}
- // TODO: Set locale if it is feasible.
- final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null /* locale */,
+ final SuggestionSpan suggestionSpan = new SuggestionSpan(context, locale,
suggestionsList.toArray(new String[suggestionsList.size()]), 0 /* flags */, null);
final Spannable spannable = new SpannableString(pickedWord);
spannable.setSpan(suggestionSpan, 0, pickedWord.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);