glidex.forms 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package glidex.forms --version 1.0.3
NuGet\Install-Package glidex.forms -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="glidex.forms" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add glidex.forms --version 1.0.3
#r "nuget: glidex.forms, 1.0.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install glidex.forms as a Cake Addin
#addin nuget:?package=glidex.forms&version=1.0.3

// Install glidex.forms as a Cake Tool
#tool nuget:?package=glidex.forms&version=1.0.3

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
Product Versions
MonoAndroid monoandroid81
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (5)

Showing the top 5 popular GitHub repositories that depend on glidex.forms:

Repository Stars
jamesmontemagno/MediaPlugin
Take & Pick Photos and Video Plugin for Xamarin and Windows
jamesmontemagno/Hanselman.Forms
The most awesome Hanselman app
roubachof/Xamarin-Forms-Practices
Collection of good practices for Xamarin forms developement
o1298098/Xamarin-CloudMusic
Xamarin.Forms goodlooking UI sample
roubachof/Sharpnado.CollectionView
A performant list view supporting: grid, horizontal and vertical layout, drag and drop, and reveal animations.
Version Downloads Last updated
2.1.1.648 26,853 10/12/2021
2.1.0.470 119,397 7/7/2020
2.0.1.394 41,462 1/12/2020
2.0.0.336 5,639 9/24/2019
2.0.0-pre1 579 6/23/2019
1.0.4 11,221 2/15/2019
1.0.3 5,087 10/30/2018
1.0.3-pre 557 10/15/2018
1.0.2 979 8/19/2018
1.0.1 864 7/12/2018
1.0.0 1,040 3/16/2018
0.1.0-beta 756 3/2/2018