@@ -216,7 +216,7 @@ public void onRestoreInstanceState(CoordinatorLayout parent, V child, Parcelable
216
216
@ Override
217
217
public boolean onLayoutChild (CoordinatorLayout parent , V child , int layoutDirection ) {
218
218
if (ViewCompat .getFitsSystemWindows (parent ) && !ViewCompat .getFitsSystemWindows (child )) {
219
- ViewCompat .setFitsSystemWindows (child , true );
219
+ child .setFitsSystemWindows (true );
220
220
}
221
221
int savedTop = child .getTop ();
222
222
// First let the parent lay it out
@@ -344,19 +344,30 @@ public boolean onTouchEvent(CoordinatorLayout parent, V child, MotionEvent event
344
344
345
345
@ Override
346
346
public boolean onStartNestedScroll (
347
- CoordinatorLayout coordinatorLayout ,
348
- V child ,
349
- View directTargetChild ,
350
- View target ,
351
- int nestedScrollAxes ) {
347
+ @ NonNull CoordinatorLayout coordinatorLayout ,
348
+ @ NonNull V child ,
349
+ @ NonNull View directTargetChild ,
350
+ @ NonNull View target ,
351
+ int axes ,
352
+ int type ) {
352
353
lastNestedScrollDy = 0 ;
353
354
nestedScrolled = false ;
354
- return (nestedScrollAxes & ViewCompat .SCROLL_AXIS_VERTICAL ) != 0 ;
355
+ return (axes & ViewCompat .SCROLL_AXIS_VERTICAL ) != 0 ;
355
356
}
356
357
357
358
@ Override
358
359
public void onNestedPreScroll (
359
- CoordinatorLayout coordinatorLayout , V child , View target , int dx , int dy , int [] consumed ) {
360
+ @ NonNull CoordinatorLayout coordinatorLayout ,
361
+ @ NonNull V child ,
362
+ @ NonNull View target ,
363
+ int dx ,
364
+ int dy ,
365
+ @ NonNull int [] consumed ,
366
+ int type ) {
367
+ if (type == ViewCompat .TYPE_NON_TOUCH ) {
368
+ // Ignore fling here. The ViewDragHelper handles it.
369
+ return ;
370
+ }
360
371
View scrollingChild = nestedScrollingChildRef .get ();
361
372
if (target != scrollingChild ) {
362
373
return ;
@@ -392,7 +403,11 @@ public void onNestedPreScroll(
392
403
}
393
404
394
405
@ Override
395
- public void onStopNestedScroll (CoordinatorLayout coordinatorLayout , V child , View target ) {
406
+ public void onStopNestedScroll (
407
+ @ NonNull CoordinatorLayout coordinatorLayout ,
408
+ @ NonNull V child ,
409
+ @ NonNull View target ,
410
+ int type ) {
396
411
if (child .getTop () == getExpandedOffset ()) {
397
412
setStateInternal (STATE_EXPANDED );
398
413
return ;
@@ -452,7 +467,11 @@ public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, V child, Vie
452
467
453
468
@ Override
454
469
public boolean onNestedPreFling (
455
- CoordinatorLayout coordinatorLayout , V child , View target , float velocityX , float velocityY ) {
470
+ @ NonNull CoordinatorLayout coordinatorLayout ,
471
+ @ NonNull V child ,
472
+ @ NonNull View target ,
473
+ float velocityX ,
474
+ float velocityY ) {
456
475
return target == nestedScrollingChildRef .get ()
457
476
&& (state != STATE_EXPANDED
458
477
|| super .onNestedPreFling (coordinatorLayout , child , target , velocityX , velocityY ));
@@ -721,7 +740,7 @@ void startSettlingAnimation(View child, int state) {
721
740
new ViewDragHelper .Callback () {
722
741
723
742
@ Override
724
- public boolean tryCaptureView (View child , int pointerId ) {
743
+ public boolean tryCaptureView (@ NonNull View child , int pointerId ) {
725
744
if (state == STATE_DRAGGING ) {
726
745
return false ;
727
746
}
@@ -739,7 +758,8 @@ public boolean tryCaptureView(View child, int pointerId) {
739
758
}
740
759
741
760
@ Override
742
- public void onViewPositionChanged (View changedView , int left , int top , int dx , int dy ) {
761
+ public void onViewPositionChanged (
762
+ @ NonNull View changedView , int left , int top , int dx , int dy ) {
743
763
dispatchOnSlide (top );
744
764
}
745
765
@@ -751,7 +771,7 @@ public void onViewDragStateChanged(int state) {
751
771
}
752
772
753
773
@ Override
754
- public void onViewReleased (View releasedChild , float xvel , float yvel ) {
774
+ public void onViewReleased (@ NonNull View releasedChild , float xvel , float yvel ) {
755
775
int top ;
756
776
@ State int targetState ;
757
777
if (yvel < 0 ) { // Moving up
@@ -816,18 +836,18 @@ public void onViewReleased(View releasedChild, float xvel, float yvel) {
816
836
}
817
837
818
838
@ Override
819
- public int clampViewPositionVertical (View child , int top , int dy ) {
839
+ public int clampViewPositionVertical (@ NonNull View child , int top , int dy ) {
820
840
return MathUtils .constrain (
821
841
top , getExpandedOffset (), hideable ? parentHeight : collapsedOffset );
822
842
}
823
843
824
844
@ Override
825
- public int clampViewPositionHorizontal (View child , int left , int dx ) {
845
+ public int clampViewPositionHorizontal (@ NonNull View child , int left , int dx ) {
826
846
return child .getLeft ();
827
847
}
828
848
829
849
@ Override
830
- public int getViewVerticalDragRange (View child ) {
850
+ public int getViewVerticalDragRange (@ NonNull View child ) {
831
851
if (hideable ) {
832
852
return parentHeight ;
833
853
} else {
0 commit comments