Add notifyItemRangeChanged to help recyclerview.

master
voussoir 2022-04-06 21:47:47 -07:00
parent b7f641515a
commit 77cfcf202f
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 4 additions and 2 deletions

View File

@ -159,8 +159,9 @@ class TracklistAdapter(private val fragment: Fragment) : RecyclerView.Adapter<Re
// wait for result and store in tracklist
withContext(Main) {
tracklist = deferred.await()
notifyItemRemoved(position)
notifyItemChanged(0)
notifyItemRemoved(position)
notifyItemRangeChanged(position, tracklist.tracklistElements.size)
}
}
}
@ -177,8 +178,9 @@ class TracklistAdapter(private val fragment: Fragment) : RecyclerView.Adapter<Re
withContext(Main) {
tracklist = deferred.await()
val positionInRecyclerView: Int = positionInTracklist + 1 // position 0 is the statistics element
notifyItemRemoved(positionInRecyclerView)
notifyItemChanged(0)
notifyItemRemoved(positionInRecyclerView)
notifyItemRangeChanged(position, tracklist.tracklistElements.size)
}
}
}