-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Glide #11
Comments
Good question! Thanks. In my project I am using a CustomView, example: public class UrlImageView extend ImageView {
public UrlImageView(Context context) { /* default constructor */
super(context);
}
/* other methods */
public void setUrl(String url) {
Glide.with(getContext()).load(url).into(this);
}
} mRecyclerViewAdapter.registerRenderer(new ViewBinder<>(
R.layout.item_layout,
SomeModel.class,
(model, finder, payloads) -> finder
.find(R.id.custom_view, (ViewProvider<UrlImageView>) urlImageView -> {
urlImageView.setUrl(model.getImageUrl());
})
)); OR you can use it: mRecyclerViewAdapter.registerRenderer(new ViewBinder<>(
R.layout.item_layout,
SomeModel.class,
(model, finder, payloads) -> finder
.find(R.id.custom_view, (ViewProvider<ImageView>) imageView -> {
Glide.with(getContext()).load(model.getUrl()).into(imageView);
})
)); OR: mRecyclerViewAdapter.registerRenderer(new ViewBinder<>(
R.layout.item_layout,
SomeModel.class,
(model, finder, payloads) -> finder {
ImageView imageView = finder.find(R.id.custom_view);
Glide.with(getContext()).load(model.getUrl()).into(imageView);
}
)); |
Just a small correction I have this error: Edit: I just used another example but I had to use finder.getRootView().getContext() |
Looks like you did not replace the AppCompatImageView to the UrlImageView in your xml layout. |
I'v inspected examples and found the complex models utilizing Glide. By the way RENDERER is deprecated in latest release and I can not figure out how to use Glide in BINDERS. Any help?
The text was updated successfully, but these errors were encountered: