Skip to content

Commit 5939413

Browse files
authored
Update README.md
1 parent 827bc74 commit 5939413

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ In your view holder, add event caller to view and pass the view and an action id
9393

9494
If you want to bind one data type with different view holders depending on some attribute you can set a ViewTypeResolver.
9595
Note .map() call not needed in this case but you can combine if you want to.
96+
You can also set an OnViewDetachedFromWindowListener for immediate view holder detach handling.
9697

9798
```java
9899
SmartRecyclerAdapter
@@ -111,6 +112,14 @@ SmartRecyclerAdapter
111112
return MailViewHolder.class;
112113
}
113114
})
115+
.setOnViewDetachedFromWindowListener(new OnViewDetachedFromWindowListener() {
116+
@Override
117+
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
118+
if (holder instanceof ImageViewHolder) {
119+
ImageCacheManager.getInstance().cancelAsyncTask(holder);
120+
}
121+
}
122+
})
114123
.into(recyclerView);
115124
```
116125

0 commit comments

Comments
 (0)