Interface UIIndirectScribbleInteractionDelegate


  • public interface UIIndirectScribbleInteractionDelegate
    The protocol to be implemented by the delegate of UIIndirectScribbleInteraction. It will be responsible for supplying a list of writable elements, focusing them, and ultimately providing a real UITextInput that will handle text editing operations.
    • Method Detail

      • indirectScribbleInteractionDidFinishWritingInElement

        default void indirectScribbleInteractionDidFinishWritingInElement​(UIIndirectScribbleInteraction interaction,
                                                                          java.lang.Object elementIdentifier)
        Will be called when the user finished writing into an element, after the last word has been transcribed and committed.
        Parameters:
        interaction - The interaction notifying about writing state changes.
        elementIdentifier - The identifier of the element the user finished writing into.
      • indirectScribbleInteractionFocusElementIfNeededReferencePointCompletion

        void indirectScribbleInteractionFocusElementIfNeededReferencePointCompletion​(UIIndirectScribbleInteraction interaction,
                                                                                     java.lang.Object elementIdentifier,
                                                                                     CGPoint focusReferencePoint,
                                                                                     UIIndirectScribbleInteractionDelegate.Block_indirectScribbleInteractionFocusElementIfNeededReferencePointCompletion completion)
        Asks the delegate to focus an element to handle text edits. In response, it should make the element the currently focused one, and make the corresponding UITextInput become first responder. If the element was not focused already, text selection should be set to the character location closest to focusReferencePoint, to avoid any scrolling or shifting of content. If the element was focused already, no changes in selection should be made and this call can be ignored, but you must still call the completion handler with a reference to the text input.
        Parameters:
        interaction - The interaction that is requesting to focus an element.
        elementIdentifier - The identifier of the element that should be focused.
        completion - You must always call the completion handler, either synchronously or asynchronously. On success, the first parameter should be the text input that became first responder and that will handle text operations for this element. On failure, call the completion with a nil parameter.
      • indirectScribbleInteractionFrameForElement

        CGRect indirectScribbleInteractionFrameForElement​(UIIndirectScribbleInteraction interaction,
                                                          java.lang.Object elementIdentifier)
        Asks the delegate to provide the frame of an element.
        Parameters:
        interaction - The interaction asking for the element's frame.
        elementIdentifier - The identifier of the element the interaction is asking about.
        Returns:
        Frame for the element, in the interactions's view coordinate system.
      • indirectScribbleInteractionIsElementFocused

        boolean indirectScribbleInteractionIsElementFocused​(UIIndirectScribbleInteraction interaction,
                                                            java.lang.Object elementIdentifier)
        Asks the delegate if an element is currently focused, according to the internal state of the interaction's view.
        Parameters:
        interaction - The interaction asking for the focused state.
        elementIdentifier - The identifier of the element the interaction is asking about.
        Returns:
        Return YES if the element is the one currently focused.
      • indirectScribbleInteractionRequestElementsInRectCompletion

        void indirectScribbleInteractionRequestElementsInRectCompletion​(UIIndirectScribbleInteraction interaction,
                                                                        CGRect rect,
                                                                        UIIndirectScribbleInteractionDelegate.Block_indirectScribbleInteractionRequestElementsInRectCompletion completion)
        This method will be called to request the text input elements in a certain rect of the view, each of which represents an area where the user can start writing even if it's not a text input field itself.
        Parameters:
        interaction - The interaction asking for the elements.
        rect - The rect around the area where the user is trying to write, in the interaction's view coordinate system. Only elements intersecting this rect should be returned.
        completion - You must call the completion handler, synchronously or asynchronously, with an array of identifiers of the available elements, or an empty array if no elements are available.
      • indirectScribbleInteractionShouldDelayFocusForElement

        default boolean indirectScribbleInteractionShouldDelayFocusForElement​(UIIndirectScribbleInteraction interaction,
                                                                              java.lang.Object elementIdentifier)
        Allow the delegate to delay focusing an element. Normally, Scribble will focus the element as soon as the user begins writing, but if you return YES from this callback, it will wait until the user makes a brief pause. This is useful in cases where the element's frame will shift or transform when becoming focused, which can be disruptive to a user trying to handwrite into it. Wherever possible it is preferable to adjust the UI behavior to avoid the layout changes, and only use delayed focus as a last resort, since transcription will happen all at once instead of incrementally.
        Parameters:
        interaction - The interaction asking about delaying focus.
        elementIdentifier - The identifier of the element the interaction is asking about.
        Returns:
        Return YES to delay focusing the element.
      • indirectScribbleInteractionWillBeginWritingInElement

        default void indirectScribbleInteractionWillBeginWritingInElement​(UIIndirectScribbleInteraction interaction,
                                                                          java.lang.Object elementIdentifier)
        Will be called when the user begins writing into an element. This call will always be paired with a corresponding call to indirectScribbleInteraction:didFinishWritingInElement:. It is recommended to use this call to hide custom placeholders or other UI elements that can interfere with writing.
        Parameters:
        interaction - The interaction notifying about writing state changes.
        elementIdentifier - The identifier of the element the user is writing into.