java.lang.Object | |
↳ | com.facebook.drawee.generic.GenericDraweeHierarchy |
A SettableDraweeHierarchy that displays placeholder image until the actual image is set. If provided, failure image will be used in case of failure (placeholder otherwise). If provided, retry image will be used in case of failure when retrying is enabled. If provided, progressbar will be displayed until fully loaded. Each image can be displayed with a different scale type (or no scaling at all). Fading between the layers is supported. Rounding is supported.
Example hierarchy with a placeholder, retry, failure and the actual image:
o RootDrawable (top level drawable) | +--o FadeDrawable | +--o ScaleTypeDrawable (placeholder branch, optional) | | | +--o Drawable (placeholder image) | +--o ScaleTypeDrawable (actual image branch) | | | +--o ForwardingDrawable (actual image wrapper) | | | +--o Drawable (actual image) | +--o null (progress bar branch, optional) | +--o Drawable (retry image branch, optional) | +--o ScaleTypeDrawable (failure image branch, optional) | +--o Drawable (failure image)
Note:
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
getActualImageBounds(RectF outBounds)
Gets the non-cropped post-scaling bounds of the actual image.
| ||||||||||
PointF | getActualImageFocusPoint() | ||||||||||
ScalingUtils.ScaleType | getActualImageScaleType() | ||||||||||
Rect | getBounds() | ||||||||||
int |
getFadeDuration()
Gets the fade duration.
| ||||||||||
RoundingParams |
getRoundingParams()
Gets the rounding params.
| ||||||||||
Drawable |
getTopLevelDrawable()
Returns the top level drawable in the corresponding hierarchy.
| ||||||||||
boolean | hasImage() | ||||||||||
boolean | hasPlaceholderImage() | ||||||||||
void |
reset()
Called by controller when the hierarchy should be reset to its initial state.
| ||||||||||
void |
setActualImageColorFilter(ColorFilter colorfilter)
Sets the color filter to be applied on the actual image.
| ||||||||||
void |
setActualImageFocusPoint(PointF focusPoint)
Sets the actual image focus point.
| ||||||||||
void |
setActualImageScaleType(ScalingUtils.ScaleType scaleType)
Sets the actual image scale type.
| ||||||||||
void |
setBackgroundImage(Drawable drawable)
Sets the background image if allowed.
| ||||||||||
void |
setControllerOverlay(Drawable drawable)
Called by controller if it needs to display some controller overlay.
| ||||||||||
void |
setFadeDuration(int durationMs)
Sets the fade duration.
| ||||||||||
void |
setFailure(Throwable throwable)
Called by controller when the future that provides the actual image completes with failure.
| ||||||||||
void |
setFailureImage(Drawable drawable)
Sets a new failure drawable with old scale type.
| ||||||||||
void |
setFailureImage(Drawable drawable, ScalingUtils.ScaleType scaleType)
Sets a new failure drawable with scale type.
| ||||||||||
void |
setFailureImage(int resourceId, ScalingUtils.ScaleType scaleType)
Sets a new failure drawable with scale type.
| ||||||||||
void |
setFailureImage(int resourceId)
Sets a new failure drawable with old scale type.
| ||||||||||
void |
setImage(Drawable drawable, float progress, boolean immediate)
Called by controller when the future that provides the actual image completes successfully.
| ||||||||||
void | setOnFadeListener(FadeDrawable.OnFadeListener onFadeFinished) | ||||||||||
void |
setOverlayImage(int index, Drawable drawable)
Sets a new overlay image at the specified index.
| ||||||||||
void |
setOverlayImage(Drawable drawable)
Sets the overlay image if allowed.
| ||||||||||
void |
setPlaceholderImage(Drawable drawable)
Sets a new placeholder drawable with old scale type.
| ||||||||||
void |
setPlaceholderImage(int resourceId, ScalingUtils.ScaleType scaleType)
Sets a new placeholder drawable with scale type.
| ||||||||||
void |
setPlaceholderImage(Drawable drawable, ScalingUtils.ScaleType scaleType)
Sets a new placeholder drawable with scale type.
| ||||||||||
void |
setPlaceholderImage(int resourceId)
Sets a new placeholder drawable with old scale type.
| ||||||||||
void |
setPlaceholderImageFocusPoint(PointF focusPoint)
Sets the placeholder image focus point.
| ||||||||||
void |
setProgress(float progress, boolean immediate)
Called by controller to update the progress.
| ||||||||||
void |
setProgressBarImage(int resourceId, ScalingUtils.ScaleType scaleType)
Sets a new progress bar drawable with scale type.
| ||||||||||
void |
setProgressBarImage(Drawable drawable)
Sets a new progress bar drawable with old scale type.
| ||||||||||
void |
setProgressBarImage(Drawable drawable, ScalingUtils.ScaleType scaleType)
Sets a new progress bar drawable with scale type.
| ||||||||||
void |
setProgressBarImage(int resourceId)
Sets a new progress bar drawable with old scale type.
| ||||||||||
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.
| ||||||||||
void |
setRetryImage(int resourceId, ScalingUtils.ScaleType scaleType)
Sets a new retry drawable with scale type.
| ||||||||||
void |
setRetryImage(int resourceId)
Sets a new retry drawable with old scale type.
| ||||||||||
void |
setRetryImage(Drawable drawable, ScalingUtils.ScaleType scaleType)
Sets a new retry drawable with scale type.
| ||||||||||
void |
setRetryImage(Drawable drawable)
Sets a new retry drawable with old scale type.
| ||||||||||
void |
setRoundingParams(RoundingParams roundingParams)
Sets the rounding params.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.facebook.drawee.interfaces.DraweeHierarchy
| |||||||||||
From interface
com.facebook.drawee.interfaces.SettableDraweeHierarchy
|
Gets the non-cropped post-scaling bounds of the actual image.
Gets the fade duration.
Returns the top level drawable in the corresponding hierarchy. Hierarchy should always have the same instance of its top level drawable.
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.
Sets the color filter to be applied on the actual image.
Sets the actual image focus point.
Sets the actual image scale type.
Sets the background image if allowed.
Called by controller if it needs to display some controller overlay.
drawable | drawable to be displayed as controller overlay |
---|
Sets the fade duration.
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 |
---|
Sets a new failure drawable with old scale type.
Sets a new failure drawable with scale type.
Sets a new failure drawable with scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
Sets a new failure drawable with old scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
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) |
Sets a new overlay image at the specified index.
This method will throw if the given index is out of bounds.
drawable | background image |
---|
Sets the overlay image if allowed.
Sets a new placeholder drawable with old scale type.
Sets a new placeholder drawable with scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
Sets a new placeholder drawable with scale type.
Sets a new placeholder drawable with old scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
Sets the placeholder image focus point.
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) |
Sets a new progress bar drawable with scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
Sets a new progress bar drawable with old scale type.
Sets a new progress bar drawable with scale type.
Sets a new progress bar drawable with old scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
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 |
---|
Sets a new retry drawable with scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
Sets a new retry drawable with old scale type.
resourceId | an identifier of an Android drawable or color resource. |
---|
Sets a new retry drawable with scale type.
Sets a new retry drawable with old scale type.