glide v4.4.0 Release Notes
Release Date: 2017-12-04 // over 6 years ago-
๐ This is the November release of Glide.
๐ Features
- โก๏ธ Updated Glide's generated API to allow RequestOptions return values and avoid a bunch of
@CheckResult
warnings (e78f2ee, 7fccb32) - Enabled cache sizes >
Integer.MAX_VALUE
(d402780, thanks to @bhargavms) โ Added an API to
ViewTarget
calledclearOnDetach()
that allows you to optionally clear and restart requests when the corresponding view is detached and reattached to its window (#2520, d0fd967):Glide.with(fragment) .load(url) .into(imageView) .clearOnDetach();
โ Added an API to
ViewTarget
calledwaitForLayout()
that simplifies the previous mechanism for forcing Glide'sViewTargets
to wait for a layout pass before determining the size of the view they wrap (05b8854):Glide.with(fragment) .load(url) .into(imageView) .waitForLayout();
โ Added a MockGlideExecutor that could be used as part of a future testing compat library (6cee6d2, thanks to azlatin@)
โ Added an API to specify a custom executor to use when decoding GIF frames (6837543)
๐ Bugs
- ๐ Improved trimming behavior with inconsistent resource sizes (#2550, thanks to @unverbraucht)
- ๐ Fixed overly aggressive escaping of some valid characters in http urls (#2583, 014bf44)
- โ Added a direct dependency on support-fragment in Glide's pom (#2547, c1c9be2)
- ๐ Fixed an issue where dereferencing a
Target
without clearing it would result in the loaded resource never being returned to Glide's memory cache (#2560, 0209662, 7e317c0) - ๐ Fixed an IllegalStateException when
RequestManagers
are memoized and then used to start a new load afteronDestroy
of the correspondingActivity
orFragment
(#2262, 8119837) - ๐ Fixed an NPE when using GifDrawables as thumbnails due to a bug that can fail to clear thumbnails in
onStop()
(#2555, 9c82c42) - ๐ Fixed a
SecurityException
on some devices when trying to register a connectivity receiver (#1417, 6bc908b) - ๐ Fixed a
SecurityException
on some devices when trying to obtain connectivity status (#1405, bcd6cc2) - ๐ Fixed a couple of cases where
GifDrawable
s could continue to animate afterclear()
oronStop()
(#1087, 3dad449, 9d87dea) - ๐ Improved decode times for GIF frames on earlier versions of ART and some lower end devices by up to 40% (#2471, e7a4942, fa2ebfe, 7c0cd63, 4db20db, 65e5506)
- Eliminated a few unnecessary object allocations in Glide's request path (b4d778b)
- ๐ Fixed an issue on some devices where
ExternalPreferredCacheDiskCacheFactory.java
might attempt (and fail) to use external storage if the external storage directory exists but isn't writable (#2641, 5580e51, thanks to @ANPez) - Ensure that requests started with
onlyRetrieveFromCache
don't block on already running equivalent requests that aren't usingonlyRetrieveFromCache
(#2428, 108a062) - ๐ Fixed a couple of cases where calling
load(Bitmap)
orload(Drawable)
could cause Glide to re-use or recycle the givenBitmap
orDrawable
(cff4f2c). - ๐ Fixed a bug where the disk cache could become unusable until apps are restarted if the system clears the cache directory while the app is open and the app calls
DiskCache.clear()
(#2465, 16eaa9b). - ๐ Fix a crash attempting to log a recycled Bitmap's size in Glide's
BitmapPool
pre-filling APIs (#2574, 7387298) - ๐ Fixed an error log "Expected to receive an object of but instead got null" when restarting requests with thumbnails where the thumbnail previously completed after the full request (a1e3fa2)
- ๐ Fixed a compilation error when compiling with
kapt
and-Dkotlin.compiler.execution.strategy="in-process"
while using aGlideModule
with the@Excludes
annotation.
Behavior Changes
Resources loaded into Targets outside of Activity/Fragment lifecycles (ie with the Application Context) will be returned to Glide's caches via a
WeakReference
andReferenceQueue
if theTarget
s are dereferenced without being cleared. Previously dereferencing these Targets would simply allow the underlying resource to be garbage collected, which could lead to unexpected cache misses (#2560). Transient memory usage may increase for applications that regularly dereference Targets without clearing them as the resources are now re-captured instead of being immediately and unexpectedly garbage collected.๐ง To disable this behavior, in an AppGlideModule, call setIsActiveResourceRetentionAllowed:
@Overridepublic void applyOptions(Context context, GlideBuilder builder) { builder.setIsActiveResourceRetentionAllowed(false); }
Glide.with(fragment).load()
andGlide.with(fragment).asDrawable().load()
now behave identically. PreviouslyGlide.with(fragment).asDrawable().load()
would apply some specific options based on the type of the model provided toload()
, butGlide.with(fragment).load()
would not. Now both behave identically (8613292).Calling
RequestBuilder.load(byte[])
will no longer override previously setDiskCacheStrategy
andskipMemoryCacheOptions
options (c7b7dfe).๐ฅ Breaking Changes
โ The
RequestManager.load(Object)
method has been augmented with the same type specific overloads that are available onRequestBuilder
. Unfortunately this may break some tests that mock the return value ofRequestManager.load()
. Typically those breakages can be resolved by casting:when(requestManager.load((Object) any())).thenReturn(requestBuilder);
โ Or if you're passing in
null
as your model in your tests:when(requestManager.load((Object) null)).thenReturn(requestBuilder);
Or if you have a specific type for your model:
when(requestManager.load(any(Uri.class))).thenReturn(requestBuilder);
โ Or if your test has a specific type, but your production code uses an Object:
// In tests:String url = ... when(requestManager.load((Object) eq(url))).thenReturn(requestBuilder); // In prod code:Object url = ... requestManager.load(url).into(imageView);
๐ Deprecations
- ๐ Deprecated void return values for
@GlideOption
and@GlideType
annotated methods (e78f2ee, 7fccb32) - ๐ Deprecated
DiskLruCacheWrapper.get()
in favor of a static factory method (1cfc4af) - ๐ Deprecated
setResizeExecutor()
inGlideBuilder
in favor ofsetSourceExecutor()
(6837543) - ๐ Deprecated
ArrayPool.put(Array, Class<Array>)
in favor ofArrayPool.put(Array)
(b4d778b) - ๐ Deprecated the constructor in
ViewTarget
that accepts a booleanwaitForLayout
parameter in favor of thewaitForLayout()
method onViewTarget
(05b8854).
- โก๏ธ Updated Glide's generated API to allow RequestOptions return values and avoid a bunch of