EditorSession.Companion

object EditorSession.Companion


Summary

Public functions

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

Constructs an EditorSession for a remote watch face editor.

suspend EditorSession

Constructs an EditorSession for an on watch face editor.

Public properties

Instant

If passed renderWatchFaceToBitmap this will signal that the watch face's default preview time should be used.

Duration

Timeout allowed for waiting for creating the watch face editing session.

Public functions

createHeadlessEditorSession

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

Constructs an EditorSession for a remote watch face editor.

Parameters
activity: ComponentActivity

The ComponentActivity associated with the EditorSession.

editIntent: Intent

The Intent sent by SysUI to launch the editing session.

headlessWatchFaceClient: HeadlessWatchFaceClient

The HeadlessWatchFaceClient to use for rendering etc...

Returns
EditorSession

The EditorSession or null if it could not be constructed.

createOnWatchEditorSession

@UiThread
suspend fun createOnWatchEditorSession(activity: ComponentActivity): EditorSession

Constructs an EditorSession 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.

Parameters
activity: ComponentActivity

The ComponentActivity associated with the EditorSession.

Returns
EditorSession

Deferred which is resolved with either the EditorSession or null if it can't be constructed.

Throws
kotlinx.coroutines.TimeoutCancellationException: kotlinx.coroutines.TimeoutCancellationException

if it takes longer than EDITING_SESSION_TIMEOUT to create a watch face editor.

Public properties

DEFAULT_PREVIEW_INSTANT

val DEFAULT_PREVIEW_INSTANTInstant

If passed renderWatchFaceToBitmap this will signal that the watch face's default preview time should be used.

EDITING_SESSION_TIMEOUT

val EDITING_SESSION_TIMEOUTDuration

Timeout allowed for waiting for creating the watch face editing session.