Loading api/current.txt +7 −2 Original line number Diff line number Diff line Loading @@ -19381,17 +19381,22 @@ package android.text.style { public class SuggestionSpan implements android.text.ParcelableSpan { ctor public SuggestionSpan(android.content.Context, java.lang.String[], int); ctor public SuggestionSpan(java.util.Locale, java.lang.String[], int); ctor public SuggestionSpan(android.content.Context, java.util.Locale, java.lang.String[], int, java.lang.String); ctor public SuggestionSpan(android.content.Context, java.util.Locale, java.lang.String[], int, java.lang.Class<?>); ctor public SuggestionSpan(android.os.Parcel); method public int describeContents(); method public int getFlags(); method public java.lang.String getLocale(); method public java.lang.String getOriginalString(); method public java.lang.Class<?> getNotificationTargetClass(); method public int getSpanTypeId(); method public java.lang.String[] getSuggestions(); method public void writeToParcel(android.os.Parcel, int); field public static final java.lang.String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED"; field public static final android.os.Parcelable.Creator CREATOR; field public static final int FLAG_VERBATIM = 1; // 0x1 field public static final int SUGGESTIONS_MAX_SIZE = 5; // 0x5 field public static final java.lang.String SUGGESTION_SPAN_PICKED_AFTER = "after"; field public static final java.lang.String SUGGESTION_SPAN_PICKED_BEFORE = "before"; field public static final java.lang.String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode"; } public class SuperscriptSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan { core/java/android/text/style/SuggestionSpan.java +53 −10 Original line number Diff line number Diff line Loading @@ -19,8 +19,10 @@ package android.text.style; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; import android.text.ParcelableSpan; import android.text.TextUtils; import android.util.Log; import java.util.Arrays; import java.util.Locale; Loading @@ -29,6 +31,7 @@ import java.util.Locale; * Holds suggestion candidates of words under this span. */ public class SuggestionSpan implements ParcelableSpan { private static final String TAG = SuggestionSpan.class.getSimpleName(); /** * Flag for indicating that the input is verbatim. TextView refers to this flag to determine Loading @@ -36,7 +39,12 @@ public class SuggestionSpan implements ParcelableSpan { */ public static final int FLAG_VERBATIM = 0x0001; private static final int SUGGESTIONS_MAX_SIZE = 5; public static final String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED"; public static final String SUGGESTION_SPAN_PICKED_AFTER = "after"; public static final String SUGGESTION_SPAN_PICKED_BEFORE = "before"; public static final String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode"; public static final int SUGGESTIONS_MAX_SIZE = 5; /* * TODO: Needs to check the validity and add a feature that TextView will change Loading @@ -48,7 +56,9 @@ public class SuggestionSpan implements ParcelableSpan { private final int mFlags; private final String[] mSuggestions; private final String mLocaleString; private final String mOriginalString; private final Class<?> mNotificationTargetClass; private final int mHashCode; /* * TODO: If switching IME is required, needs to add parameters for ids of InputMethodInfo * and InputMethodSubtype. Loading Loading @@ -77,10 +87,11 @@ public class SuggestionSpan implements ParcelableSpan { * @param locale locale Locale of the suggestions * @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 suggestions * @param notificationTargetClass if not null, this class will get notified when the user * selects one of the suggestions. */ public SuggestionSpan(Context context, Locale locale, String[] suggestions, int flags, String originalString) { Class<?> notificationTargetClass) { final int N = Math.min(SUGGESTIONS_MAX_SIZE, suggestions.length); mSuggestions = Arrays.copyOf(suggestions, N); mFlags = flags; Loading @@ -89,14 +100,26 @@ public class SuggestionSpan implements ParcelableSpan { } else { mLocaleString = locale.toString(); } mOriginalString = originalString; mNotificationTargetClass = notificationTargetClass; mHashCode = hashCodeInternal( mFlags, mSuggestions, mLocaleString, mNotificationTargetClass); } public SuggestionSpan(Parcel src) { mSuggestions = src.readStringArray(); mFlags = src.readInt(); mLocaleString = src.readString(); mOriginalString = src.readString(); Class<?> tempClass = null; try { final String className = src.readString(); if (!TextUtils.isEmpty(className)) { tempClass = Class.forName(className); } } catch (ClassNotFoundException e) { Log.i(TAG, "Invalid class name was created."); } mNotificationTargetClass = tempClass; mHashCode = src.readInt(); } /** Loading @@ -114,10 +137,13 @@ public class SuggestionSpan implements ParcelableSpan { } /** * @return original string of suggestions * @return The class to notify. The class of the original IME package will receive * a notification when the user selects one of the suggestions. The notification will include * the original string, the suggested replacement string as well as the hashCode of this span. * The class will get notified by an intent that has those information. */ public String getOriginalString() { return mOriginalString; public Class<?> getNotificationTargetClass() { return mNotificationTargetClass; } public int getFlags() { Loading @@ -134,7 +160,10 @@ public class SuggestionSpan implements ParcelableSpan { dest.writeStringArray(mSuggestions); dest.writeInt(mFlags); dest.writeString(mLocaleString); dest.writeString(mOriginalString); dest.writeString(mNotificationTargetClass != null ? mNotificationTargetClass.getCanonicalName() : ""); dest.writeInt(mHashCode); } @Override Loading @@ -142,6 +171,20 @@ public class SuggestionSpan implements ParcelableSpan { return TextUtils.SUGGESTION_SPAN; } @Override public int hashCode() { return mHashCode; } private static int hashCodeInternal(int flags, String[] suggestions,String locale, Class<?> notificationTargetClass) { final String cls = notificationTargetClass != null ? notificationTargetClass.getCanonicalName() : ""; return Arrays.hashCode( new Object[] {SystemClock.uptimeMillis(), flags, suggestions, locale, cls}); } public static final Parcelable.Creator<SuggestionSpan> CREATOR = new Parcelable.Creator<SuggestionSpan>() { @Override Loading core/java/android/view/inputmethod/BaseInputConnection.java +3 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,8 @@ public class BaseInputConnection implements InputConnection { private static final String TAG = "BaseInputConnection"; static final Object COMPOSING = new ComposingText(); final InputMethodManager mIMM; /** @hide */ protected final InputMethodManager mIMM; final View mTargetView; final boolean mDummyMode; Loading core/java/android/view/inputmethod/InputMethodManager.java +20 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.text.style.SuggestionSpan; import android.util.Log; import android.util.PrintWriterPrinter; import android.util.Printer; Loading Loading @@ -551,6 +552,24 @@ public final class InputMethodManager { mFullscreenMode = fullScreen; } /** @hide */ public void registerSuggestionSpansForNotification(SuggestionSpan[] spans) { try { mService.registerSuggestionSpansForNotification(spans); } catch (RemoteException e) { throw new RuntimeException(e); } } /** @hide */ public void notifySuggestionPicked(SuggestionSpan span, String originalString, int index) { try { mService.notifySuggestionPicked(span, originalString, index); } catch (RemoteException e) { throw new RuntimeException(e); } } /** * Allows you to discover whether the attached input method is running * in fullscreen mode. Return true if it is fullscreen, entirely covering Loading core/java/com/android/internal/view/IInputMethodManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.view; import android.os.ResultReceiver; import android.text.style.SuggestionSpan; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.EditorInfo; Loading Loading @@ -61,6 +62,8 @@ interface IInputMethodManager { void showMySoftInput(in IBinder token, int flags); void updateStatusIcon(in IBinder token, String packageName, int iconId); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); void registerSuggestionSpansForNotification(in SuggestionSpan[] spans); boolean notifySuggestionPicked(in SuggestionSpan span, String originalString, int index); InputMethodSubtype getCurrentInputMethodSubtype(); boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype); boolean switchToLastInputMethod(in IBinder token); Loading Loading
api/current.txt +7 −2 Original line number Diff line number Diff line Loading @@ -19381,17 +19381,22 @@ package android.text.style { public class SuggestionSpan implements android.text.ParcelableSpan { ctor public SuggestionSpan(android.content.Context, java.lang.String[], int); ctor public SuggestionSpan(java.util.Locale, java.lang.String[], int); ctor public SuggestionSpan(android.content.Context, java.util.Locale, java.lang.String[], int, java.lang.String); ctor public SuggestionSpan(android.content.Context, java.util.Locale, java.lang.String[], int, java.lang.Class<?>); ctor public SuggestionSpan(android.os.Parcel); method public int describeContents(); method public int getFlags(); method public java.lang.String getLocale(); method public java.lang.String getOriginalString(); method public java.lang.Class<?> getNotificationTargetClass(); method public int getSpanTypeId(); method public java.lang.String[] getSuggestions(); method public void writeToParcel(android.os.Parcel, int); field public static final java.lang.String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED"; field public static final android.os.Parcelable.Creator CREATOR; field public static final int FLAG_VERBATIM = 1; // 0x1 field public static final int SUGGESTIONS_MAX_SIZE = 5; // 0x5 field public static final java.lang.String SUGGESTION_SPAN_PICKED_AFTER = "after"; field public static final java.lang.String SUGGESTION_SPAN_PICKED_BEFORE = "before"; field public static final java.lang.String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode"; } public class SuperscriptSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
core/java/android/text/style/SuggestionSpan.java +53 −10 Original line number Diff line number Diff line Loading @@ -19,8 +19,10 @@ package android.text.style; import android.content.Context; import android.os.Parcel; import android.os.Parcelable; import android.os.SystemClock; import android.text.ParcelableSpan; import android.text.TextUtils; import android.util.Log; import java.util.Arrays; import java.util.Locale; Loading @@ -29,6 +31,7 @@ import java.util.Locale; * Holds suggestion candidates of words under this span. */ public class SuggestionSpan implements ParcelableSpan { private static final String TAG = SuggestionSpan.class.getSimpleName(); /** * Flag for indicating that the input is verbatim. TextView refers to this flag to determine Loading @@ -36,7 +39,12 @@ public class SuggestionSpan implements ParcelableSpan { */ public static final int FLAG_VERBATIM = 0x0001; private static final int SUGGESTIONS_MAX_SIZE = 5; public static final String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED"; public static final String SUGGESTION_SPAN_PICKED_AFTER = "after"; public static final String SUGGESTION_SPAN_PICKED_BEFORE = "before"; public static final String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode"; public static final int SUGGESTIONS_MAX_SIZE = 5; /* * TODO: Needs to check the validity and add a feature that TextView will change Loading @@ -48,7 +56,9 @@ public class SuggestionSpan implements ParcelableSpan { private final int mFlags; private final String[] mSuggestions; private final String mLocaleString; private final String mOriginalString; private final Class<?> mNotificationTargetClass; private final int mHashCode; /* * TODO: If switching IME is required, needs to add parameters for ids of InputMethodInfo * and InputMethodSubtype. Loading Loading @@ -77,10 +87,11 @@ public class SuggestionSpan implements ParcelableSpan { * @param locale locale Locale of the suggestions * @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 suggestions * @param notificationTargetClass if not null, this class will get notified when the user * selects one of the suggestions. */ public SuggestionSpan(Context context, Locale locale, String[] suggestions, int flags, String originalString) { Class<?> notificationTargetClass) { final int N = Math.min(SUGGESTIONS_MAX_SIZE, suggestions.length); mSuggestions = Arrays.copyOf(suggestions, N); mFlags = flags; Loading @@ -89,14 +100,26 @@ public class SuggestionSpan implements ParcelableSpan { } else { mLocaleString = locale.toString(); } mOriginalString = originalString; mNotificationTargetClass = notificationTargetClass; mHashCode = hashCodeInternal( mFlags, mSuggestions, mLocaleString, mNotificationTargetClass); } public SuggestionSpan(Parcel src) { mSuggestions = src.readStringArray(); mFlags = src.readInt(); mLocaleString = src.readString(); mOriginalString = src.readString(); Class<?> tempClass = null; try { final String className = src.readString(); if (!TextUtils.isEmpty(className)) { tempClass = Class.forName(className); } } catch (ClassNotFoundException e) { Log.i(TAG, "Invalid class name was created."); } mNotificationTargetClass = tempClass; mHashCode = src.readInt(); } /** Loading @@ -114,10 +137,13 @@ public class SuggestionSpan implements ParcelableSpan { } /** * @return original string of suggestions * @return The class to notify. The class of the original IME package will receive * a notification when the user selects one of the suggestions. The notification will include * the original string, the suggested replacement string as well as the hashCode of this span. * The class will get notified by an intent that has those information. */ public String getOriginalString() { return mOriginalString; public Class<?> getNotificationTargetClass() { return mNotificationTargetClass; } public int getFlags() { Loading @@ -134,7 +160,10 @@ public class SuggestionSpan implements ParcelableSpan { dest.writeStringArray(mSuggestions); dest.writeInt(mFlags); dest.writeString(mLocaleString); dest.writeString(mOriginalString); dest.writeString(mNotificationTargetClass != null ? mNotificationTargetClass.getCanonicalName() : ""); dest.writeInt(mHashCode); } @Override Loading @@ -142,6 +171,20 @@ public class SuggestionSpan implements ParcelableSpan { return TextUtils.SUGGESTION_SPAN; } @Override public int hashCode() { return mHashCode; } private static int hashCodeInternal(int flags, String[] suggestions,String locale, Class<?> notificationTargetClass) { final String cls = notificationTargetClass != null ? notificationTargetClass.getCanonicalName() : ""; return Arrays.hashCode( new Object[] {SystemClock.uptimeMillis(), flags, suggestions, locale, cls}); } public static final Parcelable.Creator<SuggestionSpan> CREATOR = new Parcelable.Creator<SuggestionSpan>() { @Override Loading
core/java/android/view/inputmethod/BaseInputConnection.java +3 −2 Original line number Diff line number Diff line Loading @@ -50,7 +50,8 @@ public class BaseInputConnection implements InputConnection { private static final String TAG = "BaseInputConnection"; static final Object COMPOSING = new ComposingText(); final InputMethodManager mIMM; /** @hide */ protected final InputMethodManager mIMM; final View mTargetView; final boolean mDummyMode; Loading
core/java/android/view/inputmethod/InputMethodManager.java +20 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.text.style.SuggestionSpan; import android.util.Log; import android.util.PrintWriterPrinter; import android.util.Printer; Loading Loading @@ -551,6 +552,24 @@ public final class InputMethodManager { mFullscreenMode = fullScreen; } /** @hide */ public void registerSuggestionSpansForNotification(SuggestionSpan[] spans) { try { mService.registerSuggestionSpansForNotification(spans); } catch (RemoteException e) { throw new RuntimeException(e); } } /** @hide */ public void notifySuggestionPicked(SuggestionSpan span, String originalString, int index) { try { mService.notifySuggestionPicked(span, originalString, index); } catch (RemoteException e) { throw new RuntimeException(e); } } /** * Allows you to discover whether the attached input method is running * in fullscreen mode. Return true if it is fullscreen, entirely covering Loading
core/java/com/android/internal/view/IInputMethodManager.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.internal.view; import android.os.ResultReceiver; import android.text.style.SuggestionSpan; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.EditorInfo; Loading Loading @@ -61,6 +62,8 @@ interface IInputMethodManager { void showMySoftInput(in IBinder token, int flags); void updateStatusIcon(in IBinder token, String packageName, int iconId); void setImeWindowStatus(in IBinder token, int vis, int backDisposition); void registerSuggestionSpansForNotification(in SuggestionSpan[] spans); boolean notifySuggestionPicked(in SuggestionSpan span, String originalString, int index); InputMethodSubtype getCurrentInputMethodSubtype(); boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype); boolean switchToLastInputMethod(in IBinder token); Loading