From 18d385d5ac8a1fecfbb668240e1b18e49ebec599 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Tue, 10 Aug 2021 16:58:00 -0400 Subject: [PATCH] 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 --- .../ui/reader/chapter/ReaderChapterSheet.kt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt index 509a6ba550..5bbc53dabb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/chapter/ReaderChapterSheet.kt @@ -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() }