Custom ViewTarget - luberda-molinet/FFImageLoading GitHub Wiki

Example add a custom target for the custom view.

Views

SubsamplingScaleImageView

SubsamplingScaleImageView - A custom image view for Android, designed for photo galleries and displaying huge images.

using FFImageLoading.Drawables;
using FFImageLoading.Targets;
using FFImageLoading.Work;

namespace FFDroidTargetDemo
{
    using Com.Davemorrissey.Labs.Subscaleview;

    public class SubsamplingScaleImageViewTarget
        : ViewTarget<SubsamplingScaleImageView>
    {
        public SubsamplingScaleImageViewTarget(
            SubsamplingScaleImageView imageView)
            : base(imageView)
        {
        }

        public override void Set(
            IImageLoaderTask task,
            SelfDisposingBitmapDrawable image,
            bool animated)
        {
            var source = ImageSource.ForBitmap(image.Bitmap);
            Control.SetImage(source);
        }
    }
}

Using

var target = new SubsamplingScaleImageViewTarget(_imageView);

ImageService.Instance
    .LoadUrl("image-url")
    .IntoAsync(target);