public interface

SettableDraweeHierarchy

implements DraweeHierarchy
com.facebook.drawee.interfaces.SettableDraweeHierarchy
Known Indirect Subclasses

Class Overview

Interface that represents a settable Drawee hierarchy. Hierarchy should display a placeholder image until the actual image is set. In case of a failure, hierarchy can choose to display a failure image.

IMPORTANT: methods of this interface are to be used by controllers ONLY!

Example hierarchy: o FadeDrawable (top level drawable) | +--o ScaleTypeDrawable | | | +--o ColorDrawable (placeholder image) | +--o ScaleTypeDrawable | | | +--o BitmapDrawable (failure image) | +--o ScaleTypeDrawable | +--o SettableDrawable | +--o BitmapDrawable (actual image) SettableDraweeHierarchy in the given example has a FadeDrawable as its top level drawable. Top level drawable can be immediately put into view. Once the actual image is ready, it will be set to the hierarchy's SettableDrawable and fade animation between the placeholder and the actual image will be initiated. In case of failure, hierarchy will switch to failure image. All image branches are wrapped with ScaleType drawable which allows separate scale type to be applied on each.

Summary

Public Methods
abstract void reset()
Called by controller when the hierarchy should be reset to its initial state.
abstract void setControllerOverlay(Drawable drawable)
Called by controller if it needs to display some controller overlay.
abstract void setFailure(Throwable throwable)
Called by controller when the future that provides the actual image completes with failure.
abstract void setImage(Drawable drawable, float progress, boolean immediate)
Called by controller when the future that provides the actual image completes successfully.
abstract void setProgress(float progress, boolean immediate)
Called by controller to update the progress.
abstract void setRetry(Throwable throwable)
Called by controller when the future that provides the actual image completes with failure, but the controller is prepared to kick off a retry when the user clicks on the image.
[Expand]
Inherited Methods
From interface com.facebook.drawee.interfaces.DraweeHierarchy

Public Methods

public abstract void reset ()

Called by controller when the hierarchy should be reset to its initial state. Any image previously set by setImage should be detached and not used anymore.

public abstract void setControllerOverlay (Drawable drawable)

Called by controller if it needs to display some controller overlay.

Parameters
drawable drawable to be displayed as controller overlay

public abstract void setFailure (Throwable throwable)

Called by controller when the future that provides the actual image completes with failure. Hierarchy can choose to display between different images based on cause of failure.

Parameters
throwable cause of failure

public abstract void setImage (Drawable drawable, float progress, boolean immediate)

Called by controller when the future that provides the actual image completes successfully. Hierarchy should display the actual image.

Parameters
drawable drawable to be set as the temporary image
progress number in range [0, 1] that indicates progress
immediate if true, image will be shown immediately (without fade effect)

public abstract void setProgress (float progress, boolean immediate)

Called by controller to update the progress. Hierarchy can choose to hide the progressbar when progress is set to its final value of 1.

Parameters
progress number in range [0, 1] that indicates progress
immediate if true, progressbar will be shown/hidden immediately (without fade effect)

public abstract void setRetry (Throwable throwable)

Called by controller when the future that provides the actual image completes with failure, but the controller is prepared to kick off a retry when the user clicks on the image. Hierarchy can choose to display a retry image.

Parameters
throwable cause of failure