Releases: zed-alpha/shadow-gadgets
2.4.0
Breaking changes:
compose,demo: TheminSdkfor these modules has been bumped to 23, following AndroidX.compose: TheExperimentalColorCompatannotation has been removed.view:ShadowDrawablenow has standard bounds behavior, whereas previously they were ignored and placement was handled solely withsetPosition()and thetranslation*properties. Due to this change,ShadowDrawable'ssetPosition()has been removed from the public API.view:ShadowDrawables created without an ownerViewnow throwIllegalStateExceptions if you attempt to modify theircolorCompatproperties.view: Logs have been changed to errors instead of warnings, since they're now essentially alternatives to thrownExceptions.
Known issues:
-
view: There is one particularViewsetup that is problematic: non-ViewGrouproots, e.g.,ImageViews added directly toWindowManager. On API levels 23..27, library shadows are not possible here if the fallback draw method is in use (internal detail), and on API levels 21, 22, and 28 they don't work there at all (platform issues).A new state
enumand helper extension have been added to allow for user fallbacks:ShadowModeandView.doOnShadowModeChange. Details can be found on the Experimental wiki page.This has always been an issue with the library's technique, but it's been overlooked until now.
NB: Currently the library fails to recognize and notify this issue on 21 and 22. This will be corrected in the upcoming patch release.
Changes:
view: Invalid shadow states now throwExceptions in edit mode; i.e., in your IDE's layout editor. I'd never thought about how confusing/frustrating it must be when shadows just disappear there due to an invalid state that might not be obvious because of the library's complicated and various configuration requirements. Sorry 'bout that.view: TheView.forceShadowLayerextension andShadowDrawable's correspondingforceLayerproperty have been deprecated and will be removed eventually. Their functionality is handled automatically now.view: TheExperimentalShadowGadgetsannotation has been added along with a few new helpers. Check the Experimental wiki page for details.view: Non-color compat shadows in theBackgroundplane are no longer clipped to their parents' bounds.view: AllShadowsViewGroups are nowopen.view: AclipToBounds: Booleanproperty has been added toShadowDrawable.core: This module has been removed. Most of it was moved intoviewafter Compose gotGraphicsLayers.demo: Added aComposeRootTopicpage in order to demonstrate a couple of ways to set these shadows on roots in that framework.
Bug fixes:
view:ViewGroup'sclipToPaddingis now accounted for correctly.view: Fixed a resizing issue withShadowDrawable's (internal) color compat layer.view: Addressed the possible log spam in Recycling Adapters that modify shadow properties.view: RecyclingShadowsViewGroups now correctly account for shadow properties set in Adapters.view:ShadowDrawable'stranslationZwas inadvertentlyprivate; it's nowpublic.view:ShadowDrawablerestores the correct native shadow colors upon disabling color compat.view: Fixed the logic inMaterialShapeDrawableViewPathProvider'sfindMaterialShapeDrawable().
2.3.1
This release brings major improvements to the Compose implementations, made possible by the new GraphicsLayer API. In fact, the new API replaces so much of the :core module that, if you need only the clip fix in that one framework, you may not have to bother with this library at all anymore.
Bug fixes:
- core: Fixed a crash on Lollipop 21 when
RenderNodetries to record too early. - view: Fixed skipped invalidation when switching a core feature on/off on Lollipop 21.
- view: Fixed a bug with a stale draw in the
Backgroundplane when the target is stationary. - compose: Fixed a bad draw and potential crash due to a stale cache in the previous
Modifieroverhaul.
Other changes:
- view: Deprecated
ShadowColorsBlender'sonConfigurationChange()function, as I recently realized that it is pointless. - view: Deprecated the
inflationsubpackage, or more precisely, everything within it. It will eventually be removed entirely.
2.3.0
The main purpose of this release is to finally remove all of the deprecated ClippedShadow* elements, but there are several internal improvements too, as usual, and a handful of public API changes.
Breaking changes:
compose: ThecolorCompatparameters are no longer nullable.Unspecifiedis used now instead of null.view: Previously,Views that use color compat without the clip feature would be moved automatically to the requiredBackgroundplane if not already there. This no longer happens; an explicit error message is logged instead in debug builds.
Changes:
compose: TheExperimentalColorCompatannotation has been deprecated and removed from the relevantModifiers. The internal feature that this was awaiting didn't pan out and has been halted.view: TheMaterialComponentsViewPathProvidersingleton has been deprecated and replaced with theMaterialShapeDrawableViewPathProviderclass, which adds caching and a couple of companion utility members.
Bug fixes:
compose: Fixed an edge case bug with color compat where changing from black to color or back would fail.view: The library's features now work correctly onViews at the root of their respective onscreen hierarchies.view:lint: Corrected false warnings on certain non-Viewtags.
2.2.1
This patch release brings several internal improvements, along with a pretty significant bug fix, and a couple of external upgrades for the ShadowsViewGroups.
-
Previously,
Viewshadows in theForegroundandBackgroundplanes ignored the parentViewGroup'sclipToPaddingstate, which would cause another kind of draw artifact for targets extending beyond the padded bounds of a parent withclipToPaddingenabled. This behavior has been corrected with the current release. -
Most of the built-in lint checks for the base
ViewGroups have been wrapped and augmented to work with the library classes, along with a custom check for some of the library's layout attributes. Details can be found on the ViewGroups wiki page. -
Each
ShadowsViewGroupnow registers its group attributes with the debug tooling, so they should show up in the layout inspector, per the documentation, though I've never seen any custom attributes there, even from Jetpack libraryViews.The individual attributes on the arbitrary child
<View>s are not handled as such, currently. I'm not sure that it's even possible to do this there without some severe hackery.
2.2.0
The new color compat feature is now available in both frameworks to tint shadows on API levels 27 and below. Though the Compose version is currently marked @OptIn, this is really only due to the excess overhead its particular implementation presently entails. The API is frozen, however, and its mechanism is evidently as solid and robust as the main clip functionality.
All of the auxiliary View properties and classes that specify the clip feature in their names – e.g., View.clippedShadowPlane, ClippedShadowDrawable, etc. – have been deprecated and replaced with generalized versions that also work with color compat: View.shadowPlane, ShadowDrawable, etc.
Other new stuff:
-
Styleables have been added for the library's
ViewGroups, so their custom attributes should now resolve when editing layout XML. These should've been there from the start, but I used to think that this wouldn't work, for some reason. -
A
View.forceShadowLayerproperty has been added to handle potential issues with clipped shadows going out of alignment when the parentViewGrouphas a non-identity matrix applied on API levels 24..28. Refer to this wiki page for details. -
The code docs have finally been updated and re-added everywhere. They've also been dokka'd and published separately through github.io.
NB: The consumer ProGuard rules for the layout inflation helpers have been removed, since the feature is currently in limbo. If you happen to be using any, you might need to add a rule manually. Refer to this wiki page for details.
2.2.0-beta
A new color compat functionality to tint shadows on API levels <28 has been added project-wide. Both frameworks offer this as a standalone option as well; i.e., it works without the shadow clipping.
The view implementation is solid, so the only real considerations for the user there should be suitability and overhead.
The compose version is still considered experimental and requires @OptIn. It still needs some improvements and fine-tuning.
This will hopefully be a short beta, because it includes several updates and minor fixes for the core functionality that weren't realized until it was too late to apply to the previous version without a massive rework. The primary concern is that the core clip feature not be affected negatively.
2.1.0
This release adds the Inline plane to the view package. This new ClippedShadowPlane allows these shadows to act and appear most similarly to the regular ones, but it has some external requirements and caveats that make it unsuitable to be the main or singular solution.
2.0.1
This patch release contains several internal improvements to performance and overhead, but the main issues of note are the following bug fixes:
- Added ProGuard rules to suppress "Missing class" warnings for platform stubs during release builds. This should've been there from the very start. My bad.
- In
view, fixed potential lag in animated and user-driven Background-plane shadows on API levels 28 and below. The chances were pretty slim that the laggy fallback ever had to be used anyway, but it's not an issue at all anymore. - Also in
view, fixed potentially skipped draws when the targetViewis partially or fully out of bounds, on API levels 28 and below. This was particularly noticeable on the RecyclingClippedShadowsViewGroups, where items would immediately lose their shadows upon their top/start edges scrolling outside the parent's top/start.
2.0.0
New stuff:
- The fallback drawing method now behaves just like the primary one, allowing for new features.
- Core draw routines moved to separate module to facilitate those features.
- Added
composemodule with newModifierand extension function,clippedShadow(). ViewPathProviderinterface and extension property added to handle irregular shapes on R+.MaterialComponentsViewPathProviderimplementation included to help with certain libraryViews.- The custom
Drawableno longer depends onRenderNodeavailability, and is usable on any version.
Breaking changes:
- The
minSdkis 21. These shadows didn't exist until then. You can clone if you really need older. - The library split moved the original features into the
viewsubpackage. ShadowDrawableis replaced withClippedShadowDrawablenow inview.ShadowFallbackStrategyand the corresponding property and attributes are removed as obsolete.
Bug fixes:
- Fixed a minor leak with the Recycling
ClippedShadowsViewGroups.