Skip to content

Glide 4.9.0

Compare
Choose a tag to compare
@sjudd sjudd released this 14 Feb 20:53
· 670 commits to master since this release

Features

  • Allow applying RequestOptions directly in a RequestBuilder without the generated API (ed20643)

For example previously to apply centerCrop you'd have use a static method and apply():

Glide.with(fragment)
   .load(url)
   .apply(centerCropTransform())
   .into(imageView);

Or use the generated API and the annotation processor:

GlideApp.with(fragment)
   .load(url)
  .centerCrop()
  .into(imageView);

After this change, even without the generated API/annotation processor you can access standard RequestOptions methods directly:

Glide.with(fragment)
  .load(url)
  .centerCrop()
  .into(imageView);

The generated API is still required for API extensions and to include integration libraries. Hopefully this makes it easier for users who do not include integration libraries and for developers of libraries that are currently unable to use the generated API to use Glide.

  • Add Global/Activity/Fragment scoped RequestListeners (37127f0)
  • Add a CustomTarget class to make it easier to reduce some non-essential boilerplate when implementing custom Targets. onLoadCleared still must be implemented by subclasses of CustomTarget (b3b2d7a)
  • Support loading resources from dynamic modules (#3308, b57ef34, thanks to @SUPERCILEX)
  • Add a varargs .transform() method to replace the equivalent .transforms() method (#2875, #3365, 8a26a6b, thanks to @aleien)
  • Make proguard rules consumable by users of the library (f7d8604, thanks to @rehlma)
  • Stop forcing all requests to be posted to the main thread to avoid unnecessary UI thread work and avoid delays caused by UI thread processing time for images loaded on background threads (8f1ea5c)
  • Add Animatable2Compat callbacks to GifDrawable so that users can be notified when a GIF animation with a non infinite loop count finishes (#3438, a150301, thanks to @AnwarShahriar)

Bugs

  • Fixed an issue where different types of requested resources (Bitmap vs Drawable etc) could share a cache key (cad83d2)
  • Work around an odd compiler bug creating new ArrayLists from other collections on some devices/versions of Android (#3296, 2ca790a)
  • Add Nullable/NonNull annotations to LazyHeaders.Builder (#3446, d6345fb, thanks to @r-ralph)
  • Add a transformation to rotate images (other than from EXIF) (1878585, thanks to @Gnzlt)
  • Fix a race that could lead to doing useless work in MultiModelLoader after cancellation (3c9f92f)
  • Fix a bug in SizeConfigStrategy that could lead to a returned Bitmap having an incorrect config (be51b4e)
  • Avoid classifying all images with non-0 exif orientations as having transparency to allow them to be cached as JPEGs instead of PNGs (e515f47)
  • Add a debug API that allows apps to attach a stack trace showing where a Glide request originated from. Note that this is fairly expensive and isn't meant to be used in production (114b885)
  • Fix bugs handling resource Uris that point to resources in other applications (e2df4d0)

Deprecations

  • Deprecated .transforms(), it's replaced with the identical .transform() method (8a26a6b)

Behavior Changes

  • RequestListeners for requests started on background threads can now be called on a background thread (8f1ea5c)

Breaking Changes

  • Subclasses of RequestBuilder/RequestOptions may be broken by ed20643. Typically the breakage is relatively simple to fix, but the exact methods that need to be called or that are exposed may have changed for subclasses.

Build Changes

  翻译: