Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -696,17 +696,6 @@ private void calculateOffsets(final float fraction) {
currentDrawY = lerp(expandedDrawY, collapsedDrawY, fraction, positionInterpolator);

setInterpolatedTextSize(fraction);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to keep this so the offset will be calculated correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to keep this so the offset will be calculated correctly?

I'm not sure which offset you're referring to. The code block you highlighted is no longer needed because the updated calculateUsingTextSize() method already sets the correct letter spacing.

if (collapsedLetterSpacing != expandedLetterSpacing) {
textPaint.setLetterSpacing(
lerp(
expandedLetterSpacing,
collapsedLetterSpacing,
fraction,
AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR));
} else {
textPaint.setLetterSpacing(collapsedLetterSpacing);
}
}

setCollapsedTextBlend(
Expand Down Expand Up @@ -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
Expand Down