glidex.forms 1.0.3

A library containing Xamarin.Forms custom renderers to speed up images on Android. Based on Glide. Just add Android.Glide.Forms.Init(); after Xamarin.Forms.Forms.Init();

Install-Package glidex.forms -Version 1.0.3
dotnet add package glidex.forms --version 1.0.3
paket add glidex.forms --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

glidex and glidex.forms

glidex is a minimalist Xamarin.Android binding of Glide. Google recommends Glide for simplifying the complexity of managing Android.Graphics.Bitmap within your apps (docs here).

glidex.forms is a prototype of what we can do to improve Xamarin.Forms image performance on Android by taking a dependency on Glide. See my post on the topic here.

We don't want or care to bind the entirety of Glide's public API surface. Our goal here is to just bind the "useful" APIs for Glide.

For example take the following C#:

var image = FindViewById<ImageView> (Resource.Id.testImage);
Glide.With (this)
    .Load ("https://botlist.co/system/BotList/Bot/logos/000/002/271/medium/chuck_norris.jpg")
    .Apply (RequestOptions.CircleCropTransform ().Placeholder (Android.Resource.Drawable.IcMenuCamera))
    .Into (image);

This code loads an image from a URL dynamically, taking care of all of Glide's cool caching functionality. These are the only APIs we need to make the library useful.

If you have a "classic" Xamarin.Android app that is not Xamarin.Forms, it could be useful to use the glidex NuGet package directly.

glidex is currently using the 4.7.0 release of Glide from Github

glidex.forms for Xamarin.Forms on Android

My goal with this repo is to get fast Images for Xamarin.Forms on Android by using Glide.

The new IImageViewHandler API in Xamarin.Forms 3.3.x, allows glidex.forms to operate without using any custom renderers!

But to set this library up in your existing project, merely:

  • Add the glidex.forms NuGet package
  • Add this one liner after your app's Forms.Init call:
Xamarin.Forms.Forms.Init (this, bundle);
//This forces the custom renderers to be used
Android.Glide.Forms.Init ();
LoadApplication (new App ());

How do I know my app is using Glide?

On first use, you may want to enable debug logging:

Android.Glide.Forms.Init (debug: true);

glidex.forms will print out log messages in your device log as to what is happening under the hood.

If you want to customize how Glide is used in your app, currently your option is to implement your own IImageViewHandler. See the GlideExtensions class for details.

Features

In my samples, I tested the following types of images:

  • ImageSource.FromFile with a temp file
  • ImageSource.FromFile with AndroidResource
  • ImageSource.FromResource with EmbeddedResource
  • ImageSource.FromUri with web URLs
  • ImageSource.FromStream with AndroidAsset

glidex and glidex.forms

glidex is a minimalist Xamarin.Android binding of Glide. Google recommends Glide for simplifying the complexity of managing Android.Graphics.Bitmap within your apps (docs here).

glidex.forms is a prototype of what we can do to improve Xamarin.Forms image performance on Android by taking a dependency on Glide. See my post on the topic here.

We don't want or care to bind the entirety of Glide's public API surface. Our goal here is to just bind the "useful" APIs for Glide.

For example take the following C#:

var image = FindViewById<ImageView> (Resource.Id.testImage);
Glide.With (this)
    .Load ("https://botlist.co/system/BotList/Bot/logos/000/002/271/medium/chuck_norris.jpg")
    .Apply (RequestOptions.CircleCropTransform ().Placeholder (Android.Resource.Drawable.IcMenuCamera))
    .Into (image);

This code loads an image from a URL dynamically, taking care of all of Glide's cool caching functionality. These are the only APIs we need to make the library useful.

If you have a "classic" Xamarin.Android app that is not Xamarin.Forms, it could be useful to use the glidex NuGet package directly.

glidex is currently using the 4.7.0 release of Glide from Github

glidex.forms for Xamarin.Forms on Android

My goal with this repo is to get fast Images for Xamarin.Forms on Android by using Glide.

The new IImageViewHandler API in Xamarin.Forms 3.3.x, allows glidex.forms to operate without using any custom renderers!

But to set this library up in your existing project, merely:

  • Add the glidex.forms NuGet package
  • Add this one liner after your app's Forms.Init call:
Xamarin.Forms.Forms.Init (this, bundle);
//This forces the custom renderers to be used
Android.Glide.Forms.Init ();
LoadApplication (new App ());

How do I know my app is using Glide?

On first use, you may want to enable debug logging:

Android.Glide.Forms.Init (debug: true);

glidex.forms will print out log messages in your device log as to what is happening under the hood.

If you want to customize how Glide is used in your app, currently your option is to implement your own IImageViewHandler. See the GlideExtensions class for details.

Features

In my samples, I tested the following types of images:

  • ImageSource.FromFile with a temp file
  • ImageSource.FromFile with AndroidResource
  • ImageSource.FromResource with EmbeddedResource
  • ImageSource.FromUri with web URLs
  • ImageSource.FromStream with AndroidAsset

Version History

Version Downloads Last updated
1.0.3 555 10/30/2018
1.0.3-pre 85 10/15/2018
1.0.2 251 8/19/2018
1.0.1 140 7/12/2018
1.0.0 193 3/16/2018
0.1.0-beta 131 3/2/2018