material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Internal] Add constant state support to ScaledDrawableWrapper

Open pubiqq opened this issue 1 year ago • 1 comments

On API < 23, the DrawableUtils.compositeTwoLayeredDrawable method can return a LayerDrawable with a child ScaledDrawable. Calling mutate() on such a LayerDrawable throws NPE because the ScaledDrawable doesn't support constant state (was fixed only in API 24, commit).

This PR adds constant state support to ScaledDrawableWrapper, thus preventing NPE on older devices.

Fixes https://github.com/material-components/material-components-android/issues/4129.

pubiqq avatar Sep 14 '23 00:09 pubiqq

⚠️ Bump ⚠️

Besides fixing a potential crash, this PR also unlocks the ability to create another PR that fixes the incorrect implementation of the DrawableUtils.compositeTwoLayeredDrawable method.

pubiqq avatar Mar 14 '24 17:03 pubiqq

Thank you for the PR! It's being synced in internally and will be synced out here soon, apologies for the delay

leticiarossi avatar May 07 '24 15:05 leticiarossi