ShapeAppearanceModel

public class ShapeAppearanceModel
extends Object

java.lang.Object
   ↳ com.google.android.material.shape.ShapeAppearanceModel
Known Direct Subclasses


This class models the edges and corners of a shape, which are used by MaterialShapeDrawable to generate and render the shape for a view's background.

Summary

Nested classes

class ShapeAppearanceModel.Builder

Builder to create instances of ShapeAppearanceModels. 

Fields

public static final CornerSize PILL

Public constructors

ShapeAppearanceModel()

Constructs a default path generator with default edge and corner treatments.

Public methods

static ShapeAppearanceModel.Builder builder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, CornerSize defaultCornerSize)
static ShapeAppearanceModel.Builder builder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int defaultCornerSize)
static ShapeAppearanceModel.Builder builder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
static ShapeAppearanceModel.Builder builder(Context context, int shapeAppearanceResId, int shapeAppearanceOverlayResId)
static ShapeAppearanceModel.Builder builder()
EdgeTreatment getBottomEdge()

Gets the edge treatment for the bottom edge.

CornerTreatment getBottomLeftCorner()

Gets the corner treatment for the bottom left corner.

CornerSize getBottomLeftCornerSize()

Gets the corner size for the bottom left corner.

CornerTreatment getBottomRightCorner()

Gets the corner treatment for the bottom right corner.

CornerSize getBottomRightCornerSize()

Gets the corner size for the bottom right corner.

EdgeTreatment getLeftEdge()

Gets the edge treatment for the left edge.

EdgeTreatment getRightEdge()

Gets the edge treatment for the right edge.

EdgeTreatment getTopEdge()

Gets the edge treatment for the top edge.

CornerTreatment getTopLeftCorner()

Gets the corner treatment for the top left corner.

CornerSize getTopLeftCornerSize()

Gets the corner size for the top left corner.

CornerTreatment getTopRightCorner()

Gets the corner treatment for the top right corner.

CornerSize getTopRightCornerSize()

Gets the corner size for the top right corner.

ShapeAppearanceModel.Builder toBuilder()

Returns a builder with the edges and corners from this ShapeAppearanceModel

ShapeAppearanceModel withCornerSize(float cornerSize)

Returns a copy of this ShapeAppearanceModel with the same edges and corners, but with the corner size for all corners updated.

ShapeAppearanceModel withCornerSize(CornerSize cornerSize)

Inherited methods

From class java.lang.Object

Fields

PILL

CornerSize PILL

Public constructors

ShapeAppearanceModel

ShapeAppearanceModel ()

Constructs a default path generator with default edge and corner treatments.

Public methods

builder

ShapeAppearanceModel.Builder builder (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes, 
                CornerSize defaultCornerSize)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

defaultCornerSize CornerSize

Returns
ShapeAppearanceModel.Builder

builder

ShapeAppearanceModel.Builder builder (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes, 
                int defaultCornerSize)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

defaultCornerSize int

Returns
ShapeAppearanceModel.Builder

builder

ShapeAppearanceModel.Builder builder (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Returns
ShapeAppearanceModel.Builder

builder

ShapeAppearanceModel.Builder builder (Context context, 
                int shapeAppearanceResId, 
                int shapeAppearanceOverlayResId)

Parameters
context Context

shapeAppearanceResId int

shapeAppearanceOverlayResId int

Returns
ShapeAppearanceModel.Builder

getBottomEdge

EdgeTreatment getBottomEdge ()

Gets the edge treatment for the bottom edge.

Returns
EdgeTreatment the edge treatment for the bottom edge.

getBottomLeftCorner

CornerTreatment getBottomLeftCorner ()

Gets the corner treatment for the bottom left corner.

Returns
CornerTreatment the corner treatment for the bottom left corner.

getBottomLeftCornerSize

CornerSize getBottomLeftCornerSize ()

Gets the corner size for the bottom left corner.

Returns
CornerSize the corner size for the bottom left corner.

getBottomRightCorner

CornerTreatment getBottomRightCorner ()

Gets the corner treatment for the bottom right corner.

Returns
CornerTreatment the corner treatment for the bottom right corner.

getBottomRightCornerSize

CornerSize getBottomRightCornerSize ()

Gets the corner size for the bottom right corner.

Returns
CornerSize the corner size for the bottom right corner.

getLeftEdge

EdgeTreatment getLeftEdge ()

Gets the edge treatment for the left edge.

Returns
EdgeTreatment the edge treatment for the left edge.

getRightEdge

EdgeTreatment getRightEdge ()

Gets the edge treatment for the right edge.

Returns
EdgeTreatment the edge treatment for the right edge.

getTopEdge

EdgeTreatment getTopEdge ()

Gets the edge treatment for the top edge.

Returns
EdgeTreatment the edge treatment for the top edge.

getTopLeftCorner

CornerTreatment getTopLeftCorner ()

Gets the corner treatment for the top left corner.

Returns
CornerTreatment the corner treatment for the top left corner.

getTopLeftCornerSize

CornerSize getTopLeftCornerSize ()

Gets the corner size for the top left corner.

Returns
CornerSize the corner size for the top left corner.

getTopRightCorner

CornerTreatment getTopRightCorner ()

Gets the corner treatment for the top right corner.

Returns
CornerTreatment the corner treatment for the top right corner.

getTopRightCornerSize

CornerSize getTopRightCornerSize ()

Gets the corner size for the top right corner.

Returns
CornerSize the corner size for the top right corner.

toBuilder

ShapeAppearanceModel.Builder toBuilder ()

Returns a builder with the edges and corners from this ShapeAppearanceModel

Returns
ShapeAppearanceModel.Builder

withCornerSize

ShapeAppearanceModel withCornerSize (float cornerSize)

Returns a copy of this ShapeAppearanceModel with the same edges and corners, but with the corner size for all corners updated.

Parameters
cornerSize float

Returns
ShapeAppearanceModel

withCornerSize

ShapeAppearanceModel withCornerSize (CornerSize cornerSize)

Parameters
cornerSize CornerSize

Returns
ShapeAppearanceModel