android-components / mozilla.components.ui.autocomplete / InlineAutocompleteEditText


open class InlineAutocompleteEditText : AppCompatEditText, AutocompleteView (source)

A UI edit text component which supports inline autocompletion.

The background color of autocomplete spans can be configured using the custom autocompleteBackgroundColor attribute e.g. app:autocompleteBackgroundColor=”#ffffff”.

A filter listener (see setOnFilterListener) needs to be attached to provide autocomplete results. It will be invoked when the input text changes. The listener gets direct access to this component (via its view parameter), so it can call {@link applyAutocompleteResult} in return.

A commit listener (see setOnCommitListener) can be attached which is invoked when the user selected the result i.e. is done editing.

Various other listeners can be attached to enhance default behaviour e.g. setOnSelectionChangedListener and setOnWindowsFocusChangeListener which will be invoked in response to onSelectionChanged and onWindowFocusChanged respectively (see also setOnTextChangeListener, setOnSelectionChangedListener, and setOnWindowsFocusChangeListener).


Name Summary
AutocompleteResult data class AutocompleteResult


Name Summary
<init> InlineAutocompleteEditText(ctx: <ERROR CLASS>, attrs: <ERROR CLASS>? = null, defStyleAttr: Int = R.attr.editTextStyle)
A UI edit text component which supports inline autocompletion.


Name Summary
autoCompleteBackgroundColor var autoCompleteBackgroundColor: Int
The background color used for the autocomplete suggestion.
autoCompleteForegroundColor var autoCompleteForegroundColor: Int?
The Foreground color used for the autocomplete suggestion.
autocompleteResult var autocompleteResult: AutocompleteResult?
nonAutocompleteText val nonAutocompleteText: String
originalText open val originalText: String
Current text.


Name Summary
applyAutocompleteResult open fun applyAutocompleteResult(result: AutocompleteResult): Unit
Applies the provided result by updating the current autocomplete text and selection, if any.
dispatchKeyEventPreIme open fun dispatchKeyEventPreIme(event: <ERROR CLASS>?): Boolean
getText open fun getText(): <ERROR CLASS>
noAutocompleteResult open fun noAutocompleteResult(): Unit
Notify that there is no autocomplete result available.
onAttachedToWindow open fun onAttachedToWindow(): Unit
onCreateInputConnection open fun onCreateInputConnection(outAttrs: <ERROR CLASS>): <ERROR CLASS>?
Code to handle deleting autocomplete first when backspacing. If there is no autocomplete text, both removeAutocomplete() and commitAutocomplete() are no-ops and return false. Therefore we can use them here without checking explicitly if we have autocomplete text or not.
onFocusChanged open fun onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: <ERROR CLASS>?): Unit
onKeyPreIme open fun onKeyPreIme(keyCode: Int, event: <ERROR CLASS>): Boolean
onSelectionChanged open fun onSelectionChanged(selStart: Int, selEnd: Int): Unit
onTouchEvent open fun onTouchEvent(event: <ERROR CLASS>): Boolean
onWindowFocusChanged open fun onWindowFocusChanged(hasFocus: Boolean): Unit
sendAccessibilityEventUnchecked open fun sendAccessibilityEventUnchecked(event: <ERROR CLASS>): Unit
setOnCommitListener fun setOnCommitListener(l: OnCommitListener): Unit
setOnDispatchKeyEventPreImeListener fun setOnDispatchKeyEventPreImeListener(l: OnDispatchKeyEventPreImeListener?): Unit
setOnFilterListener fun setOnFilterListener(l: OnFilterListener): Unit
setOnKeyPreImeListener fun setOnKeyPreImeListener(l: OnKeyPreImeListener): Unit
setOnSearchStateChangeListener fun setOnSearchStateChangeListener(l: OnSearchStateChangeListener): Unit
setOnSelectionChangedListener fun setOnSelectionChangedListener(l: OnSelectionChangedListener): Unit
setOnTextChangeListener fun setOnTextChangeListener(l: OnTextChangeListener): Unit
setOnWindowsFocusChangeListener fun setOnWindowsFocusChangeListener(l: OnWindowsFocusChangeListener): Unit
setText open fun setText(text: CharSequence?, type: <ERROR CLASS>): Unit
fun setText(text: CharSequence?, shouldAutoComplete: Boolean = true): Unit

Companion Object Properties

Name Summary