open class InlineAutocompleteEditText : AppCompatEditText
(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).
data class AutocompleteResult |
InlineAutocompleteEditText(ctx: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.editTextStyle)
A UI edit text component which supports inline autocompletion. |
var autocompleteResult: AutocompleteResult |
|
val ctx: Context |
|
val nonAutocompleteText: String |
|
val originalText: String |
fun applyAutocompleteResult(result: AutocompleteResult): Unit
Applies the provided result by updating the current autocomplete text and selection, if any. |
|
open fun onAttachedToWindow(): Unit |
|
open fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection?
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. |
|
open fun onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: Rect?): Unit |
|
open fun onKeyPreIme(keyCode: Int, event: KeyEvent): Boolean |
|
open fun onSelectionChanged(selStart: Int, selEnd: Int): Unit |
|
open fun onTouchEvent(event: MotionEvent): Boolean |
|
open fun onWindowFocusChanged(hasFocus: Boolean): Unit |
|
open fun sendAccessibilityEventUnchecked(event: AccessibilityEvent): Unit |
|
fun setOnCommitListener(l: OnCommitListener): Unit |
|
fun setOnFilterListener(l: OnFilterListener): Unit |
|
fun setOnKeyPreImeListener(l: OnKeyPreImeListener): Unit |
|
fun setOnSearchStateChangeListener(l: OnSearchStateChangeListener): Unit |
|
fun setOnSelectionChangedListener(l: OnSelectionChangedListener): Unit |
|
fun setOnTextChangeListener(l: OnTextChangeListener): Unit |
|
fun setOnWindowsFocusChangeListener(l: OnWindowsFocusChangeListener): Unit |
|
open fun setText(text: CharSequence?, type: BufferType): Unit |
val AUTOCOMPLETE_SPAN: Concrete |
|
val DEFAULT_AUTOCOMPLETE_BACKGROUND_COLOR: Int |
val View.isLTR: Boolean
Is the horizontal layout direction of this view from Left to Right? |
|
val View.isRTL: Boolean
Is the horizontal layout direction of this view from Right to Left? |
fun View.hideKeyboard(): Unit
Hides the soft input window. |
|
fun View.isGone(): Boolean
Returns true if this view's visibility is set to View.GONE. |
|
fun View.isInvisible(): Boolean
Returns true if this view's visibility is set to View.INVISIBLE. |
|
fun View.isVisible(): Boolean
Returns true if this view's visibility is set to View.VISIBLE. |
|
fun View.showKeyboard(flags: Int = InputMethodManager.SHOW_IMPLICIT): Unit
Tries to focus this view and show the soft input window for it. |