TileRenderer

public final class TileRenderer


Renderer for Wear Tiles.

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

Summary

Nested types

TileRenderer.LoadActionListener

Listener for clicks on Clickable objects that have an Action to (re)load the contents of a tile.

Public constructors

TileRenderer(
    @NonNull Context appContext,
    @NonNull LayoutElementBuilders.Layout layout,
    @NonNull ResourceBuilders.Resources resources,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRenderer.LoadActionListener loadActionListener
)

Default constructor.

TileRenderer(
    @NonNull Context appContext,
    @NonNull LayoutElementBuilders.Layout layout,
    @StyleRes @NonNull int tilesTheme,
    @NonNull ResourceBuilders.Resources resources,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRenderer.LoadActionListener loadActionListener
)

Default constructor.

Public methods

@Nullable View

Inflates a Tile into {@code parent}.

Public constructors

TileRenderer

public TileRenderer(
    @NonNull Context appContext,
    @NonNull LayoutElementBuilders.Layout layout,
    @NonNull ResourceBuilders.Resources resources,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRenderer.LoadActionListener loadActionListener
)

Default constructor.

Parameters
@NonNull Context appContext

The application context.

@NonNull LayoutElementBuilders.Layout layout

The portion of the Tile to render.

@NonNull ResourceBuilders.Resources resources

The resources for the Tile.

@NonNull TileRenderer.LoadActionListener loadActionListener

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

TileRenderer

public TileRenderer(
    @NonNull Context appContext,
    @NonNull LayoutElementBuilders.Layout layout,
    @StyleRes @NonNull int tilesTheme,
    @NonNull ResourceBuilders.Resources resources,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRenderer.LoadActionListener loadActionListener
)

Default constructor.

Parameters
@NonNull Context appContext

The application context.

@NonNull LayoutElementBuilders.Layout layout

The portion of the Tile to render.

@StyleRes @NonNull int tilesTheme

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.

@NonNull ResourceBuilders.Resources resources

The resources for the Tile.

@NonNull TileRenderer.LoadActionListener loadActionListener

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

Public methods

inflate

@Nullable
@NonNull
public View inflate(@NonNull ViewGroup parent)

Inflates a Tile into {@code parent}.

Parameters
@NonNull ViewGroup parent

The view to attach the tile into.

Returns
View

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