@@ -137,17 +137,6 @@ class VoicesAdapter(
137137 this .imageList = imageList
138138 }
139139
140- fun addItem (news : RealmNews ? ) {
141- val currentList = currentList.toMutableList()
142- currentList.add(0 , news)
143- submitListSafely(currentList) {
144- recyclerView?.post {
145- recyclerView?.scrollToPosition(0 )
146- recyclerView?.smoothScrollToPosition(0 )
147- }
148- }
149- }
150-
151140 fun setFromLogin (fromLogin : Boolean ) {
152141 this .fromLogin = fromLogin
153142 }
@@ -327,7 +316,7 @@ class VoicesAdapter(
327316 newsToDelete?.id?.let { id ->
328317 deletePostFn(id) {
329318 val newList = snapshotList.toMutableList().apply { removeAt(adjustedPos) }
330- submitListSafely (newList)
319+ submitList (newList)
331320 parentNews?.id?.let { pid ->
332321 val current = replyCountCache[pid]
333322 replyCountCache[pid] = if (current != null ) maxOf(0 , current - 1 ) else 0
@@ -426,10 +415,6 @@ class VoicesAdapter(
426415 return null
427416 }
428417
429- fun updateList (newList : List <RealmNews ?>) {
430- submitListSafely(newList)
431- }
432-
433418 fun updateParentNews (news : RealmNews ? ) {
434419 val contentChanged = parentNews?.message != news?.message ||
435420 parentNews?.isEdited != news?.isEdited
@@ -438,10 +423,6 @@ class VoicesAdapter(
438423 if (contentChanged) notifyItemChanged(0 )
439424 }
440425
441- fun refreshCurrentItems () {
442- submitListSafely(currentList.toList())
443- }
444-
445426 private fun parseViewIn (viewIn : String? ): JsonArray ? {
446427 if (TextUtils .isEmpty(viewIn)) return null
447428 return try {
@@ -514,11 +495,6 @@ class VoicesAdapter(
514495 list?.forEach { preParseNews(it) }
515496 super .submitList(list, commitCallback)
516497 }
517-
518- private fun submitListSafely (list : List <RealmNews ?>, commitCallback : Runnable ? = null) {
519- submitList(list, commitCallback)
520- }
521-
522498 private fun setMemberClickListeners (holder : VoicesViewHolder , userModel : RealmUser ? , currentLeader : RealmUser ? ) {
523499 if (! fromLogin) {
524500 holder.binding.imgUser.setOnClickListener {
0 commit comments