public final class

EdgeContentLayout.Builder

extends java.lang.Object

implements LayoutElementBuilders.LayoutElement.Builder

 java.lang.Object

↳androidx.wear.protolayout.material.layouts.EdgeContentLayout.Builder

Overview

Builder class for EdgeContentLayout.

Summary

Constructors
publicBuilder(DeviceParametersBuilders.DeviceParameters deviceParameters)

Creates a builder for the EdgeContentLayout.

Methods
public EdgeContentLayoutbuild()

Constructs and returns EdgeContentLayout with the provided content and look.

public EdgeContentLayout.BuildersetContent(LayoutElementBuilders.LayoutElement content)

Sets the additional content to this layout, inside of the screen.

public EdgeContentLayout.BuildersetContentAndSecondaryLabelSpacing(DimensionBuilders.DpProp height)

Sets the space size between the additional content and secondary label if there is any.

public EdgeContentLayout.BuildersetEdgeContent(LayoutElementBuilders.LayoutElement edgeContent)

Sets the content to be around the edges.

public EdgeContentLayout.BuildersetEdgeContentBehindAllOtherContent(boolean isBehind)

Sets whether the edge content passed in with EdgeContentLayout.Builder.setEdgeContent(LayoutElementBuilders.LayoutElement) should be positioned behind all other content in this layout or above it.

public EdgeContentLayout.BuildersetEdgeContentThickness(float thickness)

Sets the thickness of the hollow edge content so that other content is correctly placed.

public EdgeContentLayout.BuildersetPrimaryLabelTextContent(LayoutElementBuilders.LayoutElement primaryLabelText)

Sets the content in the primary label slot.

public EdgeContentLayout.BuildersetResponsiveContentInsetEnabled(boolean enabled)

Changes this EdgeContentLayout to better follow guidelines for type of layout that has content around the edge.

public EdgeContentLayout.BuildersetSecondaryLabelTextContent(LayoutElementBuilders.LayoutElement secondaryLabelText)

Sets the content in the secondary label slot which will be below the additional content.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(DeviceParametersBuilders.DeviceParameters deviceParameters)

Creates a builder for the EdgeContentLayout. Custom content inside of it can later be set with (EdgeContentLayout.Builder.setContent(LayoutElementBuilders.LayoutElement).

For optimal layouts across different screen sizes and better alignment with UX guidelines, it is highly recommended to call EdgeContentLayout.Builder.setResponsiveContentInsetEnabled(boolean).

Methods

public EdgeContentLayout.Builder setResponsiveContentInsetEnabled(boolean enabled)

Changes this EdgeContentLayout to better follow guidelines for type of layout that has content around the edge.

These updates include: 1. Using responsive insets for its content primary and secondary label by adding some additional space on the sides of these elements to avoid content going off the screen edge. 2. Changing layout padding to responsive to better follow different screen sizes. 3. Positioning primary label at a fixed place on top of the screen rather than following additional content.

It is highly recommended to call this method with true when using this layout to optimize it for different screen sizes.

public EdgeContentLayout.Builder setEdgeContentThickness(float thickness)

Sets the thickness of the hollow edge content so that other content is correctly placed. In other words, sets the space that should be reserved exclusively for the edge content and not be overdrawn by other inner content.

For example, for CircularProgressIndicator or LayoutElementBuilders.ArcLine elements, this should be equal to their stroke width/thickness.

Note that, calling this method when responsiveness is not set with EdgeContentLayout.Builder.setResponsiveContentInsetEnabled(boolean), will be ignored.

Sets the content to be around the edges. This can be CircularProgressIndicator.

If this content is something other that CircularProgressIndicator, please add its thickness with EdgeContentLayout.Builder.setEdgeContentThickness(float) for best results.

public EdgeContentLayout.Builder setPrimaryLabelTextContent(LayoutElementBuilders.LayoutElement primaryLabelText)

Sets the content in the primary label slot.

Depending on whether EdgeContentLayout.Builder.setResponsiveContentInsetEnabled(boolean) is set to true or not, this label will be placed as following: - If responsive behaviour is set, label will be above the additional content, on a fixed place to ensure Tiles consistency with other layouts. Additionally, the label will also have an inset to prevent it from going off the screen. - If responsive behaviour is not set or called, label will be above the additional content, centered in the remaining space.

public EdgeContentLayout.Builder setSecondaryLabelTextContent(LayoutElementBuilders.LayoutElement secondaryLabelText)

Sets the content in the secondary label slot which will be below the additional content. It is highly recommended to have primary label set when having secondary label.

Note that when EdgeContentLayout.Builder.setResponsiveContentInsetEnabled(boolean) is set to true, the label will also have an inset to prevent it from going off the screen.

Sets the additional content to this layout, inside of the screen.

public EdgeContentLayout.Builder setContentAndSecondaryLabelSpacing(DimensionBuilders.DpProp height)

Sets the space size between the additional content and secondary label if there is any. If one of those is not present, spacer is not used. If not set, LayoutDefaults.DEFAULT_VERTICAL_SPACER_HEIGHT will be used.

Note that, this method should be used together with EdgeContentLayout.Builder.setResponsiveContentInsetEnabled(boolean), otherwise it will be ignored.

public EdgeContentLayout.Builder setEdgeContentBehindAllOtherContent(boolean isBehind)

Sets whether the edge content passed in with EdgeContentLayout.Builder.setEdgeContent(LayoutElementBuilders.LayoutElement) should be positioned behind all other content in this layout or above it. If not set, defaults to false, meaning that the edge content will be placed above all other content.

Note that, if EdgeContentLayout.Builder.setResponsiveContentInsetEnabled(boolean) is set to true, edge content will always go behind all other content and this method call will throw as those shouldn't be mixed.

public EdgeContentLayout build()

Constructs and returns EdgeContentLayout with the provided content and look.