fixes to format of LinearLayoutManagerAccurateOffset

This commit is contained in:
Jays2Kings 2022-04-30 14:53:10 -04:00
parent 7c8a10c651
commit 5138fc1a49

View file

@ -104,9 +104,11 @@ fun RecyclerView.LayoutManager.getFirstPos(recyclerView: RecyclerView?, toolbarH
.mapNotNull { getChildAt(it) } .mapNotNull { getChildAt(it) }
.filter { .filter {
val isLibraryHeader = getItemViewType(it) == R.layout.library_category_header_item val isLibraryHeader = getItemViewType(it) == R.layout.library_category_header_item
val bottom = (if (isLibraryHeader) { val bottom = (
it.findViewById<TextView>(R.id.category_title)?.bottom?.plus(it.y)?.roundToInt() if (isLibraryHeader) {
} else it.bottom) ?: it.bottom it.findViewById<TextView>(R.id.category_title)?.bottom?.plus(it.y)?.roundToInt()
} else it.bottom
) ?: it.bottom
bottom >= inset + toolbarHeight && it.height > 0 bottom >= inset + toolbarHeight && it.height > 0
} }
.mapNotNull { pos -> getPosition(pos).takeIf { it != RecyclerView.NO_POSITION } } .mapNotNull { pos -> getPosition(pos).takeIf { it != RecyclerView.NO_POSITION } }