Add the new Text input type TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS

Add the new input type to indicate that the text conversion suggestions are required by the application. IME should provide the TextAttribute with the text conversion suggestions.

Bug: 194878427
Test: atest android.widget.cts.EditTextTest
Change-Id: Ib37a9816bbf594a5405ea6cd8943fd92491c005b
This commit is contained in:
James.cf Lin
2021-07-28 17:42:27 +08:00
parent 2acc537c2c
commit 9a45178ff4
4 changed files with 29 additions and 1 deletions

View File

@@ -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

View File

@@ -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;
// ----------------------------------------------------------------------
/**

View File

@@ -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;
}
}
}

View File

@@ -1329,6 +1329,11 @@
dictionary-based word suggestions. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_NO_SUGGESTIONS}. -->
<flag name="textNoSuggestions" value="0x00080001" />
<!-- Can be combined with <var>text</var> and its variations to
indicate that if there is extra information, the IME should provide
{@link android.view.inputmethod.TextAttribute}. Corresponds to
{@link android.text.InputType#TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS}. -->
<flag name="textEnableTextConversionSuggestions" value="0x00100001" />
<!-- Text that will be used as a URI. Corresponds to
{@link android.text.InputType#TYPE_CLASS_TEXT} |
{@link android.text.InputType#TYPE_TEXT_VARIATION_URI}. -->