The Android Developer Challenge is back! Submit your idea before December 2.

CornerTreatment

public class CornerTreatment
extends Object

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


A basic corner treatment (a single point which does not affect the shape).

Note: For corner treatments which result in a concave shape, the parent view must disable clipping of children by calling setClipChildren(boolean), or by setting `android:clipChildren="false"` in xml. `clipToPadding` may also need to be false if there is any padding on the parent that could intersect the shadow.

Summary

Public constructors

CornerTreatment()

Public methods

void getCornerPath(ShapePath shapePath, float angle, float interpolation, float radius)

Generates a ShapePath for this corner treatment.

void getCornerPath(float angle, float interpolation, ShapePath shapePath)

This method is deprecated. implement ERROR(/#getCornerPath(float, float, float, ShapePath)) or ERROR(/#getCornerPath(float, float, CornerSize, Rect, ShapePath)) instead.

void getCornerPath(ShapePath shapePath, float angle, float interpolation, RectF bounds, CornerSize size)

Generates a ShapePath for this corner treatment.

Inherited methods

From class java.lang.Object

Public constructors

CornerTreatment

CornerTreatment ()

Public methods

getCornerPath

void getCornerPath (ShapePath shapePath, 
                float angle, 
                float interpolation, 
                float radius)

Generates a ShapePath for this corner treatment.

CornerTreatments are assumed to have an origin of (0, 0) (i.e. they represent the top-left corner), and are automatically rotated and scaled as necessary when applied to other corners.

Parameters
shapePath ShapePath: the ShapePath that this treatment should write to.

angle float: the angle of the corner, typically 90 degrees.

interpolation float: the interpolation of the corner treatment. Ranges between 0 (none) and 1 (fully) interpolated. Custom corner treatments can implement interpolation to support shape transition between two arbitrary states. Typically, a value of 0 indicates that the custom corner treatment is not rendered (i.e. that it is a 90 degree angle), and a value of 1 indicates that the treatment is fully rendered. Animation between these two values can "heal" or "reveal" a corner treatment.

radius float: the radius or size of this corner.

getCornerPath

void getCornerPath (float angle, 
                float interpolation, 
                ShapePath shapePath)

This method is deprecated.
implement ERROR(/#getCornerPath(float, float, float, ShapePath)) or ERROR(/#getCornerPath(float, float, CornerSize, Rect, ShapePath)) instead.

Generates a ShapePath for this corner treatment.

CornerTreatments are assumed to have an origin of (0, 0) (i.e. they represent the top-left corner), and are automatically rotated and scaled as necessary when applied to other corners.

Parameters
angle float: the angle of the corner, typically 90 degrees.

interpolation float: the interpolation of the corner treatment. Ranges between 0 (none) and 1 (fully) interpolated. Custom corner treatments can implement interpolation to support shape transition between two arbitrary states. Typically, a value of 0 indicates that the custom corner treatment is not rendered (i.e. that it is a 90 degree angle), and a value of 1 indicates that the treatment is fully rendered. Animation between these two values can "heal" or "reveal" a corner treatment.

shapePath ShapePath: the ShapePath that this treatment should write to.

getCornerPath

void getCornerPath (ShapePath shapePath, 
                float angle, 
                float interpolation, 
                RectF bounds, 
                CornerSize size)

Generates a ShapePath for this corner treatment.

CornerTreatments are assumed to have an origin of (0, 0) (i.e. they represent the top-left corner), and are automatically rotated and scaled as necessary when applied to other corners.

Parameters
shapePath ShapePath: the ShapePath that this treatment should write to.

angle float: the angle of the corner, typically 90 degrees.

interpolation float: the interpolation of the corner treatment. Ranges between 0 (none) and 1 (fully) interpolated. Custom corner treatments can implement interpolation to support shape transition between two arbitrary states. Typically, a value of 0 indicates that the custom corner treatment is not rendered (i.e. that it is a 90 degree angle), and a value of 1 indicates that the treatment is fully rendered. Animation between these two values can "heal" or "reveal" a corner treatment.

bounds RectF: the bounds of the full shape that will be drawn. This could be used change the behavior of the CornerTreatment depending on how much space is available for the full shape.

size CornerSize: the CornerSize used for this corner