-
Notifications
You must be signed in to change notification settings - Fork 5
ShadowException
Package: com.zedalpha.shadowgadgets.view
(docs)
public class ShadowException(message: String) : RuntimeException(message)A general Exception class for known error states.
Each is headed by its message.
The first two apply to shadows on targets that are children of ViewGroups.
-
Color compat shadows without the clip feature enabled must use the Background planeIf you're using color compat by itself in order to avoid the clip overhead, then you have to use the
Backgroundplane, since the original defect will still be present. -
Inline shadows cannot have [target.clipToOutline=true] [or] [parent.clipChildren=true]Inlineshadows are actually drawn in the target's routine rather than in the parent's, so they're subject to any clips that affect the target's draw. Both the target'sclipToOutlineand its parent'sclipChildrenmust befalse.If you have a setup in which those settings cannot be accommodated, the
ShadowsViewGroups all have a special functionality available:takeOverDrawForInlineChildShadows, an explanation for which can be found on theShadowPlanepage.
The last four are applicable only to root Views, e.g., those you add directly
to WindowManager yourself.
-
Shadows on root Views must use the Inline planeThe
ForegroundandBackgroundplanes live in a target's parentViewGroup, which doesn't exist when the target is at the top of the hierarchy. -
Color compat shadows on root Views require that the clip feature be enabled tooSince we can't use the
Backgroundplane here, we're forced to use the clip too. -
Shadows on root Views cannot have target.clipToOutline=trueSame restrictions as for the child
Inlineshadows, but without the parent. -
Library shadows are not available on non-ViewGroup roots [on API levels 21, 22, and 28] | [with the fallback draw method currently in use]The
|here means one or the other, corresponding to whichever check hits first.This is the only error state that cannot be avoided with design-time alterations; i.e., you can't know if it'll happen until it happens. This is also the main reason for the ShadowMode enum and its helper extension, View.doOnShadowModeChange, which is basically an error callback.