@@ -528,19 +528,23 @@ private void calculateCurrentOffsets() {
528
528
529
529
private void calculateOffsets (final float fraction ) {
530
530
interpolateBounds (fraction );
531
+ float textBlendFraction ;
531
532
if (fadeModeEnabled ) {
532
533
if (fraction < fadeModeThresholdFraction ) {
534
+ textBlendFraction = 0F ;
533
535
currentDrawX = expandedDrawX ;
534
- currentDrawY = lerp ( expandedDrawY , collapsedDrawY , fraction , positionInterpolator ) ;
536
+ currentDrawY = expandedDrawY ;
535
537
536
538
setInterpolatedTextSize (expandedTextSize );
537
539
} else {
540
+ textBlendFraction = 1F ;
538
541
currentDrawX = collapsedDrawX ;
539
542
currentDrawY = collapsedDrawY - currentOffsetY ;
540
543
541
544
setInterpolatedTextSize (collapsedTextSize );
542
545
}
543
546
} else {
547
+ textBlendFraction = fraction ;
544
548
currentDrawX = lerp (expandedDrawX , collapsedDrawX , fraction , positionInterpolator );
545
549
currentDrawY = lerp (expandedDrawY , collapsedDrawY , fraction , positionInterpolator );
546
550
@@ -556,7 +560,8 @@ private void calculateOffsets(final float fraction) {
556
560
// If the collapsed and expanded text colors are different, blend them based on the
557
561
// fraction
558
562
textPaint .setColor (
559
- blendColors (getCurrentExpandedTextColor (), getCurrentCollapsedTextColor (), fraction ));
563
+ blendColors (
564
+ getCurrentExpandedTextColor (), getCurrentCollapsedTextColor (), textBlendFraction ));
560
565
} else {
561
566
textPaint .setColor (getCurrentCollapsedTextColor ());
562
567
}
@@ -726,18 +731,7 @@ private void calculateBaseOffsets() {
726
731
727
732
private void interpolateBounds (float fraction ) {
728
733
if (fadeModeEnabled ) {
729
- if (fraction < fadeModeThresholdFraction ) {
730
- currentBounds .left = expandedBounds .left ;
731
- currentBounds .top = lerp (expandedDrawY , collapsedDrawY , fraction , positionInterpolator );
732
- currentBounds .right = expandedBounds .right ;
733
- currentBounds .bottom =
734
- lerp (expandedBounds .bottom , collapsedBounds .bottom , fraction , positionInterpolator );
735
- } else {
736
- currentBounds .left = collapsedBounds .left ;
737
- currentBounds .top = collapsedBounds .top ;
738
- currentBounds .right = collapsedBounds .right ;
739
- currentBounds .bottom = collapsedBounds .bottom ;
740
- }
734
+ currentBounds .set (fraction < fadeModeThresholdFraction ? expandedBounds : collapsedBounds );
741
735
} else {
742
736
currentBounds .left =
743
737
lerp (expandedBounds .left , collapsedBounds .left , fraction , positionInterpolator );
0 commit comments