public abstract class

AbstractDraweeControllerBuilder

extends Object
implements SimpleDraweeControllerBuilder
java.lang.Object
   ↳ com.facebook.drawee.controller.AbstractDraweeControllerBuilder<BUILDER extends com.facebook.drawee.controller.AbstractDraweeControllerBuilder<BUILDER, REQUEST, IMAGE, INFO>, REQUEST, IMAGE, INFO>
Known Direct Subclasses

Class Overview

Base implementation for Drawee controller builders.

Summary

Nested Classes
enum AbstractDraweeControllerBuilder.CacheLevel  
Protected Constructors
AbstractDraweeControllerBuilder(Context context, Set<ControllerListener> boundControllerListeners)
Public Methods
AbstractDraweeController build()
Builds the specified controller.
boolean getAutoPlayAnimations()
Gets whether to auto play animations.
Object getCallerContext()
Gets the caller context.
String getContentDescription()
Gets the accessibility content description.
ControllerListener<? super INFO> getControllerListener()
Gets the controller listener
ControllerViewportVisibilityListener getControllerViewportVisibilityListener()
Gets the controller viewport visibility listener.
Supplier<DataSource<IMAGE>> getDataSourceSupplier()
Gets the data source supplier if set.
REQUEST[] getFirstAvailableImageRequests()
Gets the array of first-available image requests.
REQUEST getImageRequest()
Gets the image request.
REQUEST getLowResImageRequest()
Gets the low-res image request.
DraweeController getOldController()
Gets the old controller to be reused.
boolean getRetainImageOnFailure()
Gets whether to retain image on failure.
boolean getTapToRetryEnabled()
Gets whether tap-to-retry is enabled.
BUILDER reset()
Resets this builder to its initial values making it reusable.
BUILDER setAutoPlayAnimations(boolean enabled)
Sets whether to auto play animations.
BUILDER setCallerContext(Object callerContext)
Sets the caller context.
BUILDER setContentDescription(String contentDescription)
Sets the accessibility content description.
BUILDER setControllerListener(ControllerListener<? super INFO> controllerListener)
Sets the controller listener.
BUILDER setControllerViewportVisibilityListener(ControllerViewportVisibilityListener controllerViewportVisibilityListener)
Sets the controller viewport visibility listener.
void setDataSourceSupplier(Supplier<DataSource<IMAGE>> dataSourceSupplier)
Sets the data source supplier to be used.
BUILDER setFirstAvailableImageRequests(REQUEST[] firstAvailableImageRequests)
Sets the array of first-available image requests that will be probed in order.
BUILDER setFirstAvailableImageRequests(REQUEST[] firstAvailableImageRequests, boolean tryCacheOnlyFirst)
Sets the array of first-available image requests that will be probed in order.
BUILDER setImageRequest(REQUEST imageRequest)
Sets the image request.
BUILDER setLowResImageRequest(REQUEST lowResImageRequest)
Sets the low-res image request.
BUILDER setOldController(DraweeController oldController)
Sets the old controller to be reused if possible.
BUILDER setRetainImageOnFailure(boolean enabled)
Sets whether to display last available image in case of failure.
BUILDER setTapToRetryEnabled(boolean enabled)
Sets whether tap-to-retry is enabled.
Protected Methods
AbstractDraweeController buildController()
Builds a regular controller.
static String generateUniqueControllerId()
Generates unique controller id.
Context getContext()
abstract DataSource<IMAGE> getDataSourceForRequest(REQUEST imageRequest, Object callerContext, AbstractDraweeControllerBuilder.CacheLevel cacheLevel)
Concrete builder classes should override this method to return a data source for the request.
Supplier<DataSource<IMAGE>> getDataSourceSupplierForRequest(REQUEST imageRequest, AbstractDraweeControllerBuilder.CacheLevel cacheLevel)
Creates a data source supplier for the given image request.
Supplier<DataSource<IMAGE>> getDataSourceSupplierForRequest(REQUEST imageRequest)
Creates a data source supplier for the given image request.
Supplier<DataSource<IMAGE>> getFirstAvailableDataSourceSupplier(REQUEST[] imageRequests, boolean tryBitmapCacheOnlyFirst)
abstract BUILDER getThis()
Concrete builder classes should override this method to return {#code this}.
void maybeAttachListeners(AbstractDraweeController controller)
Attaches listeners (if specified) to the given controller.
void maybeBuildAndSetGestureDetector(AbstractDraweeController controller)
Installs a gesture detector to the given controller.
void maybeBuildAndSetRetryManager(AbstractDraweeController controller)
Installs a retry manager (if specified) to the given controller.
abstract AbstractDraweeController obtainController()
Concrete builder classes should override this method to return a new controller.
Supplier<DataSource<IMAGE>> obtainDataSourceSupplier()
Gets the top-level data source supplier to be used by a controller.
void validate()
Validates the parameters before building a controller.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.drawee.interfaces.SimpleDraweeControllerBuilder

Protected Constructors

protected AbstractDraweeControllerBuilder (Context context, Set<ControllerListener> boundControllerListeners)

Public Methods

public AbstractDraweeController build ()

Builds the specified controller.

public boolean getAutoPlayAnimations ()

Gets whether to auto play animations.

public Object getCallerContext ()

Gets the caller context.

public String getContentDescription ()

Gets the accessibility content description.

public ControllerListener<? super INFO> getControllerListener ()

Gets the controller listener

public ControllerViewportVisibilityListener getControllerViewportVisibilityListener ()

Gets the controller viewport visibility listener.

public Supplier<DataSource<IMAGE>> getDataSourceSupplier ()

Gets the data source supplier if set.

Important: this only returns the externally set data source (if any). Subclasses should use {#code obtainDataSourceSupplier()} to obtain a data source to be passed to the controller.

public REQUEST[] getFirstAvailableImageRequests ()

Gets the array of first-available image requests.

For performance reasons, the array is not deep-copied, but only stored by reference. Please don't modify.

public REQUEST getImageRequest ()

Gets the image request.

public REQUEST getLowResImageRequest ()

Gets the low-res image request.

public DraweeController getOldController ()

Gets the old controller to be reused.

public boolean getRetainImageOnFailure ()

Gets whether to retain image on failure.

public boolean getTapToRetryEnabled ()

Gets whether tap-to-retry is enabled.

public BUILDER reset ()

Resets this builder to its initial values making it reusable.

public BUILDER setAutoPlayAnimations (boolean enabled)

Sets whether to auto play animations.

public BUILDER setCallerContext (Object callerContext)

Sets the caller context.

public BUILDER setContentDescription (String contentDescription)

Sets the accessibility content description.

public BUILDER setControllerListener (ControllerListener<? super INFO> controllerListener)

Sets the controller listener.

public BUILDER setControllerViewportVisibilityListener (ControllerViewportVisibilityListener controllerViewportVisibilityListener)

Sets the controller viewport visibility listener.

public void setDataSourceSupplier (Supplier<DataSource<IMAGE>> dataSourceSupplier)

Sets the data source supplier to be used.

Note: This is mutually exclusive with other image request setters.

public BUILDER setFirstAvailableImageRequests (REQUEST[] firstAvailableImageRequests)

Sets the array of first-available image requests that will be probed in order.

For performance reasons, the array is not deep-copied, but only stored by reference. Please don't modify once submitted.

public BUILDER setFirstAvailableImageRequests (REQUEST[] firstAvailableImageRequests, boolean tryCacheOnlyFirst)

Sets the array of first-available image requests that will be probed in order.

For performance reasons, the array is not deep-copied, but only stored by reference. Please don't modify once submitted.

Parameters
tryCacheOnlyFirst if set, bitmap cache only requests will be tried in order before the supplied requests.

public BUILDER setImageRequest (REQUEST imageRequest)

Sets the image request.

public BUILDER setLowResImageRequest (REQUEST lowResImageRequest)

Sets the low-res image request.

public BUILDER setOldController (DraweeController oldController)

Sets the old controller to be reused if possible.

public BUILDER setRetainImageOnFailure (boolean enabled)

Sets whether to display last available image in case of failure.

public BUILDER setTapToRetryEnabled (boolean enabled)

Sets whether tap-to-retry is enabled.

Protected Methods

protected AbstractDraweeController buildController ()

Builds a regular controller.

protected static String generateUniqueControllerId ()

Generates unique controller id.

protected Context getContext ()

protected abstract DataSource<IMAGE> getDataSourceForRequest (REQUEST imageRequest, Object callerContext, AbstractDraweeControllerBuilder.CacheLevel cacheLevel)

Concrete builder classes should override this method to return a data source for the request.

IMPORTANT: Do NOT ever call this method directly. This method is only to be called from a supplier created in {#code getDataSourceSupplierForRequest(REQUEST, boolean)}.

IMPORTANT: Make sure that you do NOT use any non-final field from this method, as the field may change if the instance of this builder gets reused. If any such field is required, override {#code getDataSourceSupplierForRequest(REQUEST, boolean)}, and store the field in a final variable (same as it is done for callerContext).

protected Supplier<DataSource<IMAGE>> getDataSourceSupplierForRequest (REQUEST imageRequest, AbstractDraweeControllerBuilder.CacheLevel cacheLevel)

Creates a data source supplier for the given image request.

protected Supplier<DataSource<IMAGE>> getDataSourceSupplierForRequest (REQUEST imageRequest)

Creates a data source supplier for the given image request.

protected Supplier<DataSource<IMAGE>> getFirstAvailableDataSourceSupplier (REQUEST[] imageRequests, boolean tryBitmapCacheOnlyFirst)

protected abstract BUILDER getThis ()

Concrete builder classes should override this method to return {#code this}.

protected void maybeAttachListeners (AbstractDraweeController controller)

Attaches listeners (if specified) to the given controller.

protected void maybeBuildAndSetGestureDetector (AbstractDraweeController controller)

Installs a gesture detector to the given controller.

protected void maybeBuildAndSetRetryManager (AbstractDraweeController controller)

Installs a retry manager (if specified) to the given controller.

protected abstract AbstractDraweeController obtainController ()

Concrete builder classes should override this method to return a new controller.

protected Supplier<DataSource<IMAGE>> obtainDataSourceSupplier ()

Gets the top-level data source supplier to be used by a controller.

protected void validate ()

Validates the parameters before building a controller.