summaryrefslogtreecommitdiffstats
path: root/core/java/android/text
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-03-22 06:34:48 +0900
committersatok <satok@google.com>2011-03-26 07:20:34 +0900
commite3797a15fbf769a0abcbe121cfd33b4b658aea1e (patch)
tree7697cb326fad773c18df482644eb16b2b3982aff /core/java/android/text
parentc50232d517d7b99ae3c3e073f04eb6799c876e8c (diff)
downloadframeworks_base-e3797a15fbf769a0abcbe121cfd33b4b658aea1e.zip
frameworks_base-e3797a15fbf769a0abcbe121cfd33b4b658aea1e.tar.gz
frameworks_base-e3797a15fbf769a0abcbe121cfd33b4b658aea1e.tar.bz2
Removed APIs for setCorrectionSpan from InputConnection
("setCorrectionSpan" was added in Id3abc9ea4d11753cd ) Also.. - Added a class java doc for CorrectionSpan - Removed FLAG_DEFAULT - Changed the return type of getSuggestions from Array<CharSequence> to String[] Change-Id: If5eb091e307a7a40c5b4a70ec1fe6059ecd9fb2d
Diffstat (limited to 'core/java/android/text')
-rw-r--r--core/java/android/text/style/CorrectionSpan.java46
1 files changed, 21 insertions, 25 deletions
diff --git a/core/java/android/text/style/CorrectionSpan.java b/core/java/android/text/style/CorrectionSpan.java
index 6142e6f..43fb85d 100644
--- a/core/java/android/text/style/CorrectionSpan.java
+++ b/core/java/android/text/style/CorrectionSpan.java
@@ -22,23 +22,21 @@ import android.os.Parcelable;
import android.text.ParcelableSpan;
import android.text.TextUtils;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
import java.util.Locale;
+/**
+ * Sets correction candidates of words under this span.
+ */
public class CorrectionSpan implements ParcelableSpan {
/**
- * Flag for the default value.
- */
- public static final int FLAG_DEFAULT = 0x0000;
- /**
* Flag for indicating that the input is verbatim. TextView refers to this flag to determine
* how it displays a word with CorrectionSpan.
*/
public static final int FLAG_VERBATIM = 0x0001;
- private static final int SUGGESTS_MAX_SIZE = 5;
+ private static final int SUGGESTIONS_MAX_SIZE = 5;
/*
* TODO: Needs to check the validity and add a feature that TextView will change
@@ -48,7 +46,7 @@ public class CorrectionSpan implements ParcelableSpan {
*/
private final int mFlags;
- private final List<CharSequence> mSuggests = new ArrayList<CharSequence>();
+ private final String[] mSuggestions;
private final String mLocaleString;
private final String mOriginalString;
/*
@@ -58,35 +56,33 @@ public class CorrectionSpan implements ParcelableSpan {
/**
* @param context Context for the application
- * @param suggests Suggests for the string under the span
+ * @param suggestions Suggestions for the string under the span
* @param flags Additional flags indicating how this span is handled in TextView
*/
- public CorrectionSpan(Context context, List<CharSequence> suggests, int flags) {
- this(context, null, suggests, flags, null);
+ public CorrectionSpan(Context context, String[] suggestions, int flags) {
+ this(context, null, suggestions, flags, null);
}
/**
* @param locale Locale of the suggestions
- * @param suggests Suggests for the string under the span
+ * @param suggestions Suggestions for the string under the span
* @param flags Additional flags indicating how this span is handled in TextView
*/
- public CorrectionSpan(Locale locale, List<CharSequence> suggests, int flags) {
- this(null, locale, suggests, flags, null);
+ public CorrectionSpan(Locale locale, String[] suggestions, int flags) {
+ this(null, locale, suggestions, flags, null);
}
/**
* @param context Context for the application
* @param locale locale Locale of the suggestions
- * @param suggests suggests Suggests for the string under the span
+ * @param suggestions Suggestions for the string under the span
* @param flags Additional flags indicating how this span is handled in TextView
- * @param originalString originalString for suggests
+ * @param originalString originalString for suggestions
*/
- public CorrectionSpan(Context context, Locale locale, List<CharSequence> suggests, int flags,
+ public CorrectionSpan(Context context, Locale locale, String[] suggestions, int flags,
String originalString) {
- final int N = Math.min(SUGGESTS_MAX_SIZE, suggests.size());
- for (int i = 0; i < N; ++i) {
- mSuggests.add(suggests.get(i));
- }
+ final int N = Math.min(SUGGESTIONS_MAX_SIZE, suggestions.length);
+ mSuggestions = Arrays.copyOf(suggestions, N);
mFlags = flags;
if (context != null && locale == null) {
mLocaleString = context.getResources().getConfiguration().locale.toString();
@@ -97,7 +93,7 @@ public class CorrectionSpan implements ParcelableSpan {
}
public CorrectionSpan(Parcel src) {
- src.readList(mSuggests, null);
+ mSuggestions = src.readStringArray();
mFlags = src.readInt();
mLocaleString = src.readString();
mOriginalString = src.readString();
@@ -106,8 +102,8 @@ public class CorrectionSpan implements ParcelableSpan {
/**
* @return suggestions
*/
- public List<CharSequence> getSuggests() {
- return new ArrayList<CharSequence>(mSuggests);
+ public String[] getSuggestions() {
+ return Arrays.copyOf(mSuggestions, mSuggestions.length);
}
/**
@@ -135,7 +131,7 @@ public class CorrectionSpan implements ParcelableSpan {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeList(mSuggests);
+ dest.writeStringArray(mSuggestions);
dest.writeInt(mFlags);
dest.writeString(mLocaleString);
dest.writeString(mOriginalString);