From d53a57087df32375868213602118703e05547360 Mon Sep 17 00:00:00 2001 From: pubiqq Date: Thu, 12 Mar 2026 19:51:49 +0300 Subject: [PATCH] [Internal][CollapsingTextHelper] Fix letter spacing not updating correctly --- .../material/internal/CollapsingTextHelper.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/lib/java/com/google/android/material/internal/CollapsingTextHelper.java b/lib/java/com/google/android/material/internal/CollapsingTextHelper.java index 2e47766b014..6860c8b316f 100644 --- a/lib/java/com/google/android/material/internal/CollapsingTextHelper.java +++ b/lib/java/com/google/android/material/internal/CollapsingTextHelper.java @@ -696,17 +696,6 @@ private void calculateOffsets(final float fraction) { currentDrawY = lerp(expandedDrawY, collapsedDrawY, fraction, positionInterpolator); setInterpolatedTextSize(fraction); - - if (collapsedLetterSpacing != expandedLetterSpacing) { - textPaint.setLetterSpacing( - lerp( - expandedLetterSpacing, - collapsedLetterSpacing, - fraction, - AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR)); - } else { - textPaint.setLetterSpacing(collapsedLetterSpacing); - } } setCollapsedTextBlend( @@ -1099,7 +1088,11 @@ private void calculateUsingTextSize(final float fraction, boolean forceRecalcula newTypeface = collapsedTypeface; } else { newTextSize = expandedTextSize; - newLetterSpacing = expandedLetterSpacing; + newLetterSpacing = lerp( + expandedLetterSpacing, + collapsedLetterSpacing, + fraction, + AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR); newTypeface = expandedTypeface; if (isClose(fraction, /* targetValue= */ 0)) { // If we're close to the expanded text size, snap to it and use a scale of 1