aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
diff options
context:
space:
mode:
authorKen Wakasa <kwakasa@google.com>2013-01-06 19:26:16 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2013-01-06 19:26:16 -0800
commit25d1595ab425835281e68aa0d68e6af11acab478 (patch)
tree663984ffe04d0a47caa64a84f8f070a8ff1b1059 /java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
parent7e387bc919c443ba90a19b2f0aaccb05a7088468 (diff)
parentb6ca354431367b625daf9fff5fbe4b1f5ef996ab (diff)
downloadlatinime-25d1595ab425835281e68aa0d68e6af11acab478.tar.gz
latinime-25d1595ab425835281e68aa0d68e6af11acab478.tar.xz
latinime-25d1595ab425835281e68aa0d68e6af11acab478.zip
am b6ca3544: Small code cleanups
* commit 'b6ca354431367b625daf9fff5fbe4b1f5ef996ab': Small code cleanups
Diffstat (limited to 'java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java')
-rw-r--r--java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
index 0e3634d52..141e08a8d 100644
--- a/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
+++ b/java/src/com/android/inputmethod/compat/SuggestionSpanUtils.java
@@ -34,11 +34,12 @@ import java.util.ArrayList;
public final class SuggestionSpanUtils {
private static final String TAG = SuggestionSpanUtils.class.getSimpleName();
- // Note that SuggestionSpan.FLAG_AUTO_CORRECTION was added in API level 15.
- public static final Field FIELD_FLAG_AUTO_CORRECTION =
- CompatUtils.getField(SuggestionSpan.class, "FLAG_AUTO_CORRECTION");
- public static final Integer OBJ_FLAG_AUTO_CORRECTION =
- (Integer) CompatUtils.getFieldValue(null, null, FIELD_FLAG_AUTO_CORRECTION);
+ // Note that SuggestionSpan.FLAG_AUTO_CORRECTION has been introduced
+ // in API level 15 (Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1).
+ public static final Field FIELD_FLAG_AUTO_CORRECTION = CompatUtils.getField(
+ SuggestionSpan.class, "FLAG_AUTO_CORRECTION");
+ public static final Integer OBJ_FLAG_AUTO_CORRECTION = (Integer) CompatUtils.getFieldValue(
+ null /* receiver */, null /* defaultValue */, FIELD_FLAG_AUTO_CORRECTION);
static {
if (LatinImeLogger.sDBG) {
@@ -58,8 +59,9 @@ public final class SuggestionSpanUtils {
return text;
}
final Spannable spannable = new SpannableString(text);
- final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null, new String[] {},
- (int)OBJ_FLAG_AUTO_CORRECTION, SuggestionSpanPickedNotificationReceiver.class);
+ final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null /* locale */,
+ new String[] {} /* suggestions */, (int)OBJ_FLAG_AUTO_CORRECTION,
+ SuggestionSpanPickedNotificationReceiver.class);
spannable.setSpan(suggestionSpan, 0, text.length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
return spannable;
@@ -87,8 +89,8 @@ public final class SuggestionSpanUtils {
// TODO: We should avoid adding suggestion span candidates that came from the bigram
// prediction.
- final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null,
- suggestionsList.toArray(new String[suggestionsList.size()]), 0,
+ final SuggestionSpan suggestionSpan = new SuggestionSpan(context, null /* locale */,
+ suggestionsList.toArray(new String[suggestionsList.size()]), 0 /* flags */,
SuggestionSpanPickedNotificationReceiver.class);
spannable.setSpan(suggestionSpan, 0, pickedWord.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannable;