Skip to content

Commit

Permalink
[CollapsingToolbarLayout] Fix text shadow fading when transitioning b…
Browse files Browse the repository at this point in the history
…etween expanded and collapsed states

Resolves #3641

GIT_ORIGIN_REV_ID=7243f7a2f09b04caceec488443b1652a8ffef961
PiperOrigin-RevId: 578838845
  • Loading branch information
pubiqq authored and paulfthomas committed Nov 6, 2023
1 parent 1756f23 commit 7674e12
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -672,6 +672,14 @@ private void calculateOffsets(final float fraction) {
int textAlpha = (int) (calculateFadeModeTextAlpha(fraction) * originalAlpha);

textPaint.setAlpha(textAlpha);
// Workaround for API 31(+). Applying the shadow color for the painted text.
if (VERSION.SDK_INT >= VERSION_CODES.S) {
textPaint.setShadowLayer(
currentShadowRadius,
currentShadowDx,
currentShadowDy,
MaterialColors.compositeARGBWithAlpha(currentShadowColor, textPaint.getAlpha()));
}
}

ViewCompat.postInvalidateOnAnimation(view);
Expand Down

0 comments on commit 7674e12

Please sign in to comment.