EdgeContentLayout.Builder


public final class EdgeContentLayout.Builder


Builder class for EdgeContentLayout.

Summary

Public constructors

Creates a builder for the EdgeContentLayout.

Public methods

@NonNull EdgeContentLayout

Constructs and returns EdgeContentLayout with the provided content and look.

@NonNull EdgeContentLayout.Builder

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

@NonNull EdgeContentLayout.Builder

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

@NonNull EdgeContentLayout.Builder

Sets the content to be around the edges.

@NonNull EdgeContentLayout.Builder

Sets whether the edge content passed in with setEdgeContent should be positioned behind all other content in this layout or above it.

@NonNull EdgeContentLayout.Builder
setEdgeContentThickness(@Dimension(unit = 0) float thickness)

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

@NonNull EdgeContentLayout.Builder

Sets the content in the primary label slot.

@NonNull EdgeContentLayout.Builder

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

@NonNull EdgeContentLayout.Builder

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

Public constructors

Builder

Added in 1.0.0
public Builder(
    @NonNull DeviceParametersBuilders.DeviceParameters deviceParameters
)

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

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

Public methods

build

Added in 1.0.0
public @NonNull EdgeContentLayout build()

Constructs and returns EdgeContentLayout with the provided content and look.

setContent

Added in 1.0.0
public @NonNull EdgeContentLayout.Builder setContent(@NonNull LayoutElementBuilders.LayoutElement content)

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

setContentAndSecondaryLabelSpacing

Added in 1.2.0
public @NonNull EdgeContentLayout.Builder setContentAndSecondaryLabelSpacing(
    @NonNull 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, DEFAULT_VERTICAL_SPACER_HEIGHT will be used.

Note that, this method should be used together with setResponsiveContentInsetEnabled, otherwise it will be ignored.

setEdgeContent

Added in 1.0.0
public @NonNull EdgeContentLayout.Builder setEdgeContent(@NonNull LayoutElementBuilders.LayoutElement edgeContent)

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 setEdgeContentThickness for best results.

setEdgeContentBehindAllOtherContent

Added in 1.1.0
public @NonNull EdgeContentLayout.Builder setEdgeContentBehindAllOtherContent(boolean isBehind)

Sets whether the edge content passed in with setEdgeContent 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 setResponsiveContentInsetEnabled 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.

setEdgeContentThickness

Added in 1.2.0
public @NonNull EdgeContentLayout.Builder setEdgeContentThickness(@Dimension(unit = 0) 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 elements, this should be equal to their stroke width/thickness.

Note that, calling this method when responsiveness is not set with setResponsiveContentInsetEnabled, will be ignored.

setPrimaryLabelTextContent

Added in 1.0.0
public @NonNull EdgeContentLayout.Builder setPrimaryLabelTextContent(
    @NonNull LayoutElementBuilders.LayoutElement primaryLabelText
)

Sets the content in the primary label slot.

Depending on whether setResponsiveContentInsetEnabled 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.

setResponsiveContentInsetEnabled

Added in 1.2.0
public @NonNull 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.

setSecondaryLabelTextContent

Added in 1.0.0
public @NonNull EdgeContentLayout.Builder setSecondaryLabelTextContent(
    @NonNull 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 setResponsiveContentInsetEnabled is set to true, the label will also have an inset to prevent it from going off the screen.