Android 12 Developer Preview is here! Try it out, and give us your feedback!

IndicationInstance

interface IndicationInstance
androidx.compose.foundation.IndicationInstance

IndicationInstance is a specific instance of an Indication that draws visual effects on certain interactions, such as press or focus.

IndicationInstances can be stateful or stateless, and are created by Indication.rememberUpdatedInstance - they should be used in-place and not re-used between different indication modifiers.

Summary

Public methods
abstract Unit

Draws visual effects for the current interactions present on this component.

Public methods

drawIndication

abstract fun ContentDrawScope.drawIndication(): Unit

Draws visual effects for the current interactions present on this component.

Typically this function will read state within this instance that is mutated by Indication.rememberUpdatedInstance. This allows IndicationInstance to just read state and draw visual effects, and not actually change any state itself.

This method MUST call ContentDrawScope.drawContent at some point in order to draw the component itself underneath any indication. Typically this is called at the beginning, so that indication can be drawn as an overlay on top.