Package 

Class GlideImage

  • All Implemented Interfaces:

    
    public final class GlideImage
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • GlideImage

         final static Unit GlideImage(Function0<Object> imageModel, Modifier modifier, GlideRequestType glideRequestType, Function0<RequestBuilder<?>> requestBuilder, Function0<RequestOptions> requestOptions, Function0<RequestListener<Object>> requestListener, ImageComponent component, ImageOptions imageOptions, Function1<GlideImageState, Unit> onImageStateChanged, @DrawableRes() Integer previewPlaceholder, Function2<BoxScope, GlideImageState.Loading, Unit> loading, Function2<BoxScope, GlideImageState.Success, Unit> success, Function2<BoxScope, GlideImageState.Failure, Unit> failure)

        Load and render an image with the given imageModel from the network or local storage.

        GlideImage(
        imageModel = { imageUrl },
        requestBuilder = {
         Glide
          .with(LocalContext.current)
          .asBitmap()
          .apply(RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
          .thumbnail(0.6f)
          .transition(withCrossFade())
        },
        modifier = modifier,
        loading = {
          Box(modifier = Modifier.matchParentSize()) {
            CircularProgressIndicator(
               modifier = Modifier.align(Alignment.Center)
            )
          }
        },
        failure = {
          Text(text = "image request failed.")
        })
        Parameters:
        imageModel - The data model to request image.
        modifier - Modifier used to adjust the layout or drawing content.
        glideRequestType - Glide image request type, which decides the result of image data.
        requestBuilder - Most options in Glide can be applied directly on the RequestBuilder object returned by Glide.with().
        requestOptions - Provides type independent options to customize loads with Glide.
        requestListener - A class for monitoring the status of a request while images load.
        component - An image component that conjuncts pluggable ImagePlugins.
        imageOptions - Represents parameters to load generic Image Composable.
        onImageStateChanged - An image state change listener will be triggered whenever the image state is changed.
        previewPlaceholder - Drawable resource ID which will be displayed when this function is ran in preview mode.
        loading - Content to be displayed when the request is in progress.
        success - Content to be displayed when the request is succeeded.
        failure - Content to be displayed when the request is failed.