TileRenderer


class TileRenderer


Renderer for Wear Tiles.

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

Summary

Nested types

Builder for TileRenderer.

This interface is deprecated.

Use < with TileRenderer.

Public constructors

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

Constructor for TileRenderer.

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

This function is deprecated.

Use TileRenderer.Builder 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.Builder which accepts Layout and Resources in inflateAsync method.

Public functions

Executor

Returns the Executor for loadActionListener.

Consumer<StateBuilders.State!>

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

(Mutable)Map<PlatformDataProvider!, (Mutable)Set<PlatformDataKey<Any!>!>!>

Returns the platform data providers that will be registered for this Tile instance.

Int

Returns the theme to use for this Tile instance.

Context

Returns the Context suitable for interacting with the UI.

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!>
)

Constructor for TileRenderer.

It is recommended to use the new TileRenderer.Builder instead.

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

getLoadActionExecutor

Added in 1.4.0-alpha02
fun getLoadActionExecutor(): Executor

Returns the Executor for loadActionListener.

getLoadActionListener

Added in 1.4.0-alpha02
fun getLoadActionListener(): Consumer<StateBuilders.State!>

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

getPlatformDataProviders

Added in 1.4.0-alpha02
fun getPlatformDataProviders(): (Mutable)Map<PlatformDataProvider!, (Mutable)Set<PlatformDataKey<Any!>!>!>

Returns the platform data providers that will be registered for this Tile instance.

getTilesTheme

Added in 1.4.0-alpha02
fun getTilesTheme(): Int

Returns the theme to use for this Tile instance. This can be used to customise things like the default font family. Defaults to zero (default theme) if not specified by setTilesTheme.

getUiContext

Added in 1.4.0-alpha02
fun getUiContext(): Context

Returns the Context suitable for interacting with the UI.

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.