mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 20:01:53 +01:00
Fixed #469 - Reader chapters clickable while collasped
This commit is contained in:
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,12 +107,16 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
adapter = FastAdapter.with(itemAdapter)
|
||||
chapter_recycler.adapter = adapter
|
||||
adapter?.onClickListener = { _, _, item, _ ->
|
||||
if (!sheetBehavior.isExpanded()) {
|
||||
false
|
||||
} else {
|
||||
if (item.chapter.id != presenter.getCurrentChapter()?.chapter?.id) {
|
||||
shouldCollapse = false
|
||||
presenter.loadChapter(item.chapter)
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
adapter?.addEventHook(object : ClickEventHook<ReaderChapterItem>() {
|
||||
override fun onBind(viewHolder: RecyclerView.ViewHolder): View? {
|
||||
return if (viewHolder is ReaderChapterItem.ViewHolder) {
|
||||
|
Loading…
Reference in New Issue
Block a user