mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-30 13:13:05 +03:00
Catalogue fixes
This commit is contained in:
parent
03967b67cf
commit
1e4a01399d
1 changed files with 14 additions and 3 deletions
|
@ -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 a new issue