mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
[TopAppBar] Fix title fade mode collapsing title position errors.
Flinging the AppBarLayout can cause a negative number to be passed to CollapsingTextHelper#calculateOffsets, causing the collapsed title in fade mode to be positioned incorrectly. PiperOrigin-RevId: 374704850
This commit is contained in:
parent
6e7be6070c
commit
0ef2e910ce
@ -19,6 +19,7 @@ package com.google.android.material.internal;
|
||||
import static androidx.core.util.Preconditions.checkNotNull;
|
||||
import static android.text.Layout.Alignment.ALIGN_NORMAL;
|
||||
import static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;
|
||||
import static java.lang.Math.max;
|
||||
import static java.lang.Math.min;
|
||||
|
||||
import android.animation.TimeInterpolator;
|
||||
@ -548,7 +549,7 @@ public final class CollapsingTextHelper {
|
||||
} else {
|
||||
textBlendFraction = 1F;
|
||||
currentDrawX = collapsedDrawX;
|
||||
currentDrawY = collapsedDrawY - currentOffsetY;
|
||||
currentDrawY = collapsedDrawY - max(0, currentOffsetY);
|
||||
|
||||
setInterpolatedTextSize(collapsedTextSize);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user