Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
manneohlund authored Oct 3, 2017
1 parent 827bc74 commit 5939413
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ In your view holder, add event caller to view and pass the view and an action id

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

```java
SmartRecyclerAdapter
Expand All @@ -111,6 +112,14 @@ SmartRecyclerAdapter
return MailViewHolder.class;
}
})
.setOnViewDetachedFromWindowListener(new OnViewDetachedFromWindowListener() {
@Override
public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
if (holder instanceof ImageViewHolder) {
ImageCacheManager.getInstance().cancelAsyncTask(holder);
}
}
})
.into(recyclerView);
```

Expand Down

0 comments on commit 5939413

Please sign in to comment.