ListenableEditorSession.Companion

object ListenableEditorSession.Companion


Summary

Public functions

@RequiresApi(value = 27) @UiThread ListenableEditorSession
createHeadlessEditorSession(
    activity: ComponentActivity?,
    editIntent: Intent?,
    headlessWatchFaceClient: HeadlessWatchFaceClient?
)

Constructs an ListenableEditorSession for a remote watch face editor.

@UiThread ListenableFuture<ListenableEditorSession?>

Constructs a ListenableFuture for a ListenableEditorSession for an on watch face editor.

Public functions

createHeadlessEditorSession

@RequiresApi(value = 27)
@UiThread
fun createHeadlessEditorSession(
    activity: ComponentActivity?,
    editIntent: Intent?,
    headlessWatchFaceClient: HeadlessWatchFaceClient?
): ListenableEditorSession

Constructs an ListenableEditorSession for a remote watch face editor.

Parameters
activity: ComponentActivity?

The ComponentActivity associated with the EditorSession.

editIntent: Intent?

Intent sent by SysUI to launch the editing session.

headlessWatchFaceClient: HeadlessWatchFaceClient?

The HeadlessWatchFaceClient that backs the constructed EditorSession.

listenableCreateOnWatchEditorSession

@UiThread
fun listenableCreateOnWatchEditorSession(activity: ComponentActivity?): ListenableFuture<ListenableEditorSession?>

Constructs a ListenableFuture for a ListenableEditorSession for an on watch face editor. This registers an activity result handler and so it must be called during an Activity or Fragment initialization path. The EditorSession is lifecycle aware and will automatically close when onDestroy is received.

If watch face editor takes more than 4s to create a watch face, returned future will be resolved with TimeoutCancellationException exception.

Parameters
activity: ComponentActivity?

The ComponentActivity associated with the EditorSession.