Fix chapters not being marked as read when transition pages are hidden
This commit is contained in:
parent
c5ab79f618
commit
55196b86b3
@ -71,11 +71,23 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
|
|||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
val position = layoutManager.findLastEndVisibleItemPosition()
|
val position = layoutManager.findLastEndVisibleItemPosition()
|
||||||
val item = adapter.items.getOrNull(position)
|
val item = adapter.items.getOrNull(position)
|
||||||
if (item != null && currentPage != item) {
|
if (item != null) {
|
||||||
currentPage = item
|
currentPage = item
|
||||||
when (item) {
|
when (item) {
|
||||||
is ReaderPage -> onPageSelected(item, position)
|
is ReaderPage -> onPageSelected(item, position)
|
||||||
is ChapterTransition -> onTransitionSelected(item)
|
is ChapterTransition -> {
|
||||||
|
onTransitionSelected(item)
|
||||||
|
|
||||||
|
// If transition pages are invisible select page before transition page
|
||||||
|
if(!activity.showTransitionPages) {
|
||||||
|
val lastPosition = position - 1
|
||||||
|
val lastItem = adapter.items.getOrNull(lastPosition)
|
||||||
|
if(lastItem is ReaderPage) {
|
||||||
|
currentPage = lastItem
|
||||||
|
onPageSelected(lastItem, lastPosition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user