TileRendererInternal

public final class TileRendererInternal


Renderer for Tiles.

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

Summary

Nested types

TileRendererInternal.LoadActionListener

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

Public constructors

TileRendererInternal(
    @NonNull Context uiContext,
    @NonNull LayoutElementProto.Layout layout,
    @NonNull ResourceResolvers resourceResolvers,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRendererInternal.LoadActionListener loadActionListener
)

Default constructor.

TileRendererInternal(
    @NonNull Context uiContext,
    @NonNull LayoutElementProto.Layout layout,
    @NonNull ResourceResolvers resourceResolvers,
    @StyleRes @NonNull int tilesTheme,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRendererInternal.LoadActionListener loadActionListener
)

Default constructor.

Public methods

static @Nullable Intent
buildLaunchActionIntent(
    @NonNull ActionProto.LaunchAction launchAction,
    @NonNull String clickableId
)

Returns an Android Intent that can perform the action defined in the given tile LaunchAction.

@Nullable View

Inflates a Tile into {@code parent}.

Public constructors

TileRendererInternal

public TileRendererInternal(
    @NonNull Context uiContext,
    @NonNull LayoutElementProto.Layout layout,
    @NonNull ResourceResolvers resourceResolvers,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRendererInternal.LoadActionListener loadActionListener
)

Default constructor.

Parameters
@NonNull Context uiContext

A Context suitable for interacting with the UI.

@NonNull LayoutElementProto.Layout layout

The portion of the Tile to render.

@NonNull ResourceResolvers resourceResolvers

Resolvers for the resources used for rendering this Prototile.

@NonNull Executor loadActionExecutor

Executor to dispatch loadActionListener on.

@NonNull TileRendererInternal.LoadActionListener loadActionListener

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

TileRendererInternal

public TileRendererInternal(
    @NonNull Context uiContext,
    @NonNull LayoutElementProto.Layout layout,
    @NonNull ResourceResolvers resourceResolvers,
    @StyleRes @NonNull int tilesTheme,
    @NonNull Executor loadActionExecutor,
    @NonNull TileRendererInternal.LoadActionListener loadActionListener
)

Default constructor.

Parameters
@NonNull Context uiContext

A Context suitable for interacting with the UI.

@NonNull LayoutElementProto.Layout layout

The portion of the Tile to render.

@NonNull ResourceResolvers resourceResolvers

Resolvers for the resources used for rendering this Prototile.

@StyleRes @NonNull int tilesTheme

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

@NonNull Executor loadActionExecutor

Executor to dispatch loadActionListener on.

@NonNull TileRendererInternal.LoadActionListener loadActionListener

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

Public methods

buildLaunchActionIntent

@Nullable
@NonNull
public static Intent buildLaunchActionIntent(
    @NonNull ActionProto.LaunchAction launchAction,
    @NonNull String clickableId
)

Returns an Android Intent that can perform the action defined in the given tile LaunchAction.

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.