InputMethodSubtype.InputMethodSubtypeBuilder


public static class InputMethodSubtype.InputMethodSubtypeBuilder
extends Object

java.lang.Object
   ↳ android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder


InputMethodSubtypeBuilder is a builder class of InputMethodSubtype. This class is designed to be used with InputMethodManager.setAdditionalInputMethodSubtypes(String, InputMethodSubtype). The developer needs to be aware of what each parameter means.

Summary

Public constructors

InputMethodSubtypeBuilder()

Public methods

InputMethodSubtype build()
InputMethodSubtype.InputMethodSubtypeBuilder setIsAsciiCapable(boolean isAsciiCapable)
InputMethodSubtype.InputMethodSubtypeBuilder setIsAuxiliary(boolean isAuxiliary)
InputMethodSubtype.InputMethodSubtypeBuilder setLanguageTag(String languageTag)
InputMethodSubtype.InputMethodSubtypeBuilder setLayoutLabelNonLocalized(CharSequence layoutLabelNonLocalized)

Sets the non-localized layout label.

InputMethodSubtype.InputMethodSubtypeBuilder setLayoutLabelResource(int layoutLabelResId)

Sets the layout label string resource identifier.

InputMethodSubtype.InputMethodSubtypeBuilder setOverridesImplicitlyEnabledSubtype(boolean overridesImplicitlyEnabledSubtype)
InputMethodSubtype.InputMethodSubtypeBuilder setPhysicalKeyboardHint(ULocale languageTag, String layoutType)

Sets the physical keyboard hint information, such as language and layout.

InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeExtraValue(String subtypeExtraValue)
InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeIconResId(int subtypeIconResId)
InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeId(int subtypeId)
InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeLocale(String subtypeLocale)
InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeMode(String subtypeMode)
InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeNameOverride(CharSequence nameOverride)

Sets the untranslatable name of the subtype.

InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeNameResId(int subtypeNameResId)

Inherited methods

Public constructors

InputMethodSubtypeBuilder

public InputMethodSubtypeBuilder ()

Public methods

build

Added in API level 19
public InputMethodSubtype build ()

Returns
InputMethodSubtype InputMethodSubtype using parameters in this InputMethodSubtypeBuilder.

setIsAsciiCapable

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setIsAsciiCapable (boolean isAsciiCapable)

Parameters
isAsciiCapable boolean: should be true if this subtype is ASCII capable. If the subtype is ASCII capable, it should guarantee that the user can input ASCII characters with this subtype. This is important because many password fields only allow ASCII-characters.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setIsAuxiliary

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setIsAuxiliary (boolean isAuxiliary)

Parameters
isAuxiliary boolean: should true when this subtype is auxiliary, false otherwise. An auxiliary subtype has the following differences with a regular subtype: - An auxiliary subtype cannot be chosen as the default IME in Settings. - The framework will never switch to this subtype through InputMethodManager.switchToLastInputMethod(IBinder). Note that the subtype will still be available in the IME switcher. The intent is to allow for IMEs to specify they are meant to be invoked temporarily in a one-shot way, and to return to the previous IME once finished (e.g. voice input).

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setLanguageTag

Added in API level 24
public InputMethodSubtype.InputMethodSubtypeBuilder setLanguageTag (String languageTag)

Parameters
languageTag String: is the BCP-47 Language Tag supported by this subtype.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setLayoutLabelNonLocalized

public InputMethodSubtype.InputMethodSubtypeBuilder setLayoutLabelNonLocalized (CharSequence layoutLabelNonLocalized)

Sets the non-localized layout label. This is used as the layout display name if the layoutLabelResource is not set (0).

Parameters
layoutLabelNonLocalized CharSequence: the non-localized layout label. This value cannot be null.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder This value cannot be null.

setLayoutLabelResource

public InputMethodSubtype.InputMethodSubtypeBuilder setLayoutLabelResource (int layoutLabelResId)

Sets the layout label string resource identifier.

Parameters
layoutLabelResId int: the layout label string resource identifier.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder This value cannot be null.

setOverridesImplicitlyEnabledSubtype

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setOverridesImplicitlyEnabledSubtype (boolean overridesImplicitlyEnabledSubtype)

Parameters
overridesImplicitlyEnabledSubtype boolean: should be true if this subtype should be enabled by default if no other subtypes in the IME are enabled explicitly. Note that a subtype with this parameter set will not be shown in the list of subtypes in each IME's subtype enabler. A canonical use of this would be for an IME to supply an "automatic" subtype that adapts to the current system language.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setPhysicalKeyboardHint

Added in API level 34
public InputMethodSubtype.InputMethodSubtypeBuilder setPhysicalKeyboardHint (ULocale languageTag, 
                String layoutType)

Sets the physical keyboard hint information, such as language and layout. The system can use the hint information to automatically configure the physical keyboard for the subtype.

Parameters
languageTag ULocale: is the preferred physical keyboard BCP-47 language tag. This is used to match the keyboardLocale attribute in the physical keyboard definition. If it's null, the subtype's language tag will be used.

layoutType String: is the preferred physical keyboard layout, which is used to match the keyboardLayoutType attribute in the physical keyboard definition. See InputManager.ACTION_QUERY_KEYBOARD_LAYOUTS. This value cannot be null.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder This value cannot be null.

setSubtypeExtraValue

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeExtraValue (String subtypeExtraValue)

Parameters
subtypeExtraValue String: is the extra value of the subtype. This string is free-form, but the API supplies tools to deal with a key-value comma-separated list; see InputMethodSubtype.containsExtraValueKey(String) and InputMethodSubtype.getExtraValueOf(String).

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setSubtypeIconResId

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeIconResId (int subtypeIconResId)

Parameters
subtypeIconResId int: is a resource ID of the subtype icon drawable.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setSubtypeId

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeId (int subtypeId)

Parameters
subtypeId int: is the unique ID for this subtype. The input method framework keeps track of enabled subtypes by ID. When the IME package gets upgraded, enabled IDs will stay enabled even if other attributes are different. If the ID is unspecified or 0, Arrays.hashCode(new Object[] {locale, mode, extraValue, isAuxiliary, overridesImplicitlyEnabledSubtype, isAsciiCapable}) will be used instead.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setSubtypeLocale

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeLocale (String subtypeLocale)

Parameters
subtypeLocale String: is the locale supported by this subtype.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setSubtypeMode

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeMode (String subtypeMode)

Parameters
subtypeMode String: is the mode supported by this subtype.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder

setSubtypeNameOverride

Added in API level 34
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeNameOverride (CharSequence nameOverride)

Sets the untranslatable name of the subtype. This string is used as the subtype's display name if subtype's name res Id is 0.

Parameters
nameOverride CharSequence: is the name to set. This value cannot be null.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder This value cannot be null.

setSubtypeNameResId

Added in API level 19
public InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeNameResId (int subtypeNameResId)

Parameters
subtypeNameResId int: is the resource ID of the subtype name string. The string resource may have exactly one %s in it. If present, the %s part will be replaced with the locale's display name by the formatter. Please refer to InputMethodSubtype.getDisplayName(Context, String, ApplicationInfo) for details.

Returns
InputMethodSubtype.InputMethodSubtypeBuilder