description = result + " \u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0 " + pubDate;
...
RecyclerViewAdapter(Context context, List<ListItem> ItemList){
this.context = context;
this.ItemList = ItemList;
this.requestBuilder = Glide.with(context)
.using(Glide.buildStreamModelLoader(Uri.class, context), InputStream.class)
.from(Uri.class)
.as(SVG.class)
.transcode(new SvgDrawableTranscoder(), PictureDrawable.class)
.sourceEncoder(new StreamEncoder())
.cacheDecoder(new FileToStreamDecoder<>(new SvgDecoder()))
.decoder(new SvgDecoder())
.animate(android.R.anim.fade_in)
.listener(new SvgSoftwareLayerSetter<Uri>());
Uri uri = Uri.parse(ItemList .get(position).getUrl());
requestBuilder
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.load(uri)
.into(holder.image);
public class SvgSoftwareLayerSetter<T> implements RequestListener<T, PictureDrawable> {
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
ImageView view = ((ImageViewTarget<?>) target).getView();
Glide.with(view.getContext())
.load(R.drawable.ic_launcher_background)
.into(view);
return false;
}
@Override
public boolean onResourceReady(PictureDrawable resource, T model, Target<PictureDrawable> target,
boolean isFromMemoryCache, boolean isFirstResource) {
ImageView view = ((ImageViewTarget<?>) target).getView();
if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
}
return false;
}
}
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource){
ImageView view = ((ImageViewTarget<?>) target).getView();
Glide.with(view.getContext())
.load(R.drawable.ic_launcher_background)
.into(view);
return false;
}
@Override
public boolean onException(Exception e, T model, Target<PictureDrawable> target, boolean isFirstResource) {
ImageView view = ((ImageViewTarget<?>) target).getView();
if (Build.VERSION_CODES.HONEYCOMB <= Build.VERSION.SDK_INT) {
view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
}
Glide.with()
.load()
.into(view);
return false;
}