Skip to content

Releases: zed-alpha/shadow-gadgets

2.4.0

01 Mar 04:45

Choose a tag to compare

Breaking changes:

  • compose, demo: The minSdk for these modules has been bumped to 23, following AndroidX.
  • compose: The ExperimentalColorCompat annotation has been removed.
  • view: ShadowDrawable now has standard bounds behavior, whereas previously they were ignored and placement was handled solely with setPosition() and the translation* properties. Due to this change, ShadowDrawable's setPosition() has been removed from the public API.
  • view: ShadowDrawables created without an owner View now throw IllegalStateExceptions if you attempt to modify their colorCompat properties.
  • view: Logs have been changed to errors instead of warnings, since they're now essentially alternatives to thrown Exceptions.

Known issues:

  • view: There is one particular View setup that is problematic: non-ViewGroup roots, e.g., ImageViews added directly to WindowManager. 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 enum and helper extension have been added to allow for user fallbacks: ShadowMode and View.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 throw Exceptions 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: The View.forceShadowLayer extension and ShadowDrawable's corresponding forceLayer property have been deprecated and will be removed eventually. Their functionality is handled automatically now.
  • view: The ExperimentalShadowGadgets annotation has been added along with a few new helpers. Check the Experimental wiki page for details.
  • view: Non-color compat shadows in the Background plane are no longer clipped to their parents' bounds.
  • view: All ShadowsViewGroups are now open.
  • view: A clipToBounds: Boolean property has been added to ShadowDrawable.
  • core: This module has been removed. Most of it was moved into view after Compose got GraphicsLayers.
  • demo: Added a ComposeRootTopic page in order to demonstrate a couple of ways to set these shadows on roots in that framework.

Bug fixes:

  • view: ViewGroup's clipToPadding is now accounted for correctly.
  • view: Fixed a resizing issue with ShadowDrawable's (internal) color compat layer.
  • view: Addressed the possible log spam in Recycling Adapters that modify shadow properties.
  • view: Recycling ShadowsViewGroups now correctly account for shadow properties set in Adapters.
  • view: ShadowDrawable's translationZ was inadvertently private; it's now public.
  • view: ShadowDrawable restores the correct native shadow colors upon disabling color compat.
  • view: Fixed the logic in MaterialShapeDrawableViewPathProvider's findMaterialShapeDrawable().

2.3.1

09 Jan 12:45

Choose a tag to compare

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 RenderNode tries 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 Background plane when the target is stationary.
  • compose: Fixed a bad draw and potential crash due to a stale cache in the previous Modifier overhaul.

Other changes:

  • view: Deprecated ShadowColorsBlender's onConfigurationChange() function, as I recently realized that it is pointless.
  • view: Deprecated the inflation subpackage, or more precisely, everything within it. It will eventually be removed entirely.

2.3.0

22 Nov 11:01

Choose a tag to compare

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: The colorCompat parameters are no longer nullable. Unspecified is used now instead of null.
  • view: Previously, Views that use color compat without the clip feature would be moved automatically to the required Background plane if not already there. This no longer happens; an explicit error message is logged instead in debug builds.

Changes:

  • compose: The ExperimentalColorCompat annotation has been deprecated and removed from the relevant Modifiers. The internal feature that this was awaiting didn't pan out and has been halted.
  • view: The MaterialComponentsViewPathProvider singleton has been deprecated and replaced with the MaterialShapeDrawableViewPathProvider class, 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 on Views at the root of their respective onscreen hierarchies.
  • view:lint: Corrected false warnings on certain non-View tags.

2.2.1

24 Mar 11:23

Choose a tag to compare

This patch release brings several internal improvements, along with a pretty significant bug fix, and a couple of external upgrades for the ShadowsViewGroups.

  • Previously, View shadows in the Foreground and Background planes ignored the parent ViewGroup's clipToPadding state, which would cause another kind of draw artifact for targets extending beyond the padded bounds of a parent with clipToPadding enabled. 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 ShadowsViewGroup now 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 library Views.

    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

23 Nov 08:56

Choose a tag to compare

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.forceShadowLayer property has been added to handle potential issues with clipped shadows going out of alignment when the parent ViewGroup has 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

13 Sep 21:52

Choose a tag to compare

2.2.0-beta Pre-release
Pre-release

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

26 Jul 01:53

Choose a tag to compare

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

19 Jul 09:54

Choose a tag to compare

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 target View is partially or fully out of bounds, on API levels 28 and below. This was particularly noticeable on the Recycling ClippedShadowsViewGroups, where items would immediately lose their shadows upon their top/start edges scrolling outside the parent's top/start.

2.0.0

12 May 07:32

Choose a tag to compare

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 compose module with new Modifier and extension function, clippedShadow().
  • ViewPathProvider interface and extension property added to handle irregular shapes on R+.
  • MaterialComponentsViewPathProvider implementation included to help with certain library Views.
  • The custom Drawable no longer depends on RenderNode availability, and is usable on any version.

Breaking changes:

  • The minSdk is 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 view subpackage.
  • ShadowDrawable is replaced with ClippedShadowDrawable now in view.
  • ShadowFallbackStrategy and the corresponding property and attributes are removed as obsolete.

Bug fixes:

  • Fixed a minor leak with the Recycling ClippedShadowsViewGroups.