Skip to content

Commit

Permalink
Fix race conditions for Support SDK 27
Browse files Browse the repository at this point in the history
New stab at fixing it.
  • Loading branch information
kristfal authored Jul 27, 2018
1 parent 05d16c6 commit cf598b8
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,13 @@ public boolean onInterceptTouchEvent( CoordinatorLayout parent, V child, MotionE
return false;
}

/**
* Workaround for Support SDK 27 race condition. We'll wait until mViewDragHelper is available
*/
if ( mViewDragHelper == null ) {
return false;
}

int action = MotionEventCompat.getActionMasked( event );
if ( action == MotionEvent.ACTION_DOWN ) {
reset();
Expand Down Expand Up @@ -250,14 +257,7 @@ public boolean onInterceptTouchEvent( CoordinatorLayout parent, V child, MotionE
// We don't want to trigger a BottomSheet fling as a result of a Cancel MotionEvent (e.g., parent horizontal scroll view taking over touch events)
mScrollVelocityTracker.clear();
}

/**
* Workaround for Support SDK 27 race condition
*/
if ( mViewDragHelper == null ) {
mViewDragHelper = ViewDragHelper.create( parent, mDragCallback );
}


if ( ! mIgnoreEvents && mViewDragHelper.shouldInterceptTouchEvent( event ) ) {
return true;
}
Expand Down

0 comments on commit cf598b8

Please sign in to comment.