diff --git a/core/api/current.txt b/core/api/current.txt index d3a897a98a23d..3d29ea17bb6ec 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -44608,6 +44608,7 @@ package android.text { field public static final int TYPE_TEXT_FLAG_CAP_CHARACTERS = 4096; // 0x1000 field public static final int TYPE_TEXT_FLAG_CAP_SENTENCES = 16384; // 0x4000 field public static final int TYPE_TEXT_FLAG_CAP_WORDS = 8192; // 0x2000 + field public static final int TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS = 1048576; // 0x100000 field public static final int TYPE_TEXT_FLAG_IME_MULTI_LINE = 262144; // 0x40000 field public static final int TYPE_TEXT_FLAG_MULTI_LINE = 131072; // 0x20000 field public static final int TYPE_TEXT_FLAG_NO_SUGGESTIONS = 524288; // 0x80000 diff --git a/core/java/android/text/InputType.java b/core/java/android/text/InputType.java index 7f903b6fda669..dfe4119d10670 100644 --- a/core/java/android/text/InputType.java +++ b/core/java/android/text/InputType.java @@ -16,6 +16,12 @@ package android.text; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.TextAttribute; +import android.view.inputmethod.TextAttribute.TextAttributeBuilder; + +import java.util.List; + /** * Bit definitions for an integer defining the basic content type of text * held in an {@link Editable} object. Supported classes may be combined @@ -188,6 +194,21 @@ public interface InputType { */ public static final int TYPE_TEXT_FLAG_NO_SUGGESTIONS = 0x00080000; + /** + * Flag for {@link #TYPE_CLASS_TEXT}: Let the IME know the text conversion suggestions are + * required by the application. Text conversion suggestion is for the transliteration languages + * which has pronunciation characters and target characters. When the user is typing the + * pronunciation charactes, the IME could provide the possible target characters to the user. + * When this flag is set, the IME should insert the text conversion suggestions through + * {@link TextAttributeBuilder#setTextConversionSuggestions(List)} and + * the {@link TextAttribute} with initialized with the text conversion suggestions is provided + * by the IME to the application. To receive the additional information, the application needs + * to implement {@link InputConnection#setComposingText(CharSequence, int, TextAttribute)}, + * {@link InputConnection#setComposingRegion(int, int, TextAttribute)}, and + * {@link InputConnection#commitText(CharSequence, int, TextAttribute)}. + */ + public static final int TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS = 0x00100000; + // ---------------------------------------------------------------------- /** diff --git a/core/java/android/view/inputmethod/EditorInfo.java b/core/java/android/view/inputmethod/EditorInfo.java index 74ca913766214..4cbd477d807a7 100644 --- a/core/java/android/view/inputmethod/EditorInfo.java +++ b/core/java/android/view/inputmethod/EditorInfo.java @@ -92,6 +92,7 @@ public class EditorInfo implements InputType, Parcelable { * 1 TYPE_TEXT_FLAG_MULTI_LINE * 1 TYPE_TEXT_FLAG_IME_MULTI_LINE * 1 TYPE_TEXT_FLAG_NO_SUGGESTIONS + * 1 TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS * |-------|-------|-------|-------| * 1 TYPE_CLASS_NUMBER * 1 TYPE_NUMBER_VARIATION_PASSWORD @@ -1090,4 +1091,4 @@ public class EditorInfo implements InputType, Parcelable { public int describeContents() { return 0; } -} \ No newline at end of file +} diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 697ec204d745b..60766459f1cb3 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -1329,6 +1329,11 @@ dictionary-based word suggestions. Corresponds to {@link android.text.InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS}. --> + +