This commit is contained in:
Benoit Marty 2021-03-08 15:17:41 +01:00 committed by Benoit Marty
parent 66aa9cd888
commit 0cd728222e

View file

@ -155,6 +155,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
synchronized(modelCache) { synchronized(modelCache) {
assertUpdateCallbacksAllowed() assertUpdateCallbacksAllowed()
(position until (position + count)).forEach { (position until (position + count)).forEach {
// Invalidate cache
modelCache[it] = null modelCache[it] = null
} }
requestModelBuild() requestModelBuild()
@ -173,7 +174,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
override fun onInserted(position: Int, count: Int) { override fun onInserted(position: Int, count: Int) {
synchronized(modelCache) { synchronized(modelCache) {
assertUpdateCallbacksAllowed() assertUpdateCallbacksAllowed()
(0 until count).forEach { repeat(count) {
modelCache.add(position, null) modelCache.add(position, null)
} }
requestModelBuild() requestModelBuild()
@ -183,7 +184,7 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
override fun onRemoved(position: Int, count: Int) { override fun onRemoved(position: Int, count: Int) {
synchronized(modelCache) { synchronized(modelCache) {
assertUpdateCallbacksAllowed() assertUpdateCallbacksAllowed()
(0 until count).forEach { repeat(count) {
modelCache.removeAt(position) modelCache.removeAt(position)
} }
requestModelBuild() requestModelBuild()