Cannot add FFImageLoading

Sounds like dummy question, but I cannot enable this library. I tried, but it doesn't work.
My steps:
1. I've added via nuget FFImageLoading package to pcl and droid.
2. I've added "CachedImageRenderer.Init();" to MainActivity
3. Change Image to CachedImage in ViewCell in c#
Thats all, but it not works.

Answers

  • arroyosarroyos MYMember

    Hi Igor Levkivskiy,

    When you say its not working you mean the image not loaded ? If yes did you try to hardcode the cachedImage source to some URL just to test if it can load ?

  • IgorLevkivskiyIgorLevkivskiy USMember ✭✭

    @arroyos said:
    Hi Igor Levkivskiy,

    When you say its not working you mean the image not loaded ? If yes did you try to hardcode the cachedImage source to some URL just to test if it can load ?

    Image loaded and dispalyed but not work any properties of CachedImage:
    var postImage1_0 = new CachedImage { Aspect = Aspect.AspectFit, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FadeAnimationEnabled = true,//doesn't work DownsampleHeight = 200,// doesn't work LoadingPlaceholder = "https://upload.wikimedia.org/wikipedia/commons/b/b1/Loading_icon.gif",//doesn't work Source = model.Images[0] };

    Also doesn't work in android renderer ImageService.Instance.SetPauseWork(true); where I want stop download image by url

    listView.ScrollStateChanged += (object sender, AbsListView.ScrollStateChangedEventArgs scrollArgs) => { switch (scrollArgs.ScrollState) { case ScrollState.Fling: ImageService.Instance.SetPauseWork(true); // all image loading requests will be silently canceled break; case ScrollState.Idle: ImageService.Instance.SetPauseWork(true); //all image loading requests will be silently canceled break; case ScrollState.TouchScroll: ImageService.Instance.SetPauseWork(true); // all image loading requests will be silently canceled break; } };

  • arroyosarroyos MYMember

    Try loading local image for your loading placeholder image. I did not try before on FadeAnimation properties. However my downsample height properties seems working. How do you verify the down sample is not working ?

    My sample code:

    casePrimaryPicture = new CachedImage() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, WidthRequest = 100, HeightRequest = 100, CacheDuration = TimeSpan.FromDays(5), DownsampleWidth = 100, Aspect = Aspect.AspectFill, RetryCount = 3, RetryDelay = 250, TransparencyEnabled = false, ErrorPlaceholder = "icon.png", LoadingPlaceholder = "placeholder.jpg", Source = "", };

  • IgorLevkivskiyIgorLevkivskiy USMember ✭✭

    @arroyos said:
    Try loading local image for your loading placeholder image. I did not try before on FadeAnimation properties. However my downsample height properties seems working. How do you verify the down sample is not working ?

    My sample code:

    casePrimaryPicture = new CachedImage() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, WidthRequest = 100, HeightRequest = 100, CacheDuration = TimeSpan.FromDays(5), DownsampleWidth = 100, Aspect = Aspect.AspectFill, RetryCount = 3, RetryDelay = 250, TransparencyEnabled = false, ErrorPlaceholder = "icon.png", LoadingPlaceholder = "placeholder.jpg", Source = "", };

    Good news, properties work with local images, but next problem ImageService.Instance.SetPauseWork(true);
    All images in all listview items - about 100 images downloaded at once, how to downloaded images only in visible items?

  • DanielLDanielL PLInsider ✭✭✭✭

    @IgorLevkivskiy By combining imageLoadingTask.Cancel(), with cachedImage.Reload() and ListView's ItemAppearing / ItemDissapearing events.

  • batmacibatmaci DEMember ✭✭✭✭

    I dont really understand how can we use listView.ScrollStateChanged in xamarin forms listview. it looks like ScrollStateChanged is defined only in native android listview. What is the solution xamarin forms please?

  • NickKovalskyNickKovalsky USMember ✭✭

    To create a custom renderer for your Forms customlistview and detect scrollchanged there..

Sign In or Register to comment.