TileRenderer


class TileRenderer


Renderer for Wear Tiles.

This variant uses Android views to represent the contents of the Wear Tile.

Summary

Nested types

This interface is deprecated.

Use < with TileRenderer.

Public constructors

TileRenderer(
    uiContext: Context,
    loadActionExecutor: Executor,
    loadActionListener: Consumer<StateBuilders.State!>
)
TileRenderer(
    uiContext: Context,
    layout: LayoutElementBuilders.Layout,
    resources: ResourceBuilders.Resources,
    loadActionExecutor: Executor,
    loadActionListener: TileRenderer.LoadActionListener
)

This function is deprecated.

Use TileRenderer which accepts Layout and Resources in inflateAsync method.

TileRenderer(
    uiContext: Context,
    layout: LayoutElementBuilders.Layout,
    tilesTheme: @StyleRes Int,
    resources: ResourceBuilders.Resources,
    loadActionExecutor: Executor,
    loadActionListener: TileRenderer.LoadActionListener
)

This function is deprecated.

Use TileRenderer which accepts Layout and Resources in inflateAsync method.

Public functions

View?
inflate(parent: ViewGroup)

This function is deprecated.

Use inflateAsync instead.

ListenableFuture<View!>
inflateAsync(
    layout: LayoutElementBuilders.Layout,
    resources: ResourceBuilders.Resources,
    parent: ViewGroup
)

Inflates a Tile into parent.

Unit

Sets the state for the current (and future) layouts.

Public constructors

TileRenderer

Added in 1.2.0
TileRenderer(
    uiContext: Context,
    loadActionExecutor: Executor,
    loadActionListener: Consumer<StateBuilders.State!>
)
Parameters
uiContext: Context

A Context suitable for interacting with the UI.

loadActionExecutor: Executor

Executor for loadActionListener.

loadActionListener: Consumer<StateBuilders.State!>

Listener for clicks that will cause the contents to be reloaded.

TileRenderer

Added in 1.0.0
Deprecated in 1.2.0
TileRenderer(
    uiContext: Context,
    layout: LayoutElementBuilders.Layout,
    resources: ResourceBuilders.Resources,
    loadActionExecutor: Executor,
    loadActionListener: TileRenderer.LoadActionListener
)

Default constructor.

Parameters
uiContext: Context

A Context suitable for interacting with the UI.

layout: LayoutElementBuilders.Layout

The portion of the Tile to render.

resources: ResourceBuilders.Resources

The resources for the Tile.

loadActionExecutor: Executor

Executor for loadActionListener.

loadActionListener: TileRenderer.LoadActionListener

Listener for clicks that will cause the contents to be reloaded.

TileRenderer

Added in 1.0.0
Deprecated in 1.2.0
TileRenderer(
    uiContext: Context,
    layout: LayoutElementBuilders.Layout,
    tilesTheme: @StyleRes Int,
    resources: ResourceBuilders.Resources,
    loadActionExecutor: Executor,
    loadActionListener: TileRenderer.LoadActionListener
)

Default constructor.

Parameters
uiContext: Context

A Context suitable for interacting with the UI.

layout: LayoutElementBuilders.Layout

The portion of the Tile to render.

tilesTheme: @StyleRes Int

The theme to use for this Tile instance. This can be used to customise things like the default font family. Pass 0 to use the default theme.

resources: ResourceBuilders.Resources

The resources for the Tile.

loadActionExecutor: Executor

Executor for loadActionListener.

loadActionListener: TileRenderer.LoadActionListener

Listener for clicks that will cause the contents to be reloaded.

Public functions

inflate

Added in 1.0.0
Deprecated in 1.2.0
fun inflate(parent: ViewGroup): View?

Inflates a Tile into parent.

Parameters
parent: ViewGroup

The view to attach the tile into.

Returns
View?

The first child that was inflated. This may be null if the Layout is empty or the top-level LayoutElement has no inner set, or the top-level LayoutElement contains an unsupported inner type.

inflateAsync

Added in 1.2.0
fun inflateAsync(
    layout: LayoutElementBuilders.Layout,
    resources: ResourceBuilders.Resources,
    parent: ViewGroup
): ListenableFuture<View!>

Inflates a Tile into parent.

Parameters
layout: LayoutElementBuilders.Layout

The portion of the Tile to render.

resources: ResourceBuilders.Resources

The resources for the Tile.

parent: ViewGroup

The view to attach the tile into.

Returns
ListenableFuture<View!>

The future with the first child that was inflated. This may be null if the Layout is empty or the top-level LayoutElement has no inner set, or the top-level LayoutElement contains an unsupported inner type.

setState

Added in 1.2.0
fun setState(
    newState: (Mutable)Map<AppDataKey<Any!>!, DynamicDataBuilders.DynamicDataValue<Any!>!>
): Unit

Sets the state for the current (and future) layouts. This is equivalent to setting the tile state via addKeyToValueMapping

Parameters
newState: (Mutable)Map<AppDataKey<Any!>!, DynamicDataBuilders.DynamicDataValue<Any!>!>

the state to use for the current layout (and any future layouts). This value will replace any previously set state.

Throws
java.lang.IllegalStateException

if number of newState entries is greater than getMaxStateEntryCount.