Allow extensions/migration sheet to be dragged down while recycler is settling

This commit is contained in:
Jays2Kings 2021-04-27 02:39:14 -04:00
parent 881da13dc9
commit c5f592bbe7

View File

@ -22,7 +22,12 @@ class RecyclerWithScrollerView @JvmOverloads constructor(context: Context, attrs
binding.recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (sheet.isOnView(this@RecyclerWithScrollerView) && newState == RecyclerView.SCROLL_STATE_IDLE) {
if (sheet.isOnView(this@RecyclerWithScrollerView) &&
(
newState == RecyclerView.SCROLL_STATE_IDLE ||
newState == RecyclerView.SCROLL_STATE_SETTLING
)
) {
sheet.sheetBehavior?.isDraggable = true
}
}
@ -31,7 +36,8 @@ class RecyclerWithScrollerView @JvmOverloads constructor(context: Context, attrs
super.onScrolled(recyclerView, dx, dy)
if (sheet.isOnView(this@RecyclerWithScrollerView) &&
sheet.sheetBehavior.isExpanded() &&
recyclerView.canScrollVertically(-1)
recyclerView.canScrollVertically(-1) &&
recyclerView.scrollState != RecyclerView.SCROLL_STATE_SETTLING
) {
sheet.sheetBehavior?.isDraggable = false
}