Open ysmoradi opened 4 years ago
yea @ysmoradi so I think the fix here would be to modify GetFormsBitmapAsync
to also use both interfaces like the ImageViewExtensions does
Or fix GetFormsBitmapAsync
to use ImageviewExtensions so everything is piped through the same method
Description
If I got things rights, we've two interfaces to provide custom image loading in xamarin forms
1- IImageViewHandler which gets called for every Image & ImageButton 2- IImageSourceHandler which gets called for ImagesSources in TabbedPage toolbar items, page backgrounds, page icons etc.
IImageViewHandler gets called for every Image/ImageButton I've, so it works as expected.
IImageSourceHandler gets called only for UriImageSources, and if I provide FileImageSource or StreamImage to page's background as an example, xf will load thoes images directly on its own! This makes custom solutions such as GlideX.Forms & FFImageLoadingHandlers less performant )-: And even worse, if I use glidex to load toolbar item icon as an example from protected web service, the code I've which adds required request headers to glidex request won't get called )-:
First of all, I need someone in XF team to tell me how much correct I've got things right, because these interfaces are internal things and are not well documented.
Steps to Reproduce
NavigationPage.TitleIconImageSource="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
to MainPage.xaml, and ImageSourceHandler's implementation gets called correctly
Note that I've registred my custom IImageSourceHandler for Uri/File/Stream image sources.
Expected Behavior
I think the nice solution would be using IImageViewHandler in all situations, but at least, I'd like to see IImageSourceHandler's method gets called for all image sources.
Actual Behavior
IImageSourceHandler's LoadImageAsync method gets called for UriImageSources. I think there's nothing hard coded about UriImageSource(!) XF tries to load the image source itself, and after the failure, it calls provided custom IImageSourceHandler. For example if you provide some-missing-photo.png as a page icon which does not exists in android project, the provided IImageSourceHandler gets called! But if you provide icon.png, XF won't pay attention to provided custom IImageSourceHandler because xf itself can load the picture (even in a non performant way in comparision with glide)
Basic Information
Screenshots
N/A
Reproduction Link
N/A
Workaround
N/A