|
|
|
@ -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) {
|
|
|
|
|