pekingme 86e8b00ecd [CollapsingToolbarLayout] Fixed shadow issues when transition between expanded and collapsed states.
Includes two main fixes:
1. Applied a workaround for alpha issue of shadow layer in Paint for API 31(+).
- Issue: For API 31 and plus, Paint doesn't apply the correct alpha value to the shadow layer. When the shadow color is opaque (alpha=255), the alpha of shadow should use the alpha of the Paint. But it seems the inverse alpha (255-alpha) is applied to the shadow layer.
- Solution: Added a workaround to set shadow color with a real-time alpha value, Paint still respects to the shadow color's alpha when it's not opaque.

2. Fixed rounding issue when blending shadow color for API 30(-).
- Issue: The rounding of alpha value in removed blendColors() function is casting (round down). This causes the shadow color occasionally becomes non-opaque. Then Paint stops to apply the alpha value to it.
- Solution: When blending colors, round values with Math.round() (round to nearest).

Note: Fix (1) covers fix (2). But fix (2) is still worth to keep, if issue (1) is fixed in the framework in future and workaround is removed.

Resolves: https://github.com/material-components/material-components-android/issues/2545
PiperOrigin-RevId: 427812326
2022-02-11 15:45:15 +00:00
..