ShapeAppearanceModel

public class ShapeAppearanceModel

Known direct subclasses
ShapePathModel

This class is deprecated.

Use ShapeAppearanceModel instead.


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

Summary

Nested types

public final class ShapeAppearanceModel.Builder

Builder to create instances of ShapeAppearanceModels.

Constants

static final int
static final CornerSize

Public constructors

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

Public methods

static ShapeAppearanceModel.Builder
static ShapeAppearanceModel.Builder
builder(
    Context context,
    int shapeAppearanceResId,
    int shapeAppearanceOverlayResId
)
static ShapeAppearanceModel.Builder
builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
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
)
EdgeTreatment

Gets the edge treatment for the bottom edge.

CornerTreatment

Gets the corner treatment for the bottom left corner.

CornerSize

Gets the corner size for the bottom left corner.

CornerTreatment

Gets the corner treatment for the bottom right corner.

CornerSize

Gets the corner size for the bottom right corner.

static CornerSize
getCornerSize(TypedArray a, int index, CornerSize defaultValue)
EdgeTreatment

Gets the edge treatment for the left edge.

EdgeTreatment

Gets the edge treatment for the right edge.

EdgeTreatment

Gets the edge treatment for the top edge.

CornerTreatment

Gets the corner treatment for the top left corner.

CornerSize

Gets the corner size for the top left corner.

CornerTreatment

Gets the corner treatment for the top right corner.

CornerSize

Gets the corner size for the top right corner.

ShapeAppearanceModel.Builder

Returns a builder with the edges and corners from this ShapeAppearanceModel

String
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.

Constants

NUM_CORNERS

public static final int NUM_CORNERS = 4

PILL

public static final CornerSize PILL

Public fields

bottomEdge

public EdgeTreatment bottomEdge

bottomLeftCorner

public CornerTreatment bottomLeftCorner

bottomLeftCornerSize

public CornerSize bottomLeftCornerSize

bottomRightCorner

public CornerTreatment bottomRightCorner

bottomRightCornerSize

public CornerSize bottomRightCornerSize

leftEdge

public EdgeTreatment leftEdge

rightEdge

public EdgeTreatment rightEdge

topEdge

public EdgeTreatment topEdge

topLeftCorner

public CornerTreatment topLeftCorner

topLeftCornerSize

public CornerSize topLeftCornerSize

topRightCorner

public CornerTreatment topRightCorner

topRightCornerSize

public CornerSize topRightCornerSize

Public constructors

ShapeAppearanceModel

public ShapeAppearanceModel()

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

Public methods

builder

public static ShapeAppearanceModel.Builder builder()

builder

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

builder

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

builder

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

builder

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

getBottomEdge

public EdgeTreatment getBottomEdge()

Gets the edge treatment for the bottom edge.

Returns
EdgeTreatment

the edge treatment for the bottom edge.

getBottomLeftCorner

public CornerTreatment getBottomLeftCorner()

Gets the corner treatment for the bottom left corner.

Returns
CornerTreatment

the corner treatment for the bottom left corner.

getBottomLeftCornerSize

public CornerSize getBottomLeftCornerSize()

Gets the corner size for the bottom left corner.

Returns
CornerSize

the corner size for the bottom left corner.

getBottomRightCorner

public CornerTreatment getBottomRightCorner()

Gets the corner treatment for the bottom right corner.

Returns
CornerTreatment

the corner treatment for the bottom right corner.

getBottomRightCornerSize

public CornerSize getBottomRightCornerSize()

Gets the corner size for the bottom right corner.

Returns
CornerSize

the corner size for the bottom right corner.

getCornerSize

public static CornerSize getCornerSize(TypedArray a, int index, CornerSize defaultValue)

getLeftEdge

public EdgeTreatment getLeftEdge()

Gets the edge treatment for the left edge.

Returns
EdgeTreatment

the edge treatment for the left edge.

getRightEdge

public EdgeTreatment getRightEdge()

Gets the edge treatment for the right edge.

Returns
EdgeTreatment

the edge treatment for the right edge.

getTopEdge

public EdgeTreatment getTopEdge()

Gets the edge treatment for the top edge.

Returns
EdgeTreatment

the edge treatment for the top edge.

getTopLeftCorner

public CornerTreatment getTopLeftCorner()

Gets the corner treatment for the top left corner.

Returns
CornerTreatment

the corner treatment for the top left corner.

getTopLeftCornerSize

public CornerSize getTopLeftCornerSize()

Gets the corner size for the top left corner.

Returns
CornerSize

the corner size for the top left corner.

getTopRightCorner

public CornerTreatment getTopRightCorner()

Gets the corner treatment for the top right corner.

Returns
CornerTreatment

the corner treatment for the top right corner.

getTopRightCornerSize

public CornerSize getTopRightCornerSize()

Gets the corner size for the top right corner.

Returns
CornerSize

the corner size for the top right corner.

toBuilder

public ShapeAppearanceModel.Builder toBuilder()

Returns a builder with the edges and corners from this ShapeAppearanceModel

toString

public String toString()

withCornerSize

public ShapeAppearanceModel withCornerSize(CornerSize cornerSize)

withCornerSize

public 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.