TileRenderer
class TileRenderer
Renderer for Wear Tiles.
This variant uses Android views to represent the contents of the Wear Tile.
Summary
Nested types |
|---|
class TileRenderer.BuilderBuilder for |
interface TileRenderer.LoadActionListenerThis interface is deprecated. Use |
Public constructors |
|---|
TileRenderer(Constructor for |
This function is deprecated. Use |
This function is deprecated. Use |
Public functions |
|
|---|---|
Executor |
Returns the |
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 |
View? |
This function is deprecated. Use |
ListenableFuture<View!> |
inflateAsync(Inflates a Tile into |
Unit |
setState(Sets the state for the current (and future) layouts. |
Public constructors
TileRenderer
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 |
loadActionExecutor: Executor |
Executor for |
loadActionListener: Consumer<StateBuilders.State!> |
Listener for clicks that will cause the contents to be reloaded. |
TileRenderer(
uiContext: Context,
layout: LayoutElementBuilders.Layout,
resources: ResourceBuilders.Resources,
loadActionExecutor: Executor,
loadActionListener: TileRenderer.LoadActionListener
)
Default constructor.
| Parameters | |
|---|---|
uiContext: Context |
A |
layout: LayoutElementBuilders.Layout |
The portion of the Tile to render. |
resources: ResourceBuilders.Resources |
The resources for the Tile. |
loadActionExecutor: Executor |
Executor for |
loadActionListener: TileRenderer.LoadActionListener |
Listener for clicks that will cause the contents to be reloaded. |
TileRenderer(
uiContext: Context,
layout: LayoutElementBuilders.Layout,
tilesTheme: @StyleRes Int,
resources: ResourceBuilders.Resources,
loadActionExecutor: Executor,
loadActionListener: TileRenderer.LoadActionListener
)
Default constructor.
| Parameters | |
|---|---|
uiContext: Context |
A |
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: TileRenderer.LoadActionListener |
Listener for clicks that will cause the contents to be reloaded. |
Public functions
getLoadActionExecutor
fun getLoadActionExecutor(): Executor
Returns the Executor for loadActionListener.
getLoadActionListener
fun getLoadActionListener(): Consumer<StateBuilders.State!>
Returns the Listener for clicks that will cause the contents to be reloaded.
getPlatformDataProviders
fun getPlatformDataProviders(): (Mutable)Map<PlatformDataProvider!, (Mutable)Set<PlatformDataKey<Any!>!>!>
Returns the platform data providers that will be registered for this Tile instance.
getTilesTheme
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
fun getUiContext(): Context
Returns the Context suitable for interacting with the UI.
funinflate(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
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
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 |