public static void SetupImage(Context context, ImageView imageView, LibraryObject libraryObject, int position) { imageView.SetTag(imageView.Id, libraryObject.getUrl()); //imageView.SetOnClickListener(mOnImageClickListener); /* * Glide.With(context) * .Load(position == -1 ? libraryObject.getImage() : libraryObject.getImages()[position]). * .asBitmap() * .centerCrop() * .listener(new RequestListener<String, Bitmap>() { * @Override * public boolean onException(final Exception e, final String model, final Target<Bitmap> target, final boolean isFirstResource) * { * return false; * } * * @Override * public boolean onResourceReady(final Bitmap resource, final String model, final Target<Bitmap> target, final boolean isFromMemoryCache, final boolean isFirstResource) * { * final ImageViewTarget imageViewTarget = (ImageViewTarget)target; * return new DrawableCrossFadeFactory<>() * .build(isFromMemoryCache, isFirstResource) * .animate( * new BitmapDrawable( * imageViewTarget.getView().getResources(), * resource * ), * imageViewTarget * ); * } * }) * .into(imageView);*/ }
public static void SetupImage(Context context, ImageView imageView, LibraryObject libraryObject, int position) { imageView.SetTag(imageView.Id, libraryObject.getUrl()); imageView.SetOnClickListener(new mOnImageClickListener()); //Will load the images, but is quite slow Glide.With(context) .Load(position == -1 ? libraryObject.getImage() : libraryObject.getImages()[position]) .CenterCrop() .DiskCacheStrategy(DiskCacheStrategy.Source) //.Listener(new RequestListener()) .Into(imageView); }