Package org.mozilla.geckoview
Interface GeckoSession.TextInputDelegate
- Enclosing class:
- GeckoSession
public static interface GeckoSession.TextInputDelegate
Interface that SessionTextInput uses for performing operations such as opening and closing the
software keyboard. If the delegate is not set, these operations are forwarded to the system
InputMethodManager
automatically.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Restarting input due to an input field losing focus.static final int
Restarting input due to the content of the input field changing.static final int
Restarting input due to an input field gaining focus. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
hideSoftInput
(GeckoSession session) Hide the soft input.default void
restartInput
(GeckoSession session, int reason) Reset the input method, and discard any existing states such as the current composition or current autocompletion.default void
showSoftInput
(GeckoSession session) Display the soft input.default void
updateCursorAnchorInfo
(GeckoSession session, CursorAnchorInfo info) Update the cursor-anchor information as requested throughInputConnection.requestCursorUpdates(int)
.default void
updateExtractedText
(GeckoSession session, ExtractedTextRequest request, ExtractedText text) Update the soft input on the current extracted text, as requested throughInputConnection.getExtractedText(android.view.inputmethod.ExtractedTextRequest, int)
.default void
updateSelection
(GeckoSession session, int selStart, int selEnd, int compositionStart, int compositionEnd) Update the soft input on the current selection.
-
Field Details
-
RESTART_REASON_FOCUS
static final int RESTART_REASON_FOCUSRestarting input due to an input field gaining focus.- See Also:
-
RESTART_REASON_BLUR
static final int RESTART_REASON_BLURRestarting input due to an input field losing focus.- See Also:
-
RESTART_REASON_CONTENT_CHANGE
static final int RESTART_REASON_CONTENT_CHANGERestarting input due to the content of the input field changing. For example, the input field type may have changed, or the current composition may have been committed outside of the input method.- See Also:
-
-
Method Details
-
restartInput
Reset the input method, and discard any existing states such as the current composition or current autocompletion. Because the current focused editor may have changed, as part of the reset, a custom input method would normally callSessionTextInput.onCreateInputConnection(android.view.inputmethod.EditorInfo)
to update its knowledge of the focused editor. Note thatrestartInput
should be used to detect changes in focus, rather thanshowSoftInput(org.mozilla.geckoview.GeckoSession)
orhideSoftInput(org.mozilla.geckoview.GeckoSession)
, because focus changes are not always accompanied by requests to show or hide the soft input. This method is always called, even in viewless mode.- Parameters:
session
- Session instance.reason
- Reason for the reset.
-
showSoftInput
Display the soft input. May be called consecutively, even if the soft input is already shown. This method is always called, even in viewless mode.- Parameters:
session
- Session instance.- See Also:
-
hideSoftInput
Hide the soft input. May be called consecutively, even if the soft input is already hidden. This method is always called, even in viewless mode.- Parameters:
session
- Session instance.- See Also:
-
updateSelection
@UiThread default void updateSelection(@NonNull GeckoSession session, int selStart, int selEnd, int compositionStart, int compositionEnd) Update the soft input on the current selection. This method is not called in viewless mode.- Parameters:
session
- Session instance.selStart
- Start offset of the selection.selEnd
- End offset of the selection.compositionStart
- Composition start offset, or -1 if there is no composition.compositionEnd
- Composition end offset, or -1 if there is no composition.
-
updateExtractedText
@UiThread default void updateExtractedText(@NonNull GeckoSession session, @NonNull ExtractedTextRequest request, @NonNull ExtractedText text) Update the soft input on the current extracted text, as requested throughInputConnection.getExtractedText(android.view.inputmethod.ExtractedTextRequest, int)
. Consequently, this method is not called in viewless mode.- Parameters:
session
- Session instance.request
- The extract text request.text
- The extracted text.
-
updateCursorAnchorInfo
@UiThread default void updateCursorAnchorInfo(@NonNull GeckoSession session, @NonNull CursorAnchorInfo info) Update the cursor-anchor information as requested throughInputConnection.requestCursorUpdates(int)
. Consequently, this method is not called in viewless mode.- Parameters:
session
- Session instance.info
- Cursor-anchor information.
-