mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 17:39:19 +01:00
Catalogue fixes
This commit is contained in:
parent
03967b67cf
commit
1e4a01399d
@ -254,8 +254,8 @@ open class CatalogueFragment : BaseRxFragment<CataloguePresenter>(),
|
|||||||
|
|
||||||
(layoutManager as GridLayoutManager).spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
(layoutManager as GridLayoutManager).spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
||||||
override fun getSpanSize(position: Int): Int {
|
override fun getSpanSize(position: Int): Int {
|
||||||
return when (adapter.getItemViewType(position)) {
|
return when (adapter?.getItemViewType(position)) {
|
||||||
R.layout.item_catalogue_grid -> 1
|
R.layout.item_catalogue_grid, null -> 1
|
||||||
else -> spanCount
|
else -> spanCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,7 +495,18 @@ open class CatalogueFragment : BaseRxFragment<CataloguePresenter>(),
|
|||||||
* @return the holder of the manga or null if it's not bound.
|
* @return the holder of the manga or null if it's not bound.
|
||||||
*/
|
*/
|
||||||
private fun getHolder(manga: Manga): CatalogueHolder? {
|
private fun getHolder(manga: Manga): CatalogueHolder? {
|
||||||
return recycler.findViewHolderForItemId(manga.id!!) as? CatalogueHolder
|
val layoutManager = recycler.layoutManager as LinearLayoutManager
|
||||||
|
val firstVisiblePos = layoutManager.findFirstVisibleItemPosition()
|
||||||
|
val lastVisiblePos = layoutManager.findLastVisibleItemPosition()
|
||||||
|
|
||||||
|
(firstVisiblePos..lastVisiblePos-1).forEach { i ->
|
||||||
|
val item = adapter.getItem(i) as? CatalogueItem
|
||||||
|
if (item != null && item.manga.id!! == manga.id!!) {
|
||||||
|
return recycler.findViewHolderForLayoutPosition(i) as? CatalogueHolder
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user