diff --git a/Owl/app/src/main/java/com/materialstudies/owl/ui/lessons/LessonBottomSheetBehavior.kt b/Owl/app/src/main/java/com/materialstudies/owl/ui/lessons/LessonBottomSheetBehavior.kt index 3399854..c74cf50 100644 --- a/Owl/app/src/main/java/com/materialstudies/owl/ui/lessons/LessonBottomSheetBehavior.kt +++ b/Owl/app/src/main/java/com/materialstudies/owl/ui/lessons/LessonBottomSheetBehavior.kt @@ -10,13 +10,21 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior /** * A [BottomSheetBehavior] that helps to restrict touchable area depends on translationX */ -class LessonBottomSheetBehavior(context: Context, attrs: AttributeSet?) : - BottomSheetBehavior(context, attrs) { +class LessonBottomSheetBehavior ( + context: Context, + attrs: AttributeSet? +) : BottomSheetBehavior(context, attrs) { - override fun onTouchEvent(parent: CoordinatorLayout, child: T, event: MotionEvent): Boolean { - if (event.x < child.translationX) { - return false + override fun onTouchEvent( + parent: CoordinatorLayout, + child: T, + event: MotionEvent + ): Boolean { + return if (event.x < child.translationX && state != STATE_DRAGGING) { + false + } else { + super.onTouchEvent(parent, child, event) } - return super.onTouchEvent(parent, child, event) } + } \ No newline at end of file