public interface

ProducerContext

com.facebook.imagepipeline.producers.ProducerContext
Known Indirect Subclasses

Class Overview

Used to pass context information to producers.

Object implementing this interface is passed to all producers participating in pipeline request . Its responsibility is to instruct producers which image should be fetched/decoded/resized/cached etc. This class also handles request cancellation.

In order to be notified when cancellation is requested, a producer should use the runOnCancellationRequested method which takes an instance of Runnable and executes it when the pipeline client cancels the image request.

Summary

Nested Classes
@interface ProducerContext.ExtraKeys  
Public Methods
abstract void addCallbacks(ProducerContextCallbacks callbacks)
Adds callbacks to the set of callbacks that are executed at various points during the processing of a request.
abstract Object getCallerContext()
abstract EncodedImageOrigin getEncodedImageOrigin()
abstract <E> E getExtra(String key, E valueIfNotFound)
abstract <E> E getExtra(String key)
abstract Map<String, Object> getExtras()
abstract String getId()
abstract ImagePipelineConfig getImagePipelineConfig()
abstract ImageRequest getImageRequest()
abstract ImageRequest.RequestLevel getLowestPermittedRequestLevel()
abstract Priority getPriority()
abstract ProducerListener2 getProducerListener()
abstract String getUiComponentId()
abstract boolean isIntermediateResultExpected()
abstract boolean isPrefetch()
abstract void putExtras(Map<String, ?> extras)
abstract void putOriginExtra(String origin)
Helper to set ORIGIN
abstract void putOriginExtra(String origin, String subcategory)
Helper to set ORIGIN and ORIGIN_SUBCATEGORY
abstract void setEncodedImageOrigin(EncodedImageOrigin encodedImageOrigin)
abstract <E> void setExtra(String key, E value)

Public Methods

public abstract void addCallbacks (ProducerContextCallbacks callbacks)

Adds callbacks to the set of callbacks that are executed at various points during the processing of a request.

Parameters
callbacks callbacks to be executed

public abstract Object getCallerContext ()

Returns
  • the Object that indicates the caller's context

public abstract EncodedImageOrigin getEncodedImageOrigin ()

public abstract E getExtra (String key, E valueIfNotFound)

public abstract E getExtra (String key)

public abstract Map<String, Object> getExtras ()

public abstract String getId ()

Returns
  • id of this request

public abstract ImagePipelineConfig getImagePipelineConfig ()

public abstract ImageRequest getImageRequest ()

Returns
  • image request that is being executed

public abstract ImageRequest.RequestLevel getLowestPermittedRequestLevel ()

Returns

public abstract Priority getPriority ()

Returns
  • priority of the request.

public abstract ProducerListener2 getProducerListener ()

Returns
  • ProducerListener2 for producer's events

public abstract String getUiComponentId ()

Returns
  • optional id of the UI component requesting the image

public abstract boolean isIntermediateResultExpected ()

Returns
  • true if request's owner expects intermediate results

public abstract boolean isPrefetch ()

Returns
  • true if the request is a prefetch, false otherwise.

public abstract void putExtras (Map<String, ?> extras)

public abstract void putOriginExtra (String origin)

Helper to set ORIGIN

public abstract void putOriginExtra (String origin, String subcategory)

Helper to set ORIGIN and ORIGIN_SUBCATEGORY

public abstract void setEncodedImageOrigin (EncodedImageOrigin encodedImageOrigin)

public abstract void setExtra (String key, E value)