@@ -329,6 +329,7 @@ void onLayout(@NonNull View bottomSheet) {}
329329
330330 @ Nullable WeakReference <V > viewRef ;
331331 @ Nullable WeakReference <View > accessibilityDelegateViewRef ;
332+ @ Nullable WeakReference <View > dragHandleViewRef ;
332333
333334 @ Nullable WeakReference <View > nestedScrollingChildRef ;
334335
@@ -649,10 +650,11 @@ public boolean onInterceptTouchEvent(
649650 // Only intercept nested scrolling events here if the view not being moved by the
650651 // ViewDragHelper.
651652 if (state != STATE_SETTLING ) {
652- View scroll = nestedScrollingChildRef != null ? nestedScrollingChildRef .get () : null ;
653- if (scroll != null && parent .isPointInChildBounds (scroll , initialX , initialY )) {
653+ if (isTouchingScrollingChild (parent , initialX , initialY )) {
654654 activePointerId = event .getPointerId (event .getActionIndex ());
655- touchingScrollingChild = true ;
655+ if (!isTouchingDragHandle (parent , initialX , initialY )) {
656+ touchingScrollingChild = true ;
657+ }
656658 }
657659 }
658660 ignoreEvents =
@@ -1532,6 +1534,20 @@ private float calculateCornerInterpolation(
15321534 return 0 ;
15331535 }
15341536
1537+ private boolean isTouchingScrollingChild (
1538+ @ NonNull CoordinatorLayout parent , int xCoordinate , int yCoordinate ) {
1539+ View scrollingChild = nestedScrollingChildRef != null ? nestedScrollingChildRef .get () : null ;
1540+ return scrollingChild != null
1541+ && parent .isPointInChildBounds (scrollingChild , xCoordinate , yCoordinate );
1542+ }
1543+
1544+ private boolean isTouchingDragHandle (
1545+ @ NonNull CoordinatorLayout parent , int xCoordinate , int yCoordinate ) {
1546+ View dragHandleView = dragHandleViewRef != null ? dragHandleViewRef .get () : null ;
1547+ return dragHandleView != null
1548+ && parent .isPointInChildBounds (dragHandleView , xCoordinate , yCoordinate );
1549+ }
1550+
15351551 private boolean isAtTopOfScreen () {
15361552 if (viewRef == null || viewRef .get () == null ) {
15371553 return false ;
@@ -2020,10 +2036,7 @@ public void onViewReleased(@NonNull View releasedChild, float xvel, float yvel)
20202036
20212037 @ Override
20222038 public int clampViewPositionVertical (@ NonNull View child , int top , int dy ) {
2023- return MathUtils .clamp (
2024- top ,
2025- getExpandedOffset (),
2026- getViewVerticalDragRange (child ));
2039+ return MathUtils .clamp (top , getExpandedOffset (), getViewVerticalDragRange (child ));
20272040 }
20282041
20292042 @ Override
@@ -2346,6 +2359,10 @@ private void updateImportantForAccessibility(boolean expanded) {
23462359 }
23472360 }
23482361
2362+ void setDragHandleView (@ Nullable BottomSheetDragHandleView dragHandleView ) {
2363+ dragHandleViewRef = dragHandleView != null ? new WeakReference <>(dragHandleView ) : null ;
2364+ }
2365+
23492366 void setAccessibilityDelegateView (@ Nullable View accessibilityDelegateView ) {
23502367 if (accessibilityDelegateView == null && accessibilityDelegateViewRef != null ) {
23512368 clearAccessibilityAction (
0 commit comments