Skip to content

Commit

Permalink
fix: calculate size using mBeansByRow
Browse files Browse the repository at this point in the history
  • Loading branch information
goofyz committed Mar 28, 2024
1 parent 0f1ad69 commit 7c47373
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ class SimpleAdapter(theme: Theme, private val columnSize: Int) : RecyclerView.Ad
val beans get() = mBeans

fun updateBeans(beans: List<SimpleKeyBean>) {
val prevSize = mBeans.size
val prevSize = mBeansByRows.size
mBeans.clear()
notifyItemRangeRemoved(0, prevSize)
mBeans.addAll(beans)
notifyItemRangeInserted(0, beans.size)
mBeansByRows.clear()
mBeansByRows.addAll(beans.chunked(columnSize))
notifyItemRangeInserted(0, mBeansByRows.size)
}

override fun getItemCount(): Int {
Expand Down

0 comments on commit 7c47373

Please sign in to comment.