@@ -1456,11 +1456,6 @@ boolean isCollapsible() {
14561456 return (scrollFlags & SCROLL_FLAG_SCROLL ) == SCROLL_FLAG_SCROLL
14571457 && (scrollFlags & COLLAPSIBLE_FLAGS ) != 0 ;
14581458 }
1459-
1460- /** Returns true if the scroll flags are set to snap. */
1461- boolean shouldSnapOnScroll () {
1462- return (scrollFlags & SCROLL_FLAG_SNAP ) == SCROLL_FLAG_SNAP ;
1463- }
14641459 }
14651460
14661461 /**
@@ -1725,7 +1720,7 @@ private void snapToChildIfNeeded(CoordinatorLayout coordinatorLayout, @NonNull T
17251720 final LayoutParams lp = (LayoutParams ) offsetChild .getLayoutParams ();
17261721 final int flags = lp .getScrollFlags ();
17271722
1728- if (lp . shouldSnapOnScroll () ) {
1723+ if (( flags & LayoutParams . FLAG_SNAP ) == LayoutParams . FLAG_SNAP ) {
17291724 // We're set the snap, so animate the offset to the nearest edge
17301725 int snapTop = -offsetChild .getTop ();
17311726 int snapBottom = -offsetChild .getBottom ();
@@ -1816,10 +1811,9 @@ public boolean onLayoutChild(
18161811 // 3. non-forced pending actions
18171812 final int pendingAction = abl .getPendingAction ();
18181813 if (savedState != null && (pendingAction & PENDING_ACTION_FORCE ) == 0 ) {
1819- final int totalScrollRange = abl .getTotalScrollRange ();
18201814 if (savedState .fullyScrolled ) {
18211815 // Keep fully scrolled.
1822- setHeaderTopBottomOffset (parent , abl , -totalScrollRange );
1816+ setHeaderTopBottomOffset (parent , abl , -abl . getTotalScrollRange () );
18231817 } else if (savedState .fullyExpanded ) {
18241818 // Keep fully expanded.
18251819 setHeaderTopBottomOffset (parent , abl , 0 );
@@ -1832,10 +1826,6 @@ public boolean onLayoutChild(
18321826 } else {
18331827 offset += Math .round (child .getHeight () * savedState .firstVisibleChildPercentageShown );
18341828 }
1835- // If snap is set, set the offset to top or bottom.
1836- if (((LayoutParams ) child .getLayoutParams ()).shouldSnapOnScroll ()) {
1837- offset = -totalScrollRange * (-offset < totalScrollRange / 2 ? 0 : 1 );
1838- }
18391829 setHeaderTopBottomOffset (parent , abl , offset );
18401830 }
18411831 } else if (pendingAction != PENDING_ACTION_NONE ) {
0 commit comments