-
- All Implemented Interfaces:
-
com.google.android.horologist.tiles.render.TileLayoutRenderer
public abstract class SingleTileLayoutRenderer<T extends Object, R extends Object> implements TileLayoutRenderer<T, R>
A TileLayoutRenderer designed with typical but restrictive limitations, such as a single tile in the timeline, and fixed resources that will be updated by changing ids instead of version.
-
-
Field Summary
Fields Modifier and Type Field Description private final Colorsthemeprivate final LongfreshnessIntervalMillisprivate final Contextcontextprivate final BooleandebugResourceMode
-
Constructor Summary
Constructors Constructor Description SingleTileLayoutRenderer(Context context, Boolean debugResourceMode)
-
Method Summary
Modifier and Type Method Description final ColorsgetTheme()LonggetFreshnessIntervalMillis()final ContextgetContext()The context to avoid passing in through each render method. final BooleangetDebugResourceMode()final TileBuilders.TilerenderTimeline(T state, RequestBuilders.TileRequest requestParams)Produce a Timeline for the given tile request and the given state. StringgetResourcesVersionForTileState(T state)ColorscreateTheme()Create a material theme that should be applied to all components. abstract LayoutElementBuilders.LayoutElementrenderTile(T state, DeviceParametersBuilders.DeviceParameters deviceParameters)Render a single tile as a LayoutElement, that will be the only item in the timeline. final ResourceBuilders.ResourcesproduceRequestedResources(R resourceState, RequestBuilders.ResourcesRequest requestParams)Produce resources for the given request. UnitproduceRequestedResources(ResourceBuilders.Resources.Builder $self, R resourceState, DeviceParametersBuilders.DeviceParameters deviceParameters, List<String> resourceIds)Add resources directly to the builder. StateBuilders.StatecreateState()-
-
Method Detail
-
getFreshnessIntervalMillis
Long getFreshnessIntervalMillis()
-
getContext
final Context getContext()
The context to avoid passing in through each render method.
-
getDebugResourceMode
final Boolean getDebugResourceMode()
-
renderTimeline
final TileBuilders.Tile renderTimeline(T state, RequestBuilders.TileRequest requestParams)
Produce a Timeline for the given tile request and the given state.
The state may either represent a single tile or a timeline, in which case the renderer is responsible for determining how many tiles in the timeline.
- Parameters:
requestParams- the incoming request params.
-
getResourcesVersionForTileState
String getResourcesVersionForTileState(T state)
-
createTheme
Colors createTheme()
Create a material theme that should be applied to all components.
-
renderTile
abstract LayoutElementBuilders.LayoutElement renderTile(T state, DeviceParametersBuilders.DeviceParameters deviceParameters)
Render a single tile as a LayoutElement, that will be the only item in the timeline.
-
produceRequestedResources
final ResourceBuilders.Resources produceRequestedResources(R resourceState, RequestBuilders.ResourcesRequest requestParams)
Produce resources for the given request. The implementation should read androidx.wear.tiles.RequestBuilders.ResourcesRequest.getResourceIds and if not empty only return the requested resources.
- Parameters:
resourceState- the state of the resources, typically a data class containing loaded bitmaps.requestParams- the incoming request params.
-
produceRequestedResources
Unit produceRequestedResources(ResourceBuilders.Resources.Builder $self, R resourceState, DeviceParametersBuilders.DeviceParameters deviceParameters, List<String> resourceIds)
Add resources directly to the builder.
-
createState
StateBuilders.State createState()
-
-
-
-