Fixed #469 - Reader chapters clickable while collasped

pull/3372/head
Jay 4 years ago
parent 14ec89f654
commit f5f4b8a119

@ -59,6 +59,8 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
post {
chapter_recycler.alpha = if (sheetBehavior.isExpanded()) 1f else 0f
chapter_recycler.isClickable = sheetBehavior.isExpanded()
chapter_recycler.isFocusable = sheetBehavior.isExpanded()
}
sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
@ -95,6 +97,8 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
webview_button.alpha = 1f
if (activity.sheetManageNavColor) activity.window.navigationBarColor = primary
}
chapter_recycler.isClickable = state == BottomSheetBehavior.STATE_EXPANDED
chapter_recycler.isFocusable = state == BottomSheetBehavior.STATE_EXPANDED
webview_button.visibleIf(state != BottomSheetBehavior.STATE_COLLAPSED)
chapters_button.visInvisIf(state != BottomSheetBehavior.STATE_EXPANDED)
}
@ -103,11 +107,15 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
adapter = FastAdapter.with(itemAdapter)
chapter_recycler.adapter = adapter
adapter?.onClickListener = { _, _, item, _ ->
if (item.chapter.id != presenter.getCurrentChapter()?.chapter?.id) {
shouldCollapse = false
presenter.loadChapter(item.chapter)
if (!sheetBehavior.isExpanded()) {
false
} else {
if (item.chapter.id != presenter.getCurrentChapter()?.chapter?.id) {
shouldCollapse = false
presenter.loadChapter(item.chapter)
}
true
}
true
}
adapter?.addEventHook(object : ClickEventHook<ReaderChapterItem>() {
override fun onBind(viewHolder: RecyclerView.ViewHolder): View? {

Loading…
Cancel
Save