public class

BaseProducerContext

extends Object
implements ProducerContext
java.lang.Object
   ↳ com.facebook.imagepipeline.producers.BaseProducerContext
Known Direct Subclasses

Class Overview

ProducerContext that can be cancelled. Exposes low level API to manipulate state of the ProducerContext.

Summary

Fields
public static final Set<String> INITIAL_KEYS
Public Constructors
BaseProducerContext(ImageRequest imageRequest, String id, ProducerListener2 producerListener, Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevel, boolean isPrefetch, boolean isIntermediateResultExpected, Priority priority, ImagePipelineConfig imagePipelineConfig)
BaseProducerContext(ImageRequest imageRequest, String id, String uiComponentId, ProducerListener2 producerListener, Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevel, boolean isPrefetch, boolean isIntermediateResultExpected, Priority priority, ImagePipelineConfig imagePipelineConfig)
Public Methods
void addCallbacks(ProducerContextCallbacks callbacks)
Adds callbacks to the set of callbacks that are executed at various points during the processing of a request.
static void callOnCancellationRequested(List<ProducerContextCallbacks> callbacks)
Calls onCancellationRequested on each element of the list.
static void callOnIsIntermediateResultExpectedChanged(List<ProducerContextCallbacks> callbacks)
Calls onIsIntermediateResultExpected on each element of the list.
static void callOnIsPrefetchChanged(List<ProducerContextCallbacks> callbacks)
Calls onIsPrefetchChanged on each element of the list.
static void callOnPriorityChanged(List<ProducerContextCallbacks> callbacks)
Calls onPriorityChanged on each element of the list.
void cancel()
Cancels the request processing and calls appropriate callbacks.
synchronized List<ProducerContextCallbacks> cancelNoCallbacks()
Marks this ProducerContext as cancelled.
Object getCallerContext()
EncodedImageOrigin getEncodedImageOrigin()
<T> T getExtra(String key)
<E> E getExtra(String key, E valueIfNotFound)
Map<String, Object> getExtras()
String getId()
ImagePipelineConfig getImagePipelineConfig()
ImageRequest getImageRequest()
ImageRequest.RequestLevel getLowestPermittedRequestLevel()
synchronized Priority getPriority()
ProducerListener2 getProducerListener()
String getUiComponentId()
synchronized boolean isCancelled()
synchronized boolean isIntermediateResultExpected()
synchronized boolean isPrefetch()
void putExtras(Map<String, ?> extras)
void putOriginExtra(String origin)
Helper to set ORIGIN
void putOriginExtra(String origin, String subcategory)
Helper to set ORIGIN and ORIGIN_SUBCATEGORY
void setEncodedImageOrigin(EncodedImageOrigin encodedImageOrigin)
void setExtra(String key, Object value)
synchronized List<ProducerContextCallbacks> setIsIntermediateResultExpectedNoCallbacks(boolean isIntermediateResultExpected)
Changes isIntermediateResultExpected property.
synchronized List<ProducerContextCallbacks> setIsPrefetchNoCallbacks(boolean isPrefetch)
Changes isPrefetch property.
synchronized List<ProducerContextCallbacks> setPriorityNoCallbacks(Priority priority)
Changes priority.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.imagepipeline.producers.ProducerContext

Fields

public static final Set<String> INITIAL_KEYS

Public Constructors

public BaseProducerContext (ImageRequest imageRequest, String id, ProducerListener2 producerListener, Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevel, boolean isPrefetch, boolean isIntermediateResultExpected, Priority priority, ImagePipelineConfig imagePipelineConfig)

public BaseProducerContext (ImageRequest imageRequest, String id, String uiComponentId, ProducerListener2 producerListener, Object callerContext, ImageRequest.RequestLevel lowestPermittedRequestLevel, boolean isPrefetch, boolean isIntermediateResultExpected, Priority priority, ImagePipelineConfig imagePipelineConfig)

Public Methods

public 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 static void callOnCancellationRequested (List<ProducerContextCallbacks> callbacks)

Calls onCancellationRequested on each element of the list. Does nothing if list == null

public static void callOnIsIntermediateResultExpectedChanged (List<ProducerContextCallbacks> callbacks)

Calls onIsIntermediateResultExpected on each element of the list. Does nothing if list == null

public static void callOnIsPrefetchChanged (List<ProducerContextCallbacks> callbacks)

Calls onIsPrefetchChanged on each element of the list. Does nothing if list == null

public static void callOnPriorityChanged (List<ProducerContextCallbacks> callbacks)

Calls onPriorityChanged on each element of the list. Does nothing if list == null

public void cancel ()

Cancels the request processing and calls appropriate callbacks.

public synchronized List<ProducerContextCallbacks> cancelNoCallbacks ()

Marks this ProducerContext as cancelled.

This method does not call any callbacks. Instead, caller of this method is responsible for iterating over returned list and calling appropriate method on each callback object.

Returns
  • list of callbacks if the value actually changes, null otherwise

public Object getCallerContext ()

public EncodedImageOrigin getEncodedImageOrigin ()

public T getExtra (String key)

public E getExtra (String key, E valueIfNotFound)

public Map<String, Object> getExtras ()

public String getId ()

public ImagePipelineConfig getImagePipelineConfig ()

public ImageRequest getImageRequest ()

public ImageRequest.RequestLevel getLowestPermittedRequestLevel ()

public synchronized Priority getPriority ()

public ProducerListener2 getProducerListener ()

public String getUiComponentId ()

public synchronized boolean isCancelled ()

public synchronized boolean isIntermediateResultExpected ()

public synchronized boolean isPrefetch ()

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

public void putOriginExtra (String origin)

Helper to set ORIGIN

public void putOriginExtra (String origin, String subcategory)

Helper to set ORIGIN and ORIGIN_SUBCATEGORY

public void setEncodedImageOrigin (EncodedImageOrigin encodedImageOrigin)

public void setExtra (String key, Object value)

public synchronized List<ProducerContextCallbacks> setIsIntermediateResultExpectedNoCallbacks (boolean isIntermediateResultExpected)

Changes isIntermediateResultExpected property.

This method does not call any callbacks. Instead, caller of this method is responsible for iterating over returned list and calling appropriate method on each callback object.

Returns
  • list of callbacks if the value actually changes, null otherwise
See Also
  • #callOnIntermediateResultChanged

public synchronized List<ProducerContextCallbacks> setIsPrefetchNoCallbacks (boolean isPrefetch)

Changes isPrefetch property.

This method does not call any callbacks. Instead, caller of this method is responsible for iterating over returned list and calling appropriate method on each callback object.

Returns
  • list of callbacks if the value actually changes, null otherwise

public synchronized List<ProducerContextCallbacks> setPriorityNoCallbacks (Priority priority)

Changes priority.

This method does not call any callbacks. Instead, caller of this method is responsible for iterating over returned list and calling appropriate method on each callback object.

Returns
  • list of callbacks if the value actually changes, null otherwise