Package 

Class ImagePipeline


  • @ThreadSafe() 
    public class ImagePipeline
    
                        

    The entry point for the image pipeline.

    • Method Detail

      • getDataSourceSupplier

         Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel requestLevel)

        Returns a DataSource supplier that will on get submit the request for execution and return aDataSource representing the pending results of the task.

        Parameters:
        imageRequest - the request to submit (what to execute).
        callerContext - the caller context of the caller of data source supplier
        requestLevel - which level to look down until for the image
      • getDataSourceSupplier

         Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel requestLevel, @Nullable() RequestListener requestListener)

        Returns a DataSource supplier that will on get submit the request for execution and return aDataSource representing the pending results of the task.

        Parameters:
        imageRequest - the request to submit (what to execute).
        callerContext - the caller context of the caller of data source supplier
        requestLevel - which level to look down until for the image
        requestListener - additional image request listener independent of ImageRequest listeners
      • getDataSourceSupplier

         Supplier<DataSource<CloseableReference<CloseableImage>>> getDataSourceSupplier(ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel requestLevel, @Nullable() RequestListener requestListener, @Nullable() String uiComponentId)

        Returns a DataSource supplier that will on get submit the request for execution and return aDataSource representing the pending results of the task.

        Parameters:
        imageRequest - the request to submit (what to execute).
        callerContext - the caller context of the caller of data source supplier
        requestLevel - which level to look down until for the image
        requestListener - additional image request listener independent of ImageRequest listeners
        uiComponentId - optional UI component ID requesting the image
      • getEncodedImageDataSourceSupplier

         Supplier<DataSource<CloseableReference<PooledByteBuffer>>> getEncodedImageDataSourceSupplier(ImageRequest imageRequest, @Nullable() Object callerContext)

        Returns a DataSource supplier that will on get submit the request for execution and return aDataSource representing the pending results of the task.

        Parameters:
        imageRequest - the request to submit (what to execute).
      • fetchImageFromBitmapCache

         DataSource<CloseableReference<CloseableImage>> fetchImageFromBitmapCache(ImageRequest imageRequest, @Nullable() Object callerContext)

        Submits a request for bitmap cache lookup.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
      • fetchDecodedImage

         DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(@Nullable() ImageRequest imageRequest, @Nullable() Object callerContext)

        Submits a request for execution and returns a DataSource representing the pending decodedimage(s).

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
      • fetchDecodedImage

         DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(ImageRequest imageRequest, @Nullable() Object callerContext, @Nullable() RequestListener requestListener)

        Submits a request for execution and returns a DataSource representing the pending decodedimage(s).

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
        requestListener - additional image request listener independent of ImageRequest listeners
      • fetchDecodedImage

         DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(@Nullable() ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit)

        Submits a request for execution and returns a DataSource representing the pending decodedimage(s).

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
        lowestPermittedRequestLevelOnSubmit - the lowest request level permitted for image request
      • fetchDecodedImage

         DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(@Nullable() ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit, @Nullable() RequestListener requestListener)

        Submits a request for execution and returns a DataSource representing the pending decodedimage(s).

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
        lowestPermittedRequestLevelOnSubmit - the lowest request level permitted for image reques
        requestListener - additional image request listener independent of ImageRequest listeners
      • fetchDecodedImage

         DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(@Nullable() ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit, @Nullable() RequestListener requestListener, @Nullable() String uiComponentId)

        Submits a request for execution and returns a DataSource representing the pending decodedimage(s).

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
        lowestPermittedRequestLevelOnSubmit - the lowest request level permitted for image reques
        requestListener - additional image request listener independent of ImageRequest listeners
        uiComponentId - optional UI component ID that is requesting the image
      • fetchDecodedImage

         DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(ImageRequest imageRequest, @Nullable() Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevelOnSubmit, @Nullable() RequestListener requestListener, @Nullable() String uiComponentId, @Nullable() Map<String, out Object> extras)

        Submits a request for execution and returns a DataSource representing the pending decodedimage(s).

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
        callerContext - the caller context for image request
        lowestPermittedRequestLevelOnSubmit - the lowest request level permitted for image reques
        requestListener - additional image request listener independent of ImageRequest listeners
        uiComponentId - optional UI component ID that is requesting the image
        extras - optional extra data
      • fetchEncodedImage

         DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(ImageRequest imageRequest, @Nullable() Object callerContext)

        Submits a request for execution and returns a DataSource representing the pending encodedimage(s).

        The ResizeOptions in the imageRequest will be ignored for this fetch

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
      • fetchEncodedImage

         DataSource<CloseableReference<PooledByteBuffer>> fetchEncodedImage(ImageRequest imageRequest, @Nullable() Object callerContext, @Nullable() RequestListener requestListener)

        Submits a request for execution and returns a DataSource representing the pending encodedimage(s).

        The ResizeOptions in the imageRequest will be ignored for this fetch

        The returned DataSource must be closed once the client has finished with it.

        Parameters:
        imageRequest - the request to submit
      • prefetchToBitmapCache

         DataSource<Void> prefetchToBitmapCache(ImageRequest imageRequest, @Nullable() Object callerContext)

        Submits a request for prefetching to the bitmap cache.

        Beware that if your network fetcher doesn't support priorities prefetch requests may slowdown images which are immediately required on screen.

        Parameters:
        imageRequest - the request to submit
      • prefetchToDiskCache

         DataSource<Void> prefetchToDiskCache(@Nullable() ImageRequest imageRequest, @Nullable() Object callerContext)

        Submits a request for prefetching to the disk cache with a default priority.

        Beware that if your network fetcher doesn't support priorities prefetch requests may slowdown images which are immediately required on screen.

        Parameters:
        imageRequest - the request to submit
      • prefetchToDiskCache

         DataSource<Void> prefetchToDiskCache(@Nullable() ImageRequest imageRequest, @Nullable() Object callerContext, Priority priority)

        Submits a request for prefetching to the disk cache.

        Beware that if your network fetcher doesn't support priorities prefetch requests may slowdown images which are immediately required on screen.

        Parameters:
        imageRequest - the request to submit
        priority - custom priority for the fetch
      • prefetchToEncodedCache

         DataSource<Void> prefetchToEncodedCache(ImageRequest imageRequest, @Nullable() Object callerContext)

        Submits a request for prefetching to the encoded cache with a default priority.

        Beware that if your network fetcher doesn't support priorities prefetch requests may slowdown images which are immediately required on screen.

        Parameters:
        imageRequest - the request to submit
      • prefetchToEncodedCache

         DataSource<Void> prefetchToEncodedCache(ImageRequest imageRequest, @Nullable() Object callerContext, Priority priority)

        Submits a request for prefetching to the encoded cache.

        Beware that if your network fetcher doesn't support priorities prefetch requests may slowdown images which are immediately required on screen.

        Parameters:
        imageRequest - the request to submit
        priority - custom priority for the fetch
      • evictFromMemoryCache

         void evictFromMemoryCache(Uri uri)

        Removes all images with the specified Uri from memory cache.

        Parameters:
        uri - The uri of the image to evict
      • evictFromDiskCache

         void evictFromDiskCache(Uri uri)

        If you have supplied your own cache key factory when configuring the pipeline, this method maynot work correctly. It will only work if the custom factory builds the cache key entirely fromthe URI. If that is not the case, use evictFromDiskCache.

        Parameters:
        uri - The uri of the image to evict
      • evictFromDiskCache

         void evictFromDiskCache(@Nullable() ImageRequest imageRequest)

        Removes all images with the specified Uri from disk cache.

        Parameters:
        imageRequest - The imageRequest for the image to evict from disk cache
      • evictFromCache

         void evictFromCache(Uri uri)

        If you have supplied your own cache key factory when configuring the pipeline, this method maynot work correctly. It will only work if the custom factory builds the cache key entirely fromthe URI. If that is not the case, use evictFromMemoryCache and separately.

        Parameters:
        uri - The uri of the image to evict
      • clearCaches

         void clearCaches()

        Clear all the caches (memory and disk)

      • isInBitmapMemoryCache

         boolean isInBitmapMemoryCache(Uri uri)

        Returns whether the image is stored in the bitmap memory cache.

        Parameters:
        uri - the uri for the image to be looked up.
      • isInBitmapMemoryCache

         boolean isInBitmapMemoryCache(ImageRequest imageRequest)

        Returns whether the image is stored in the bitmap memory cache.

        Parameters:
        imageRequest - the imageRequest for the image to be looked up.
      • isInEncodedMemoryCache

         boolean isInEncodedMemoryCache(Uri uri)

        Returns whether the image is stored in the encoded memory cache.

        Parameters:
        uri - the uri for the image to be looked up.
      • isInEncodedMemoryCache

         boolean isInEncodedMemoryCache(ImageRequest imageRequest)

        Returns whether the image is stored in the encoded memory cache.

        Parameters:
        imageRequest - the imageRequest for the image to be looked up.
      • isInDiskCacheSync

         boolean isInDiskCacheSync(Uri uri)

        Returns whether the image is stored in the disk cache. Performs disk cache check synchronously.It is not recommended to use this unless you know what exactly you are doing. Disk cache checkis a costly operation, the call will block the caller thread until the cache check iscompleted.

        Parameters:
        uri - the uri for the image to be looked up.
      • isInDiskCacheSync

         boolean isInDiskCacheSync(Uri uri, ImageRequest.CacheChoice cacheChoice)

        Returns whether the image is stored in the disk cache. Performs disk cache check synchronously.It is not recommended to use this unless you know what exactly you are doing. Disk cache checkis a costly operation, the call will block the caller thread until the cache check iscompleted.

        Parameters:
        uri - the uri for the image to be looked up.
        cacheChoice - the cacheChoice for the cache to be looked up.
      • isInDiskCacheSync

         boolean isInDiskCacheSync(ImageRequest imageRequest)

        Performs disk cache check synchronously. It is not recommended to use this unless you know whatexactly you are doing. Disk cache check is a costly operation, the call will block the callerthread until the cache check is completed.

        Parameters:
        imageRequest - the imageRequest for the image to be looked up.
      • isInDiskCache

         DataSource<Boolean> isInDiskCache(Uri uri)

        Returns whether the image is stored in the disk cache.

        If you have supplied your own cache key factory when configuring the pipeline, this methodmay not work correctly. It will only work if the custom factory builds the cache key entirelyfrom the URI. If that is not the case, use isInDiskCache.

        Parameters:
        uri - the uri for the image to be looked up.
      • isInDiskCache

         DataSource<Boolean> isInDiskCache(ImageRequest imageRequest)

        Returns whether the image is stored in the disk cache.

        Parameters:
        imageRequest - the imageRequest for the image to be looked up.
      • getCachedImage

        @Nullable() CloseableReference<CloseableImage> getCachedImage(@Nullable() CacheKey cacheKey)

        Returns a reference to the cached image