Stay organized with collections Save and categorize content based on your preferences.

HandwritingDelegateConfiguration

public class HandwritingDelegateConfiguration
extends Object

java.lang.Object
   ↳ android.view.HandwritingDelegateConfiguration


Configuration for a view to act as a handwriting initiation delegate. This allows handwriting mode for a delegator editor view to be initiated by stylus movement on the delegate view.

If a stylus MotionEvent occurs within the delegate view's bounds, the callback returned by getInitiationCallback() will be called. The callback implementation is expected to show and focus the delegator editor view. If a view with identifier matching getDelegatorViewId() creates an input connection while the same stylus MotionEvent sequence is ongoing, handwriting mode will be initiated for that view.

A common use case is a custom view which looks like a text editor but does not actually support text editing itself, and clicking on the custom view causes an EditText to be shown. To support handwriting initiation in this case, View#setHandwritingDelegateConfiguration can be called on the custom view to configure it as a delegate, and set the EditText as the delegator by passing the EditText's identifier as the delegatorViewId. The initiationCallback implementation is typically the same as the click listener implementation which shows the EditText.

Summary

Public constructors

HandwritingDelegateConfiguration(int delegatorViewId, Runnable initiationCallback)

Constructs a HandwritingDelegateConfiguration instance.

Public methods

int getDelegatorViewId()

Returns the identifier of the delegator editor view for which handwriting mode should be initiated.

Runnable getInitiationCallback()

Returns the callback which should be called when a stylus MotionEvent occurs within the delegate view's bounds.

Inherited methods

Public constructors

HandwritingDelegateConfiguration

public HandwritingDelegateConfiguration (int delegatorViewId, 
                Runnable initiationCallback)

Constructs a HandwritingDelegateConfiguration instance.

Parameters
delegatorViewId int: identifier of the delegator editor view for which handwriting mode should be initiated

initiationCallback Runnable: callback called when a stylus MotionEvent occurs within this view's bounds. This will be called from the UI thread. This value cannot be null.

Public methods

getDelegatorViewId

public int getDelegatorViewId ()

Returns the identifier of the delegator editor view for which handwriting mode should be initiated.

Returns
int

getInitiationCallback

public Runnable getInitiationCallback ()

Returns the callback which should be called when a stylus MotionEvent occurs within the delegate view's bounds. The callback should only be called from the UI thread.

Returns
Runnable This value cannot be null.