doOnShadowModeChange

Callback for ShadowMode changes. The target View is passed as the receiver for action, allowing for unqualified access to its members.

It is recommended to handle this in the same manner as View updates in recycling Adapters: always account for all possible states, since multi-property updates could potentially involve invalid intermediate states. For example, do not do this:

target.doOnShadowModeChange { mode ->
if (mode == ShadowMode.Disabled) {
foreground = FallbackShadowDrawable()
}
}

Instead, do this:

target.doOnShadowModeChange { mode ->
foreground =
if (mode == ShadowMode.Disabled) {
FallbackShadowDrawable()
} else {
null
}
}

NB: This is a setter. A maximum of one action per View is supported.