mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-13 01:25:07 +01:00
Fixed fast scroll when category above is collasped
This commit is contained in:
parent
ee2df0f87a
commit
4bc44b22f6
@ -303,19 +303,24 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
appbar?.y = 0f
|
appbar?.y = 0f
|
||||||
recycler.suppressLayout(true)
|
val item = adapter.getItem(itemPosition)
|
||||||
(recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
|
if (item is LibraryHeaderItem) {
|
||||||
itemPosition, if (adapter.isSingleCategory) {
|
scrollToHeader(item.category.order)
|
||||||
0
|
} else {
|
||||||
} else {
|
recycler.suppressLayout(true)
|
||||||
if (itemPosition == 0) {
|
(recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
|
||||||
|
itemPosition, if (adapter.isSingleCategory) {
|
||||||
0
|
0
|
||||||
} else {
|
} else {
|
||||||
(-40).dpToPx
|
if (itemPosition == 0) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
(-40).dpToPx
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)
|
recycler.suppressLayout(false)
|
||||||
recycler.suppressLayout(false)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recycler.addOnScrollListener(scrollListener)
|
recycler.addOnScrollListener(scrollListener)
|
||||||
@ -653,8 +658,13 @@ class LibraryController(
|
|||||||
val appbarOffset = if (appbar?.y ?: 0f > -20) 0 else (appbar?.y?.plus(
|
val appbarOffset = if (appbar?.y ?: 0f > -20) 0 else (appbar?.y?.plus(
|
||||||
view?.rootWindowInsets?.systemWindowInsetTop ?: 0
|
view?.rootWindowInsets?.systemWindowInsetTop ?: 0
|
||||||
) ?: 0f).roundToInt() + 30.dpToPx
|
) ?: 0f).roundToInt() + 30.dpToPx
|
||||||
|
val previousHeader = adapter.getItem(adapter.indexOf(pos - 1)) as? LibraryHeaderItem
|
||||||
(recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
|
(recycler.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(
|
||||||
headerPosition, (if (headerPosition == 0) 0 else (-32).dpToPx) + appbarOffset
|
headerPosition, (when {
|
||||||
|
headerPosition == 0 -> 0
|
||||||
|
previousHeader?.category?.isHidden == true -> (-3).dpToPx
|
||||||
|
else -> (-32).dpToPx
|
||||||
|
}) + appbarOffset
|
||||||
)
|
)
|
||||||
recycler.suppressLayout(false)
|
recycler.suppressLayout(false)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user