interface Display : Closeable
state
: StateFlow<DisplayState>
[Get] |
The current state of the display capability.
State transitions:
Signature
abstract val state: StateFlow<DisplayState> |
clearDisplay
()
|
Clears content currently rendered on the wearable display.
This removes the current display content without stopping the display capability or detaching it from the parent session. After a successful clear, the same Display can render new content by calling Display.sendContent.
Signature
abstract suspend fun clearDisplay(): DatResult<Boolean, DisplayError> |
close
()
|
Signature
abstract override fun close() |
sendContent
(
content
)
|
Builds and sends content to the wearable device using the Display Views DSL.
The content block provides a ContentScope where you can build layouts using flexBox or render video using video. Each call to sendContent replaces any previously displayed content.
Example:
display.sendContent {
flexBox(direction = Direction.COLUMN, gap = 8) {
text("Hello, Glasses!", style = TextStyle.HEADING)
button(label = "Dismiss") { /* onClick */}
}
}
Signature
abstract suspend fun sendContent(content: ContentScope.() -> Unit): DatResult<Boolean, DisplayError> Parameters content: Function1
The builder block to construct the display content.
|
stop
()
|
Stops this display, releasing its resources and detaching it from the parent session.
After calling Display.stop, the display is invalidated and cannot be reused. Calling Display.stop on an already-stopped display is a no-op. Display.close delegates to Display.stop for Closeable compatibility.
Signature
abstract fun stop() |