CircularRevealWidget

public interface CircularRevealWidget
implements CircularRevealHelper.Delegate

com.google.android.material.circularreveal.CircularRevealWidget


Interface which denotes that a View supports a circular clip and scrim color, even for pre-L APIs.

Usage

You should not have to interact with instances of this interface directly. To modify the circular clip, use CircularRevealCompat. To modify the scrim color, use CircularRevealWidget.CircularRevealScrimColorProperty.

Implementation

To support circular reveal for an arbitrary view, create a subclass of that view that implements the CircularRevealWidget interface. The subclass should instantiate a CircularRevealHelper and pass itself into the helper's constructor.

All unimplemented methods should be implemented as directed in the javadoc.

Only Views should implement this interface. Callers may expect an instance of this interface to be a View.

Summary

Nested classes

class CircularRevealWidget.CircularRevealEvaluator

A TypeEvaluator that performs type interpolation between two CircularRevealWidget.RevealInfos. 

class CircularRevealWidget.CircularRevealProperty

A Property wrapper around the compound circularReveal functionality on a CircularRevealWidget

class CircularRevealWidget.CircularRevealScrimColorProperty

A Property wrapper around the circularRevealScrimColor functionality on a CircularRevealWidget

class CircularRevealWidget.RevealInfo

RevealInfo holds three values for a circular reveal. 

Public methods

abstract void buildCircularRevealCache()

Prepares the reveal info property to be modified.

abstract void destroyCircularRevealCache()

Cleans up after the reveal info property is reset.

abstract void draw(Canvas canvas)

Implementations should call the corresponding method in CircularRevealHelper.

abstract Drawable getCircularRevealOverlayDrawable()

Returns the circular reveal overlay drawable if one exists, or null.

abstract int getCircularRevealScrimColor()

Implementations should call the corresponding method in CircularRevealHelper.

abstract CircularRevealWidget.RevealInfo getRevealInfo()

Returns the current reveal info if one exists, or null.

abstract boolean isOpaque()

Implementations should call the corresponding method in CircularRevealHelper.

abstract void setCircularRevealOverlayDrawable(Drawable drawable)

Sets the circular reveal overlay drawable, which is an icon that's drawn above everything else, including the circular reveal scrim color.

abstract void setCircularRevealScrimColor(int color)

Sets the circular reveal scrim color, which is a color that's drawn above this widget's contents.

abstract void setRevealInfo(CircularRevealWidget.RevealInfo revealInfo)

Sets the current reveal info.

Inherited methods

Public methods

buildCircularRevealCache

public abstract void buildCircularRevealCache ()

Prepares the reveal info property to be modified. See the interface javadoc for usage details.

Implementations should call the corresponding method in CircularRevealHelper.

destroyCircularRevealCache

public abstract void destroyCircularRevealCache ()

Cleans up after the reveal info property is reset. See the interface javadoc for usage details.

Implementations should call the corresponding method in CircularRevealHelper.

draw

public abstract void draw (Canvas canvas)

Implementations should call the corresponding method in CircularRevealHelper.

Parameters
canvas Canvas

getCircularRevealOverlayDrawable

public abstract Drawable getCircularRevealOverlayDrawable ()

Returns the circular reveal overlay drawable if one exists, or null.

Implementations should call the corresponding method in CircularRevealHelper.

Returns
Drawable

getCircularRevealScrimColor

public abstract int getCircularRevealScrimColor ()

Implementations should call the corresponding method in CircularRevealHelper.

Returns
int

getRevealInfo

public abstract CircularRevealWidget.RevealInfo getRevealInfo ()

Returns the current reveal info if one exists, or null. The radius of the reveal info will never be greater than the distance to the furthest corner.

Implementations should call the corresponding method in CircularRevealHelper.

Returns
CircularRevealWidget.RevealInfo

isOpaque

public abstract boolean isOpaque ()

Implementations should call the corresponding method in CircularRevealHelper.

Returns
boolean

setCircularRevealOverlayDrawable

public abstract void setCircularRevealOverlayDrawable (Drawable drawable)

Sets the circular reveal overlay drawable, which is an icon that's drawn above everything else, including the circular reveal scrim color.

Implementations should call the corresponding method in CircularRevealHelper.

Parameters
drawable Drawable

setCircularRevealScrimColor

public abstract void setCircularRevealScrimColor (int color)

Sets the circular reveal scrim color, which is a color that's drawn above this widget's contents.

Because the scrim makes no assumptions about the shape of the view's background and content, callers should ensure that the scrim is only visible when the circular reveal does not yet extend to the edges of the view.

Implementations should call the corresponding method in CircularRevealHelper.

Parameters
color int

setRevealInfo

public abstract void setRevealInfo (CircularRevealWidget.RevealInfo revealInfo)

Sets the current reveal info. Care should be taken to call buildCircularRevealCache() and destroyCircularRevealCache() appropriately. See the interface javadoc for usage details.

Note that on L+, calling this method doesn't result in any visual changes. You must use this with ViewAnimationUtils.

Implementations should call the corresponding method in CircularRevealHelper.

Parameters
revealInfo CircularRevealWidget.RevealInfo