@@ -464,6 +464,9 @@ - (void)fhv_shiftDisplayLinkDidFire:(CADisplayLink *)displayLink {
464
464
465
465
- (void )fhv_accumulatorDidChange {
466
466
if (!_trackingScrollView) {
467
+ // Set the shadow opacity directly.
468
+ self.layer .shadowOpacity = _visibleShadowOpacity;
469
+
467
470
return ;
468
471
}
469
472
@@ -698,7 +701,7 @@ - (void)statusBarShifterNeedsStatusBarAppearanceUpdate:(MDCStatusBarShifter *)st
698
701
}
699
702
700
703
- (void )statusBarShifter : (MDCStatusBarShifter *)statusBarShifter
701
- wantsSnapshotViewAdded : (UIView *)view {
704
+ wantsSnapshotViewAdded : (UIView *)view {
702
705
[self addSubview: view];
703
706
}
704
707
@@ -735,10 +738,23 @@ - (void)setTrackingScrollView:(UIScrollView *)trackingScrollView {
735
738
void (^animate)() = ^{
736
739
[self fhv_updateLayout ];
737
740
};
741
+ void (^completion)(BOOL ) = ^(BOOL finished) {
742
+ if (!finished) {
743
+ return ;
744
+ }
745
+
746
+ // When the tracking scroll view is cleared we need a shadow update.
747
+ if (!_trackingScrollView) {
748
+ [self fhv_accumulatorDidChange ];
749
+ }
750
+ };
738
751
if (wasTrackingScrollView) {
739
- [UIView animateWithDuration: kTrackingScrollViewDidChangeAnimationDuration animations: animate];
752
+ [UIView animateWithDuration: kTrackingScrollViewDidChangeAnimationDuration
753
+ animations: animate
754
+ completion: completion];
740
755
} else {
741
756
animate ();
757
+ completion (YES );
742
758
}
743
759
}
744
760
@@ -776,7 +792,8 @@ - (void)setBehavior:(MDCFlexibleHeaderShiftBehavior)behavior {
776
792
if (_behavior == behavior) {
777
793
return ;
778
794
}
779
- BOOL needsShiftOnScreen = (_behavior != MDCFlexibleHeaderShiftBehaviorDisabled && behavior == MDCFlexibleHeaderShiftBehaviorDisabled);
795
+ BOOL needsShiftOnScreen = (_behavior != MDCFlexibleHeaderShiftBehaviorDisabled &&
796
+ behavior == MDCFlexibleHeaderShiftBehaviorDisabled);
780
797
_behavior = behavior;
781
798
782
799
_statusBarShifter.enabled = self.hidesStatusBarWhenCollapsed ;
0 commit comments