public class EdgeContentLayout implements LayoutElementBuilders.LayoutElement


ProtoLayout layout that represents the suggested layout style for Material ProtoLayout, which has content around the edge of the screen (e.g. a ProgressIndicator) and the given content inside of it with the recommended margin and padding applied. Optional primary or secondary label can be added above and below the additional content, respectively. Visuals and design samples can be found here.

When accessing the contents of a container for testing, note that this element can't be simply casted back to the original type, i.e.:

EdgeContentLayout ecl = new EdgeContentLayout...
Box box = new Box.Builder().addContent(ecl).build();

EdgeContentLayout myEcl = (EdgeContentLayout) box.getContents().get(0);
will fail.

To be able to get EdgeContentLayout object from any layout element, fromLayoutElement method should be used, i.e.:

EdgeContentLayout myEcl =
  EdgeContentLayout.fromLayoutElement(box.getContents().get(0));

Summary

Nested types

public final class EdgeContentLayout.Builder

Builder class for EdgeContentLayout.

Public methods

static @Nullable EdgeContentLayout

Returns EdgeContentLayout object from the given LayoutElement (e.g. one retrieved from a container's content with container.getContents().get(index)) if that element can be converted to EdgeContentLayout.

@Nullable LayoutElementBuilders.LayoutElement

Returns the inner content from this layout.

@Dimension(unit = Dimension.DP) float

Get the size of spacing between content and secondary from this layout.

@Nullable LayoutElementBuilders.LayoutElement

Returns the edge content from this layout.

float

Returns the total size of the edge content including margins.

@Nullable LayoutElementBuilders.LayoutElement

Get the primary label content from this layout.

@Nullable LayoutElementBuilders.LayoutElement

Get the secondary label content from this layout.

boolean

Returns if the edge content has been placed behind the other contents.

boolean

Returns whether the contents from this layout are using responsive inset.

Public methods

fromLayoutElement

Added in 1.0.0
public static @Nullable EdgeContentLayout fromLayoutElement(@NonNull LayoutElementBuilders.LayoutElement element)

Returns EdgeContentLayout object from the given LayoutElement (e.g. one retrieved from a container's content with container.getContents().get(index)) if that element can be converted to EdgeContentLayout. Otherwise, it will return null.

getContent

Added in 1.0.0
public @Nullable LayoutElementBuilders.LayoutElement getContent()

Returns the inner content from this layout.

getContentAndSecondaryLabelSpacing

Added in 1.2.0
public @Dimension(unit = Dimension.DP) float getContentAndSecondaryLabelSpacing()

Get the size of spacing between content and secondary from this layout.

getEdgeContent

Added in 1.0.0
public @Nullable LayoutElementBuilders.LayoutElement getEdgeContent()

Returns the edge content from this layout.

getEdgeContentThickness

Added in 1.2.0
public float getEdgeContentThickness()

Returns the total size of the edge content including margins.

getPrimaryLabelTextContent

Added in 1.0.0
public @Nullable LayoutElementBuilders.LayoutElement getPrimaryLabelTextContent()

Get the primary label content from this layout.

getSecondaryLabelTextContent

Added in 1.0.0
public @Nullable LayoutElementBuilders.LayoutElement getSecondaryLabelTextContent()

Get the secondary label content from this layout.

isEdgeContentBehindAllOtherContent

Added in 1.1.0
public boolean isEdgeContentBehindAllOtherContent()

Returns if the edge content has been placed behind the other contents.

isResponsiveContentInsetEnabled

Added in 1.2.0
public boolean isResponsiveContentInsetEnabled()

Returns whether the contents from this layout are using responsive inset.