-
public final class GlideImageKt
-
-
Method Summary
Modifier and Type Method Description final static UnitGlideImage(Object model, String contentDescription, Modifier modifier, Alignment alignment, ContentScale contentScale, Float alpha, ColorFilter colorFilter, Placeholder loading, Placeholder failure, Function1<RequestBuilder<Drawable>, RequestBuilder<Drawable>> requestBuilderTransform)Start a request by passing model to RequestBuilder.load using the given requestManager and then applying the requestBuilderTransform function to add options or apply mutations if the caller desires. final static Placeholderplaceholder(Drawable drawable)Used to specify a Drawable to use in conjunction with GlideImage's loadingorfailureparameters.final static Placeholderplaceholder(@DrawableRes() Integer resourceId)Used to specify a resource id to use in conjunction with GlideImage's loadingorfailureparameters.final static Placeholderplaceholder(Function0<Unit> composable)Used to specify a Composable function to use in conjunction with GlideImage's loadingorfailureparameter.-
-
Method Detail
-
GlideImage
@Composable() final static Unit GlideImage(Object model, String contentDescription, Modifier modifier, Alignment alignment, ContentScale contentScale, Float alpha, ColorFilter colorFilter, Placeholder loading, Placeholder failure, Function1<RequestBuilder<Drawable>, RequestBuilder<Drawable>> requestBuilderTransform)
Start a request by passing model to RequestBuilder.load using the given requestManager and then applying the requestBuilderTransform function to add options or apply mutations if the caller desires.
alignment, contentScale, alpha, colorFilter and contentDescription have the same defaults (if any) and function identically to the parameters in Image.
If you want to restrict the size of this Composable, use the given modifier. If you'd like to force the size of the pixels you load to be different than the display area, use RequestBuilder.override. Often you can get better performance by setting an explicit size so that we do not have to wait for layout to fetch the image. If the size set via the modifier is dependent on the content, Glide will probably end up loading the image using com.bumptech.glide.request.target.Target.SIZE_ORIGINAL. Avoid
SIZE_ORIGINAL, implicitly or explicitly if you can. You may end up loading a substantially larger image than you need, which will increase memory usage and may also increase latency.If you provide your own requestManager rather than using this method's default, consider using remember at a higher level to avoid some amount of overhead of retrieving it each re-composition.
This method will inspect contentScale and apply a matching transformation if one exists. Any automatically applied transformation can be overridden using requestBuilderTransform. Either apply a specific transformation instead, or use RequestBuilder.dontTransform]
Transitions set via RequestBuilder.transition are currently ignored.
Note - this method is likely to change while we work on improving the API. Transitions are one significant unexplored area. It's also possible we'll try and remove the RequestBuilder from the direct API and instead allow all options to be set directly in the method.
requestBuilderTransform is overridden by any overlapping parameter defined in this method if that parameter is non-null. For example, loading and failure, if non-null will be used in place of any placeholder set by requestBuilderTransform using RequestBuilder.placeholder or RequestBuilder.error.
- Parameters:
loading- A Placeholder that will be displayed while the request is loading.failure- A Placeholder that will be displayed if the request fails.
-
placeholder
final static Placeholder placeholder(Drawable drawable)
Used to specify a Drawable to use in conjunction with GlideImage's
loadingorfailureparameters.Ideally drawable is non-null, but because android.content.Context.getDrawable can return null, we allow it here.
placeholder(null)has the same override behavior as if a non-nullDrawablewere provided.
-
placeholder
final static Placeholder placeholder(@DrawableRes() Integer resourceId)
-
placeholder
final static Placeholder placeholder(Function0<Unit> composable)
Used to specify a Composable function to use in conjunction with GlideImage's
loadingorfailureparameter.Providing a nested GlideImage is not recommended. Use RequestBuilder.thumbnail or RequestBuilder.error as an alternative.
-
-
-
-