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