Package org.mozilla.geckoview
Class SessionTextInput
Object
org.mozilla.geckoview.SessionTextInput
SessionTextInput handles text input for GeckoSession through key events or input
methods. It is typically used to implement certain methods in View such as
View.onCreateInputConnection(android.view.inputmethod.EditorInfo), by forwarding such calls to corresponding
methods in SessionTextInput.
For full functionality, SessionTextInput requires a View to be
set first through setView(android.view.View). When a View is not set or set to null,
SessionTextInput will operate in a reduced functionality mode. See onCreateInputConnection(android.view.inputmethod.EditorInfo) and methods in GeckoSession.TextInputDelegate for changes in
behavior in this viewless mode.
-
Method Summary
Modifier and TypeMethodDescriptionGet the current text input delegate.getHandler(Handler defHandler) Get a Handler for the background input method thread.getView()Get the currentViewfor text input.Get anInputConnectioninstance.booleanProcess a KeyEvent as a key-down event.booleanonKeyLongPress(int keyCode, KeyEvent event) Process a KeyEvent as a long-press event.booleanonKeyMultiple(int keyCode, int repeatCount, KeyEvent event) Process a KeyEvent as a multiple-press event.booleanonKeyPreIme(int keyCode, KeyEvent event) Process a KeyEvent as a pre-IME event.booleanProcess a KeyEvent as a key-up event.voidsetDelegate(GeckoSession.TextInputDelegate delegate) Set the current text input delegate.voidSet the currentViewfor text input.
-
Method Details
-
getHandler
Get a Handler for the background input method thread.- Parameters:
defHandler- Handler returned by the systemgetHandlerimplementation.- Returns:
- Handler to return to the system through
getHandler.
-
getView
Get the currentViewfor text input.- Returns:
- Current text input View or null if not set.
- See Also:
-
setView
Set the currentViewfor text input. TheViewis used to interact with the system input method manager and to display certain text input UI elements. See theSessionTextInputclass documentation for information on viewless mode, when the currentViewis not set or set to null.- Parameters:
view- Text input View or null to clear current View.- See Also:
-
onCreateInputConnection
Get anInputConnectioninstance. In viewless mode, this method still fills out theEditorInfoobject, but the return value will always be null.- Parameters:
attrs- EditorInfo instance to be filled on return.- Returns:
- InputConnection instance, or null if there is no active input (or if in viewless mode).
-
onKeyPreIme
Process a KeyEvent as a pre-IME event.- Parameters:
keyCode- Key code.event- KeyEvent instance.- Returns:
- True if the event was handled.
-
onKeyDown
Process a KeyEvent as a key-down event.- Parameters:
keyCode- Key code.event- KeyEvent instance.- Returns:
- True if the event was handled.
-
onKeyUp
Process a KeyEvent as a key-up event.- Parameters:
keyCode- Key code.event- KeyEvent instance.- Returns:
- True if the event was handled.
-
onKeyLongPress
Process a KeyEvent as a long-press event.- Parameters:
keyCode- Key code.event- KeyEvent instance.- Returns:
- True if the event was handled.
-
onKeyMultiple
Process a KeyEvent as a multiple-press event.- Parameters:
keyCode- Key code.repeatCount- Key repeat count.event- KeyEvent instance.- Returns:
- True if the event was handled.
-
setDelegate
Set the current text input delegate.- Parameters:
delegate- TextInputDelegate instance or null to restore to default.
-
getDelegate
Get the current text input delegate.- Returns:
- TextInputDelegate instance or a default instance if no delegate has been set.
-