com.facebook.drawee.interfaces.SettableDraweeHierarchy |
Known Indirect Subclasses |
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.
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
|
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.
Called by controller if it needs to display some controller overlay.
drawable | drawable to be displayed as controller overlay |
---|
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.
throwable | cause of failure |
---|
Called by controller when the future that provides the actual image completes successfully. Hierarchy should display the actual image.
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) |
Called by controller to update the progress. Hierarchy can choose to hide the progressbar when progress is set to its final value of 1.
progress | number in range [0, 1] that indicates progress |
---|---|
immediate | if true, progressbar will be shown/hidden immediately (without fade effect) |
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.
throwable | cause of failure |
---|