Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 72e3481

Browse files
committed
Fixed lessons bottom sheet while dragging
1 parent 374b9c8 commit 72e3481

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Owl/app/src/main/java/com/materialstudies/owl/ui/lessons/LessonBottomSheetBehavior.kt

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,21 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
1010
/**
1111
* A [BottomSheetBehavior] that helps to restrict touchable area depends on translationX
1212
*/
13-
class LessonBottomSheetBehavior<T : View>(context: Context, attrs: AttributeSet?) :
14-
BottomSheetBehavior<T>(context, attrs) {
13+
class LessonBottomSheetBehavior<T : View> (
14+
context: Context,
15+
attrs: AttributeSet?
16+
) : BottomSheetBehavior<T>(context, attrs) {
1517

16-
override fun onTouchEvent(parent: CoordinatorLayout, child: T, event: MotionEvent): Boolean {
17-
if (event.x < child.translationX) {
18-
return false
18+
override fun onTouchEvent(
19+
parent: CoordinatorLayout,
20+
child: T,
21+
event: MotionEvent
22+
): Boolean {
23+
return if (event.x < child.translationX && state != STATE_DRAGGING) {
24+
false
25+
} else {
26+
super.onTouchEvent(parent, child, event)
1927
}
20-
return super.onTouchEvent(parent, child, event)
2128
}
29+
2230
}

0 commit comments

Comments
 (0)