Reset bound message ID when view is recycled.

This commit is contained in:
akwizgran
2025-05-01 13:26:38 +01:00
parent 16104b84b2
commit 9ecac899fb
2 changed files with 11 additions and 0 deletions

View File

@@ -121,4 +121,9 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem>
return textView.getContext(); return textView.getContext();
} }
void onViewRecycled() {
// Reset the bound message ID so an asynchronous text loading task
// won't set the view's text while it's in the recycling pool
boundMessageId = null;
}
} }

View File

@@ -140,6 +140,12 @@ public class ThreadItemAdapter<I extends ThreadItem>
return getItem(position); return getItem(position);
} }
@Override
public void onViewRecycled(BaseThreadItemViewHolder<I> viewHolder) {
super.onViewRecycled(viewHolder);
viewHolder.onViewRecycled();
}
public interface ThreadItemListener<I> { public interface ThreadItemListener<I> {
void onReplyClick(I item); void onReplyClick(I item);