mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Reader chapter sheet now needs two swipes from recycler view to collapse
similar to other bottom sheets, if you're not at the top of the list and reach the top while dragging, it will not drag the sheet down. only when at the top it will drag down
This commit is contained in:
parent
c9fbe8f847
commit
18d385d5ac
1 changed files with 13 additions and 0 deletions
|
@ -174,6 +174,19 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
|||
else fullPrimary
|
||||
)
|
||||
|
||||
binding.chapterRecycler.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
|
||||
super.onScrollStateChanged(recyclerView, newState)
|
||||
if (newState == RecyclerView.SCROLL_STATE_IDLE ||
|
||||
newState == RecyclerView.SCROLL_STATE_SETTLING
|
||||
) {
|
||||
sheetBehavior?.isDraggable = true
|
||||
} else {
|
||||
sheetBehavior?.isDraggable = !recyclerView.canScrollVertically(-1)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
binding.chapterRecycler.layoutManager = LinearLayoutManager(context)
|
||||
refreshList()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue