pub struct InputType(/* private fields */);Expand description
Flags specifying the content type of text being input.
Corresponds to the Android SDK InputType API
Implementations§
Source§impl InputType
impl InputType
Sourcepub const TYPE_MASK_CLASS: Self
pub const TYPE_MASK_CLASS: Self
Mask of bits that determine the overall class of text being given. Currently supported classes are: TYPE_CLASS_TEXT, TYPE_CLASS_NUMBER, TYPE_CLASS_PHONE, TYPE_CLASS_DATETIME. IME authors: If the class is not one you understand, assume TYPE_CLASS_TEXT with NO variation or flags.
Sourcepub const TYPE_MASK_VARIATION: Self
pub const TYPE_MASK_VARIATION: Self
Mask of bits that determine the variation of the base content class.
Sourcepub const TYPE_MASK_FLAGS: Self
pub const TYPE_MASK_FLAGS: Self
Mask of bits that provide addition bit flags of options.
Sourcepub const TYPE_NULL: Self
pub const TYPE_NULL: Self
Special content type for when no explicit type has been specified. This should be interpreted to mean that the target input connection is not rich, it can not process and show things like candidate text nor retrieve the current text, so the input method will need to run in a limited “generate key events” mode, if it supports it. Note that some input methods may not support it, for example a voice-based input method will likely not be able to generate key events even if this flag is set.
Sourcepub const TYPE_CLASS_TEXT: Self
pub const TYPE_CLASS_TEXT: Self
Class for normal text. This class supports the following flags (only one of which should be set): TYPE_TEXT_FLAG_CAP_CHARACTERS, TYPE_TEXT_FLAG_CAP_WORDS, and. TYPE_TEXT_FLAG_CAP_SENTENCES. It also supports the following variations: TYPE_TEXT_VARIATION_NORMAL, and TYPE_TEXT_VARIATION_URI. If you do not recognize the variation, normal should be assumed.
Sourcepub const TYPE_TEXT_FLAG_CAP_CHARACTERS: Self
pub const TYPE_TEXT_FLAG_CAP_CHARACTERS: Self
Flag for TYPE_CLASS_TEXT: capitalize all characters. Overrides #TYPE_TEXT_FLAG_CAP_WORDS} and #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined to be the same as TextUtils#CAP_MODE_CHARACTERS}. Of course, this only affects languages where there are upper-case and lower-case letters.
Sourcepub const TYPE_TEXT_FLAG_CAP_WORDS: Self
pub const TYPE_TEXT_FLAG_CAP_WORDS: Self
Flag for TYPE_CLASS_TEXT: capitalize the first character of every word. Overrides TYPE_TEXT_FLAG_CAP_SENTENCES. This value is explicitly defined to be the same as TextUtils#CAP_MODE_WORDS. Of course, this only affects languages where there are upper-case and lower-case letters.
Sourcepub const TYPE_TEXT_FLAG_CAP_SENTENCES: Self
pub const TYPE_TEXT_FLAG_CAP_SENTENCES: Self
Flag for TYPE_CLASS_TEXT: capitalize the first character of each sentence. This value is explicitly defined to be the same as TextUtils#CAP_MODE_SENTENCES. For example in English it means to capitalize after a period and a space (note that other languages may have different characters for period, or not use spaces, or use different grammatical rules). Of course, this only affects languages where there are upper-case and lower-case letters.
Sourcepub const TYPE_TEXT_FLAG_AUTO_CORRECT: Self
pub const TYPE_TEXT_FLAG_AUTO_CORRECT: Self
Flag for TYPE_CLASS_TEXT: the user is entering free-form text that should have auto-correction applied to it. Without this flag, the IME will not try to correct typos. You should always set this flag unless you really expect users to type non-words in this field, for example to choose a name for a character in a game. Contrast this with TYPE_TEXT_FLAG_AUTO_COMPLETE and TYPE_TEXT_FLAG_NO_SUGGESTIONS: TYPE_TEXT_FLAG_AUTO_CORRECT means that the IME will try to auto-correct typos as the user is typing, but does not define whether the IME offers an interface to show suggestions.
Sourcepub const TYPE_TEXT_FLAG_AUTO_COMPLETE: Self
pub const TYPE_TEXT_FLAG_AUTO_COMPLETE: Self
Flag for TYPE_CLASS_TEXT: the text editor (which means the application) is performing auto-completion of the text being entered based on its own semantics, which it will present to the user as they type. This generally means that the input method should not be showing candidates itself, but can expect the editor to supply its own completions/candidates from android.view.inputmethod.InputMethodSession#displayCompletions InputMethodSession.displayCompletions()} as a result of the editor calling android.view.inputmethod.InputMethodManager#displayCompletions InputMethodManager.displayCompletions()}. Note the contrast with TYPE_TEXT_FLAG_AUTO_CORRECT and TYPE_TEXT_FLAG_NO_SUGGESTIONS: TYPE_TEXT_FLAG_AUTO_COMPLETE means the editor should show an interface for displaying suggestions, but instead of supplying its own it will rely on the Editor to pass completions/corrections.
Sourcepub const TYPE_TEXT_FLAG_MULTI_LINE: Self
pub const TYPE_TEXT_FLAG_MULTI_LINE: Self
Flag for TYPE_CLASS_TEXT: multiple lines of text can be entered into the field. If this flag is not set, the text field will be constrained to a single line. The IME may also choose not to display an enter key when this flag is not set, as there should be no need to create new lines.
Sourcepub const TYPE_TEXT_FLAG_IME_MULTI_LINE: Self
pub const TYPE_TEXT_FLAG_IME_MULTI_LINE: Self
Flag for TYPE_CLASS_TEXT: the regular text view associated with this should not be multi-line, but when a fullscreen input method is providing text it should use multiple lines if it can.
Sourcepub const TYPE_TEXT_FLAG_NO_SUGGESTIONS: Self
pub const TYPE_TEXT_FLAG_NO_SUGGESTIONS: Self
Flag for TYPE_CLASS_TEXT: the input method does not need to display any dictionary-based candidates. This is useful for text views that do not contain words from the language and do not benefit from any dictionary-based completions or corrections. It overrides the TYPE_TEXT_FLAG_AUTO_CORRECT value when set. Please avoid using this unless you are certain this is what you want. Many input methods need suggestions to work well, for example the ones based on gesture typing. Consider clearing TYPE_TEXT_FLAG_AUTO_CORRECT instead if you just do not want the IME to correct typos. Note the contrast with TYPE_TEXT_FLAG_AUTO_CORRECT and TYPE_TEXT_FLAG_AUTO_COMPLETE: TYPE_TEXT_FLAG_NO_SUGGESTIONS means the IME does not need to show an interface to display suggestions. Most IMEs will also take this to mean they do not need to try to auto-correct what the user is typing.
Sourcepub const TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS: Self
pub const TYPE_TEXT_FLAG_ENABLE_TEXT_CONVERSION_SUGGESTIONS: Self
Flag for 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 Builder#setTextConversionSuggestions(List)} and the 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 InputConnection#setComposingText(CharSequence, int, TextAttribute)}, InputConnection#setComposingRegion(int, int, TextAttribute)}, and InputConnection#commitText(CharSequence, int, TextAttribute)}.
Sourcepub const TYPE_TEXT_FLAG_ENABLE_TEXT_SUGGESTION_SELECTED: Self
pub const TYPE_TEXT_FLAG_ENABLE_TEXT_SUGGESTION_SELECTED: Self
Flag for TYPE_CLASS_TEXT: Let the IME know that conversion candidate selection information is requested by the application. Text conversion suggestion is for the transliteration languages, which have the notions of pronunciation and target characters. When the user actively selects a candidate from the conversion suggestions, notifying when candidate selection is occurring helps assistive technologies generate more effective feedback. When this flag is set, and there is an active selected suggestion, the IME should set that a conversion suggestion is selected when initializing the TextAttribute. To receive this information, the application should implement InputConnection.setComposingText(CharSequence, int, TextAttribute), InputConnection.setComposingRegion(int, int, TextAttribute), and InputConnection.commitText(CharSequence, int, TextAttribute)
Sourcepub const TYPE_TEXT_VARIATION_NORMAL: Self
pub const TYPE_TEXT_VARIATION_NORMAL: Self
Default variation of TYPE_CLASS_TEXT: plain old normal text.
Sourcepub const TYPE_TEXT_VARIATION_URI: Self
pub const TYPE_TEXT_VARIATION_URI: Self
Variation of TYPE_CLASS_TEXT: entering a URI.
Sourcepub const TYPE_TEXT_VARIATION_EMAIL_ADDRESS: Self
pub const TYPE_TEXT_VARIATION_EMAIL_ADDRESS: Self
Variation of TYPE_CLASS_TEXT: entering an e-mail address.
Sourcepub const TYPE_TEXT_VARIATION_EMAIL_SUBJECT: Self
pub const TYPE_TEXT_VARIATION_EMAIL_SUBJECT: Self
Variation of TYPE_CLASS_TEXT: entering the subject line of an e-mail.
Sourcepub const TYPE_TEXT_VARIATION_SHORT_MESSAGE: Self
pub const TYPE_TEXT_VARIATION_SHORT_MESSAGE: Self
Variation of TYPE_CLASS_TEXT: entering a short, possibly informal message such as an instant message or a text message.
Sourcepub const TYPE_TEXT_VARIATION_LONG_MESSAGE: Self
pub const TYPE_TEXT_VARIATION_LONG_MESSAGE: Self
Variation of TYPE_CLASS_TEXT: entering the content of a long, possibly formal message such as the body of an e-mail.
Sourcepub const TYPE_TEXT_VARIATION_PERSON_NAME: Self
pub const TYPE_TEXT_VARIATION_PERSON_NAME: Self
Variation of TYPE_CLASS_TEXT: entering the name of a person.
Sourcepub const TYPE_TEXT_VARIATION_POSTAL_ADDRESS: Self
pub const TYPE_TEXT_VARIATION_POSTAL_ADDRESS: Self
Variation of TYPE_CLASS_TEXT: entering a postal mailing address.
Sourcepub const TYPE_TEXT_VARIATION_PASSWORD: Self
pub const TYPE_TEXT_VARIATION_PASSWORD: Self
Variation of TYPE_CLASS_TEXT: entering a password.
Sourcepub const TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: Self
pub const TYPE_TEXT_VARIATION_VISIBLE_PASSWORD: Self
Variation of TYPE_CLASS_TEXT: entering a password, which should be visible to the user.
Sourcepub const TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: Self
pub const TYPE_TEXT_VARIATION_WEB_EDIT_TEXT: Self
Variation of TYPE_CLASS_TEXT: entering text inside of a web form.
Sourcepub const TYPE_TEXT_VARIATION_FILTER: Self
pub const TYPE_TEXT_VARIATION_FILTER: Self
Variation of TYPE_CLASS_TEXT: entering text to filter contents of a list etc.
Sourcepub const TYPE_TEXT_VARIATION_PHONETIC: Self
pub const TYPE_TEXT_VARIATION_PHONETIC: Self
Variation of TYPE_CLASS_TEXT: entering text for phonetic pronunciation, such as a phonetic name field in contacts. This is mostly useful for languages where one spelling may have several phonetic readings, like Japanese.
Sourcepub const TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: Self
pub const TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS: Self
Variation of TYPE_CLASS_TEXT: entering e-mail address inside of a web form. This was added in android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target this API version or later to see this input type; if it doesn’t, a request for this type will be seen as #TYPE_TEXT_VARIATION_EMAIL_ADDRESS} when passed through android.view.inputmethod.EditorInfo#makeCompatible(int) EditorInfo.makeCompatible(int)}.
Sourcepub const TYPE_TEXT_VARIATION_WEB_PASSWORD: Self
pub const TYPE_TEXT_VARIATION_WEB_PASSWORD: Self
Variation of TYPE_CLASS_TEXT: entering password inside of a web form. This was added in android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target this API version or later to see this input type; if it doesn’t, a request for this type will be seen as #TYPE_TEXT_VARIATION_PASSWORD} when passed through android.view.inputmethod.EditorInfo#makeCompatible(int) EditorInfo.makeCompatible(int)}.
Sourcepub const TYPE_CLASS_NUMBER: Self
pub const TYPE_CLASS_NUMBER: Self
Class for numeric text. This class supports the following flags: #TYPE_NUMBER_FLAG_SIGNED} and #TYPE_NUMBER_FLAG_DECIMAL}. It also supports the following variations: #TYPE_NUMBER_VARIATION_NORMAL} and #TYPE_NUMBER_VARIATION_PASSWORD}.
IME authors: If you do not recognize the variation, normal should be assumed.
Sourcepub const TYPE_NUMBER_FLAG_SIGNED: Self
pub const TYPE_NUMBER_FLAG_SIGNED: Self
Flag of TYPE_CLASS_NUMBER: the number is signed, allowing a positive or negative sign at the start.
Sourcepub const TYPE_NUMBER_FLAG_DECIMAL: Self
pub const TYPE_NUMBER_FLAG_DECIMAL: Self
Flag of TYPE_CLASS_NUMBER: the number is decimal, allowing a decimal point to provide fractional values.
Sourcepub const TYPE_NUMBER_VARIATION_NORMAL: Self
pub const TYPE_NUMBER_VARIATION_NORMAL: Self
Default variation of TYPE_CLASS_NUMBER: plain normal numeric text. This was added in android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target this API version or later to see this input type; if it doesn’t, a request for this type will be dropped when passed through android.view.inputmethod.EditorInfo#makeCompatible(int) EditorInfo.makeCompatible(int)}.
Sourcepub const TYPE_NUMBER_VARIATION_PASSWORD: Self
pub const TYPE_NUMBER_VARIATION_PASSWORD: Self
Variation of TYPE_CLASS_NUMBER: entering a numeric password. This was added in android.os.Build.VERSION_CODES#HONEYCOMB}. An IME must target this API version or later to see this input type; if it doesn’t, a request for this type will be dropped when passed through android.view.inputmethod.EditorInfo#makeCompatible(int) EditorInfo.makeCompatible(int)}.
Sourcepub const TYPE_CLASS_PHONE: Self
pub const TYPE_CLASS_PHONE: Self
Class for a phone number. This class currently supports no variations or flags.
Sourcepub const TYPE_CLASS_DATETIME: Self
pub const TYPE_CLASS_DATETIME: Self
Class for dates and times. It supports the following variations: #TYPE_DATETIME_VARIATION_NORMAL} #TYPE_DATETIME_VARIATION_DATE}, and #TYPE_DATETIME_VARIATION_TIME}.
Sourcepub const TYPE_DATETIME_VARIATION_NORMAL: Self
pub const TYPE_DATETIME_VARIATION_NORMAL: Self
Default variation of #TYPE_CLASS_DATETIME}: allows entering both a date and time.
Sourcepub const TYPE_DATETIME_VARIATION_DATE: Self
pub const TYPE_DATETIME_VARIATION_DATE: Self
Default variation of #TYPE_CLASS_DATETIME}: allows entering only a date.
Sourcepub const TYPE_DATETIME_VARIATION_TIME: Self
pub const TYPE_DATETIME_VARIATION_TIME: Self
Default variation of #TYPE_CLASS_DATETIME}: allows entering only a time.
Source§impl InputType
impl InputType
Sourcepub const fn bits(&self) -> u32
pub const fn bits(&self) -> u32
Get the underlying bits value.
The returned value is exactly the bits set in this flags value.
Sourcepub const fn from_bits(bits: u32) -> Option<Self>
pub const fn from_bits(bits: u32) -> Option<Self>
Convert from a bits value.
This method will return None if any unknown bits are set.
Sourcepub const fn from_bits_truncate(bits: u32) -> Self
pub const fn from_bits_truncate(bits: u32) -> Self
Convert from a bits value, unsetting any unknown bits.
Sourcepub const fn from_bits_retain(bits: u32) -> Self
pub const fn from_bits_retain(bits: u32) -> Self
Convert from a bits value exactly.
Sourcepub fn from_name(name: &str) -> Option<Self>
pub fn from_name(name: &str) -> Option<Self>
Get a flags value with the bits of a flag with the given name set.
This method will return None if name is empty or doesn’t
correspond to any named flag.
Sourcepub const fn intersects(&self, other: Self) -> bool
pub const fn intersects(&self, other: Self) -> bool
Whether any set bits in a source flags value are also set in a target flags value.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Whether all set bits in a source flags value are also set in a target flags value.
Sourcepub fn remove(&mut self, other: Self)
pub fn remove(&mut self, other: Self)
The intersection of a source flags value with the complement of a target flags
value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
remove won’t truncate other, but the ! operator will.
Sourcepub fn toggle(&mut self, other: Self)
pub fn toggle(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in two flags values.
Sourcepub fn set(&mut self, other: Self, value: bool)
pub fn set(&mut self, other: Self, value: bool)
Call insert when value is true or remove when value is false.
Sourcepub const fn intersection(self, other: Self) -> Self
pub const fn intersection(self, other: Self) -> Self
The bitwise and (&) of the bits in two flags values.
Sourcepub const fn union(self, other: Self) -> Self
pub const fn union(self, other: Self) -> Self
The bitwise or (|) of the bits in two flags values.
Sourcepub const fn difference(self, other: Self) -> Self
pub const fn difference(self, other: Self) -> Self
The intersection of a source flags value with the complement of a target flags
value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.
Sourcepub const fn symmetric_difference(self, other: Self) -> Self
pub const fn symmetric_difference(self, other: Self) -> Self
The bitwise exclusive-or (^) of the bits in two flags values.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
The bitwise negation (!) of the bits in a flags value, truncating the result.
Source§impl InputType
impl InputType
Sourcepub const fn iter(&self) -> Iter<InputType>
pub const fn iter(&self) -> Iter<InputType>
Yield a set of contained flags values.
Each yielded flags value will correspond to a defined named flag. Any unknown bits will be yielded together as a final flags value.
Sourcepub const fn iter_names(&self) -> IterNames<InputType>
pub const fn iter_names(&self) -> IterNames<InputType>
Yield a set of contained named flags values.
This method is like iter, except only yields bits in contained named flags.
Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
Trait Implementations§
Source§impl BitAndAssign for InputType
impl BitAndAssign for InputType
Source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
The bitwise and (&) of the bits in two flags values.
Source§impl BitOrAssign for InputType
impl BitOrAssign for InputType
Source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
The bitwise or (|) of the bits in two flags values.
Source§impl BitXorAssign for InputType
impl BitXorAssign for InputType
Source§fn bitxor_assign(&mut self, other: Self)
fn bitxor_assign(&mut self, other: Self)
The bitwise exclusive-or (^) of the bits in two flags values.
Source§impl Extend<InputType> for InputType
impl Extend<InputType> for InputType
Source§fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = Self>>(&mut self, iterator: T)
The bitwise or (|) of the bits in each flags value.
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Flags for InputType
impl Flags for InputType
Source§fn from_bits_retain(bits: u32) -> InputType
fn from_bits_retain(bits: u32) -> InputType
Source§fn known_bits(&self) -> Self::Bits
fn known_bits(&self) -> Self::Bits
Source§fn unknown_bits(&self) -> Self::Bits
fn unknown_bits(&self) -> Self::Bits
Source§fn contains_unknown_bits(&self) -> bool
fn contains_unknown_bits(&self) -> bool
true if any unknown bits are set.Source§fn from_bits_truncate(bits: Self::Bits) -> Self
fn from_bits_truncate(bits: Self::Bits) -> Self
Source§fn from_name(name: &str) -> Option<Self>
fn from_name(name: &str) -> Option<Self>
Source§fn iter_names(&self) -> IterNames<Self>
fn iter_names(&self) -> IterNames<Self>
Source§fn iter_defined_names() -> IterDefinedNames<Self>
fn iter_defined_names() -> IterDefinedNames<Self>
Self::FLAGS.Source§fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
fn intersects(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn contains(&self, other: Self) -> boolwhere
Self: Sized,
fn contains(&self, other: Self) -> boolwhere
Self: Sized,
Source§fn insert(&mut self, other: Self)where
Self: Sized,
fn insert(&mut self, other: Self)where
Self: Sized,
|) of the bits in two flags values.Source§fn remove(&mut self, other: Self)where
Self: Sized,
fn remove(&mut self, other: Self)where
Self: Sized,
&!). Read moreSource§fn toggle(&mut self, other: Self)where
Self: Sized,
fn toggle(&mut self, other: Self)where
Self: Sized,
^) of the bits in two flags values.Source§fn intersection(self, other: Self) -> Self
fn intersection(self, other: Self) -> Self
&) of the bits in two flags values.Source§fn difference(self, other: Self) -> Self
fn difference(self, other: Self) -> Self
&!). Read moreSource§fn symmetric_difference(self, other: Self) -> Self
fn symmetric_difference(self, other: Self) -> Self
^) of the bits in two flags values.Source§fn complement(self) -> Self
fn complement(self) -> Self
!) of the bits in a flags value, truncating the result.Source§impl FromIterator<InputType> for InputType
impl FromIterator<InputType> for InputType
Source§fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
fn from_iter<T: IntoIterator<Item = Self>>(iterator: T) -> Self
The bitwise or (|) of the bits in each flags value.
Source§impl IntoIterator for InputType
impl IntoIterator for InputType
Source§impl Sub for InputType
impl Sub for InputType
Source§impl SubAssign for InputType
impl SubAssign for InputType
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
The intersection of a source flags value with the complement of a target flags value (&!).
This method is not equivalent to self & !other when other has unknown bits set.
difference won’t truncate other, but the ! operator will.