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

Fixed lessons bottom sheet while dragging #22

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,21 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
/**
* A [BottomSheetBehavior] that helps to restrict touchable area depends on translationX
*/
class LessonBottomSheetBehavior<T : View>(context: Context, attrs: AttributeSet?) :
BottomSheetBehavior<T>(context, attrs) {
class LessonBottomSheetBehavior<T : View> (
context: Context,
attrs: AttributeSet?
) : BottomSheetBehavior<T>(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)
}

}