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 Details

    • RESTART_REASON_FOCUS

      static final int RESTART_REASON_FOCUS
      Restarting input due to an input field gaining focus.
      See Also:
    • RESTART_REASON_BLUR

      static final int RESTART_REASON_BLUR
      Restarting input due to an input field losing focus.
      See Also:
    • RESTART_REASON_CONTENT_CHANGE

      static final int RESTART_REASON_CONTENT_CHANGE
      Restarting 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

      @UiThread default void restartInput(@NonNull GeckoSession session, int reason)
      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 call SessionTextInput.onCreateInputConnection(android.view.inputmethod.EditorInfo) to update its knowledge of the focused editor. Note that restartInput should be used to detect changes in focus, rather than showSoftInput(org.mozilla.geckoview.GeckoSession) or hideSoftInput(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

      @UiThread default void showSoftInput(@NonNull GeckoSession session)
      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

      @UiThread default void hideSoftInput(@NonNull GeckoSession session)
      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 through InputConnection.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 through InputConnection.requestCursorUpdates(int). Consequently, this method is not called in viewless mode.
      Parameters:
      session - Session instance.
      info - Cursor-anchor information.