GlanceRemoteViews

@ExperimentalGlanceRemoteViewsApi
class GlanceRemoteViews


Object containing the information needed to generate a RemoteViews. The same instance should be reused to compose layouts for a host view.

Summary

Public constructors

Public functions

suspend RemoteViewsCompositionResult
compose(
    context: Context,
    size: DpSize,
    state: Any?,
    appWidgetOptions: Bundle,
    content: @Composable () -> Unit
)

Triggers the composition of content and returns the result.

Public constructors

GlanceRemoteViews

Added in 1.0.0
GlanceRemoteViews()

Public functions

compose

suspend fun compose(
    context: Context,
    size: DpSize,
    state: Any? = null,
    appWidgetOptions: Bundle = Bundle(),
    content: @Composable () -> Unit
): RemoteViewsCompositionResult

Triggers the composition of content and returns the result.

Parameters
context: Context

The Context to get the resources during RemoteViews building.

size: DpSize

Size of the RemoteViews to be displayed at.

state: Any? = null

Local view state that can be passed to composition through LocalState.

appWidgetOptions: Bundle = Bundle()

AppWidget options Bundle to be passed to composition through LocalAppWidgetOptions.

content: @Composable () -> Unit

Definition of the UI.

Returns
RemoteViewsCompositionResult

Composition result containing the RemoteViews.