bug fixed
This commit is contained in:
parent
0a8946167f
commit
9e8fed5dab
@ -71,18 +71,15 @@ class CommentsRecyclerViewAdapter(private var list: List<Comment>, private val m
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val commentUpdated = updateEvent.affectedPosition?.let { list[it] }
|
|
||||||
val position = updateEvent.affectedPosition
|
|
||||||
|
|
||||||
|
val position = updateEvent.affectedPosition
|
||||||
previousSize = itemCount
|
previousSize = itemCount
|
||||||
list = updatedList
|
list = updatedList
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
when(updateEvent.updateType) {
|
when(updateEvent.updateType) {
|
||||||
|
|
||||||
UpdateEvent.UpdateType.COMMENT_REMOVED -> {
|
UpdateEvent.UpdateType.COMMENT_REMOVED -> {
|
||||||
if(commentUpdated != null && position != null)
|
if(position != null)
|
||||||
notifyItemRemoved(position)
|
notifyItemRemoved(position)
|
||||||
}
|
}
|
||||||
UpdateEvent.UpdateType.COMMENT_ADDED_TOP -> {
|
UpdateEvent.UpdateType.COMMENT_ADDED_TOP -> {
|
||||||
|
|||||||
@ -137,7 +137,13 @@ class PostsRecyclerViewAdapter (private val markwon: Markwon, private val callba
|
|||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val postUpdated = updateEvent.affectedPosition?.let { postList?.get(it) }
|
val postUpdated = updateEvent.affectedPosition?.let {
|
||||||
|
if(updateEvent.updateType == UpdateEvent.UpdateType.POST_REMOVED) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
postList?.get(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
val position = updateEvent.affectedPosition
|
val position = updateEvent.affectedPosition
|
||||||
|
|
||||||
previousSize = itemCount
|
previousSize = itemCount
|
||||||
@ -153,7 +159,7 @@ class PostsRecyclerViewAdapter (private val markwon: Markwon, private val callba
|
|||||||
notifyItemChanged(position, CommentsCountUpdatePayload(postUpdated.numberOfComments))
|
notifyItemChanged(position, CommentsCountUpdatePayload(postUpdated.numberOfComments))
|
||||||
}
|
}
|
||||||
UpdateEvent.UpdateType.POST_REMOVED -> {
|
UpdateEvent.UpdateType.POST_REMOVED -> {
|
||||||
if(postUpdated != null && position != null)
|
if(position != null)
|
||||||
notifyItemRemoved(position)
|
notifyItemRemoved(position)
|
||||||
}
|
}
|
||||||
UpdateEvent.UpdateType.POST_ADDED -> {
|
UpdateEvent.UpdateType.POST_ADDED -> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user