CircularRevealHelper

public class CircularRevealHelper
extends Object

java.lang.Object
   ↳ com.google.android.material.circularreveal.CircularRevealHelper


Helper class to implement circular reveal functionality.

A CircularRevealWidget subclass will call the corresponding method in this helper, which contains the actual implementations for circular reveal. This helper communicates back to the widget via the CircularRevealHelper.Delegate.

Summary

Nested classes

interface CircularRevealHelper.Delegate

Delegate interface to be implemented by the CircularRevealWidget that owns this helper. 

@interface CircularRevealHelper.Strategy

Which strategy this view should use to create the circular reveal effect. 

Constants

int BITMAP_SHADER

Specify that this view should use a BitmapShader to create the circular reveal effect.

int CLIP_PATH

Specify that this view should use Canvas.clipPath(Path) to create the circular reveal effect.

int REVEAL_ANIMATOR

Specify that this view should use ViewAnimationUtils.createCircularReveal(View, int, int, float, float) to create the circular reveal effect.

Fields

public static final int STRATEGY

Public constructors

CircularRevealHelper(CircularRevealHelper.Delegate delegate)

Public methods

void buildCircularRevealCache()
void destroyCircularRevealCache()
void draw(Canvas canvas)
Drawable getCircularRevealOverlayDrawable()
int getCircularRevealScrimColor()
CircularRevealWidget.RevealInfo getRevealInfo()
boolean isOpaque()
void setCircularRevealOverlayDrawable(Drawable drawable)
void setCircularRevealScrimColor(int color)
void setRevealInfo(CircularRevealWidget.RevealInfo revealInfo)

Sets the reveal info, ensuring that a reveal circle with a large enough radius that covers the entire View has its CircularRevealWidget.RevealInfo.radius set to CircularRevealWidget.RevealInfo.INVALID_RADIUS.

Inherited methods

Constants

BITMAP_SHADER

public static final int BITMAP_SHADER

Specify that this view should use a BitmapShader to create the circular reveal effect. BitmapShader is supported in all APIs, but has the downside that it can only animate a static Bitmap.

Constant Value: 0 (0x00000000)

CLIP_PATH

public static final int CLIP_PATH

Specify that this view should use Canvas.clipPath(Path) to create the circular reveal effect. clipPath() is only hardware accelerated on Build.VERSION_CODES.JELLY_BEAN_MR2 and above.

Constant Value: 1 (0x00000001)

REVEAL_ANIMATOR

public static final int REVEAL_ANIMATOR

Specify that this view should use ViewAnimationUtils.createCircularReveal(View, int, int, float, float) to create the circular reveal effect. This is only supported on Build.VERSION_CODES.LOLLIPOP and above.

Constant Value: 2 (0x00000002)

Fields

STRATEGY

public static final int STRATEGY

Public constructors

CircularRevealHelper

public CircularRevealHelper (CircularRevealHelper.Delegate delegate)

Parameters
delegate CircularRevealHelper.Delegate

Public methods

buildCircularRevealCache

public void buildCircularRevealCache ()

destroyCircularRevealCache

public void destroyCircularRevealCache ()

draw

public void draw (Canvas canvas)

Parameters
canvas Canvas

getCircularRevealOverlayDrawable

public Drawable getCircularRevealOverlayDrawable ()

Returns
Drawable

getCircularRevealScrimColor

public int getCircularRevealScrimColor ()

Returns
int

getRevealInfo

public CircularRevealWidget.RevealInfo getRevealInfo ()

Returns
CircularRevealWidget.RevealInfo

isOpaque

public boolean isOpaque ()

Returns
boolean

setCircularRevealOverlayDrawable

public void setCircularRevealOverlayDrawable (Drawable drawable)

Parameters
drawable Drawable

setCircularRevealScrimColor

public void setCircularRevealScrimColor (int color)

Parameters
color int

setRevealInfo

public void setRevealInfo (CircularRevealWidget.RevealInfo revealInfo)

Sets the reveal info, ensuring that a reveal circle with a large enough radius that covers the entire View has its CircularRevealWidget.RevealInfo.radius set to CircularRevealWidget.RevealInfo.INVALID_RADIUS.

Parameters
revealInfo CircularRevealWidget.RevealInfo