luberda-molinet / FFImageLoading

Image loading, caching & transforming library for Xamarin and Windows
MIT License
1.42k stars 377 forks source link

Android XML vector drawables support #1128

Open ddobrev opened 6 years ago

ddobrev commented 6 years ago

Image in Xamarin.Forms supports specifying a source without an extension. This picks up .xml on Android (vector drawables) and .pdf on iOS. It lacks downsampling and this is why I tried FFImageLoading but I cannot use it because of this bug.

fedemkr commented 6 years ago

I'm not sure which is your bug but I'm able to load a *.pdf on iOS using ffimageloading:CachedImage in Source and even in LoadingPlaceholder and ErrorPlaceholder. Take into account that this is only available on iOS >= 9.0

ddobrev commented 6 years ago

@fedemkr this is good but how about Android vector drawables?

fedemkr commented 6 years ago

No, that doesn't work yet (I haven't tested with FFImageLoading.SVG but AFAIK it works only with *.svg files).

E.g. If you attemp to load one Android vector drawable named ic_document_history it throws:

Image loading failed: ic_document_history.xml;157x0
System.BadImageFormatException: Not a valid bitmap
  at FFImageLoading.PlatformImageLoaderTask`1[TImageView].GenerateImageFromDecoderContainerAsync (FFImageLoading.IDecodedImage`1[TNativeImageContainer] decoded, FFImageLoading.Work.ImageInformation imageInformation, System.Boolean isPlaceholder) [0x000a8] in C:\projects\ffimageloading\source\FFImageLoading.Droid\Work\PlatformImageLoadingTask.cs:215 
  at FFImageLoading.Work.ImageLoaderTask`3+<GenerateImageAsync>d__104[TDecoderContainer,TImageContainer,TImageView].MoveNext () [0x002c4] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:307 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <4d6eb5dfe2ab4eee884ef920069afd5f>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <4d6eb5dfe2ab4eee884ef920069afd5f>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <4d6eb5dfe2ab4eee884ef920069afd5f>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <4d6eb5dfe2ab4eee884ef920069afd5f>:0 
  at FFImageLoading.Work.ImageLoaderTask`3+<RunAsync>d__109[TDecoderContainer,TImageContainer,TImageView].MoveNext () [0x004ae] in C:\projects\ffimageloading\source\FFImageLoading.Common\Work\ImageLoaderTask.cs:588 
ddobrev commented 6 years ago

This is quite unfortunate. Is this feature planned?

fedemkr commented 6 years ago

There is another issue that was discussing Android XML Support. Please check #891

ddobrev commented 6 years ago

Thank you. So, is #891 going to be fixed and when, please? I can see there's a PR to it, is there any reason it isn't merged?

daniel-luberda commented 6 years ago

There was a PR with vector support https://github.com/luberda-molinet/FFImageLoading/issues/891

but there were some changes in codebase since, anyone want to merge it?

LennoxP90 commented 5 years ago

I think this feature should still be added it looks like the PR was cancelled due to Xamarin.Forms base image handling it but Xamarin Forms Image Control does not cache the image and i would like to utilize best of both worlds.