RippleDrawableCompat

public class RippleDrawableCompat implements Shapeable


A compat Drawable that is used to provide an overlay for pressed, focused, and hovered states (only when in enabled). This is intended to be used pre-Lollipop.

This Drawable is a MaterialShapeDrawable so that it can be shaped to match a MaterialShapeDrawable background.

Unlike the framework android.graphics.drawable.RippleDrawable, this will not apply different alphas for pressed, focused, and hovered states and it does not provide a ripple animation for the pressed state.

Summary

Public constructors

Creates a RippleDrawableCompat with the given shape that will only draw when enabled and at least one of: pressed, focused, or hovered.

Public methods

void
draw(Canvas canvas)
ConstantState
SpringForce
int
ShapeAppearanceModel

Get the ShapeAppearanceModel containing the path that will be rendered in this drawable.

StateListShapeAppearanceModel
boolean
RippleDrawableCompat
void
setAlpha(int alpha)
void
setColorFilter(ColorFilter colorFilter)
void
setCornerSpringForce(SpringForce springForce)
void

Sets the ShapeAppearanceModel that defines the shape.

void
setStateListShapeAppearanceModel(
    StateListShapeAppearanceModel stateListShapeAppearanceModel
)
void
setTint(int tintColor)
void
setTintList(ColorStateList tintList)
void
setTintMode(Mode tintMode)

Protected methods

void
onBoundsChange(Rect bounds)
boolean
onStateChange(int[] stateSet)

Public constructors

RippleDrawableCompat

public RippleDrawableCompat(ShapeAppearanceModel shapeAppearanceModel)

Creates a RippleDrawableCompat with the given shape that will only draw when enabled and at least one of: pressed, focused, or hovered.

Parameters
ShapeAppearanceModel shapeAppearanceModel

The shape for the ripple.

Public methods

draw

public void draw(Canvas canvas)

getConstantState

public ConstantState getConstantState()

getCornerSpringForce

public SpringForce getCornerSpringForce()

getOpacity

public int getOpacity()

getShapeAppearanceModel

public ShapeAppearanceModel getShapeAppearanceModel()

Get the ShapeAppearanceModel containing the path that will be rendered in this drawable.

Returns
ShapeAppearanceModel

the current model.

getStateListShapeAppearanceModel

public StateListShapeAppearanceModel getStateListShapeAppearanceModel()

isStateful

public boolean isStateful()

mutate

public RippleDrawableCompat mutate()

setAlpha

public void setAlpha(int alpha)

setColorFilter

public void setColorFilter(ColorFilter colorFilter)

setCornerSpringForce

public void setCornerSpringForce(SpringForce springForce)

setShapeAppearanceModel

public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel)

Sets the ShapeAppearanceModel that defines the shape.

setStateListShapeAppearanceModel

public void setStateListShapeAppearanceModel(
    StateListShapeAppearanceModel stateListShapeAppearanceModel
)

setTint

public void setTint(int tintColor)

setTintList

public void setTintList(ColorStateList tintList)

setTintMode

public void setTintMode(Mode tintMode)

Protected methods

onBoundsChange

protected void onBoundsChange(Rect bounds)

onStateChange

protected boolean onStateChange(int[] stateSet)