public class

GenericDraweeHierarchyBuilder

extends Object
java.lang.Object
   ↳ com.facebook.drawee.generic.GenericDraweeHierarchyBuilder

Class Overview

Class to construct a GenericDraweeHierarchy.

This class does not do deep copies of most of the input parameters. There should be one instance of the hierarchy per DraweeView, so that each hierarchy has a unique set of drawables.

Summary

Constants
int DEFAULT_FADE_DURATION
Fields
public static final ScalingUtils.ScaleType DEFAULT_ACTUAL_IMAGE_SCALE_TYPE
public static final ScalingUtils.ScaleType DEFAULT_SCALE_TYPE
Public Constructors
GenericDraweeHierarchyBuilder(Resources resources)
Public Methods
GenericDraweeHierarchy build()
ColorFilter getActualImageColorFilter()
PointF getActualImageFocusPoint()
Matrix getActualImageMatrix()
ScalingUtils.ScaleType getActualImageScaleType()
List<Drawable> getBackgrounds()
int getFadeDuration()
Drawable getFailureImage()
ScalingUtils.ScaleType getFailureImageScaleType()
List<Drawable> getOverlays()
Drawable getPlaceholderImage()
ScalingUtils.ScaleType getPlaceholderImageScaleType()
Drawable getPressedStateOverlay()
Drawable getProgressBarImage()
ScalingUtils.ScaleType getProgressBarImageScaleType()
Resources getResources()
Gets resources.
Drawable getRetryImage()
ScalingUtils.ScaleType getRetryImageScaleType()
RoundingParams getRoundingParams()
static GenericDraweeHierarchyBuilder newInstance(Resources resources)
GenericDraweeHierarchyBuilder reset()
Resets this builder to its initial values making it reusable.
GenericDraweeHierarchyBuilder setActualImageColorFilter(ColorFilter colorFilter)
Sets the color filter.
GenericDraweeHierarchyBuilder setActualImageFocusPoint(PointF focusPoint)
Sets the focus point for the actual image.
GenericDraweeHierarchyBuilder setActualImageMatrix(Matrix actualImageMatrix)
This method is deprecated. this is likely not something you want
GenericDraweeHierarchyBuilder setActualImageScaleType(ScalingUtils.ScaleType actualImageScaleType)
Sets the scale type, and removes the transformation matrix, for the actual image.
GenericDraweeHierarchyBuilder setBackground(Drawable background)
Sets a single background.
GenericDraweeHierarchyBuilder setBackgrounds(List<Drawable> backgrounds)
Sets the backgrounds.
GenericDraweeHierarchyBuilder setFadeDuration(int fadeDuration)
Sets the duration of the fade animation.
GenericDraweeHierarchyBuilder setFailureImage(Drawable failureDrawable)
Sets the failure image, with default scale type CENTER_INSIDE.
GenericDraweeHierarchyBuilder setFailureImage(Drawable failureDrawable, ScalingUtils.ScaleType failureImageScaleType)
Sets the failure image, and scale type.
GenericDraweeHierarchyBuilder setOverlay(Drawable overlay)
Sets a single overlay.
GenericDraweeHierarchyBuilder setOverlays(List<Drawable> overlays)
Sets the overlays.
GenericDraweeHierarchyBuilder setPlaceholderImage(Drawable placeholderDrawable, ScalingUtils.ScaleType placeholderImageScaleType)
Sets the placeholder image and scale type.
GenericDraweeHierarchyBuilder setPlaceholderImage(Drawable placeholderDrawable)
Sets the placeholder image, with default scale type CENTER_INSIDE.
GenericDraweeHierarchyBuilder setPressedStateOverlay(Drawable drawable)
Sets Overlay for pressed state
GenericDraweeHierarchyBuilder setProgressBarImage(Drawable progressBarImage, ScalingUtils.ScaleType progressBarImageScaleType)
Sets the progressBar image, and scale type.
GenericDraweeHierarchyBuilder setProgressBarImage(Drawable progressBarImage)
Sets the progressBar image, with default scale type CENTER_INSIDE.
GenericDraweeHierarchyBuilder setRetryImage(Drawable retryDrawable)
Sets the retry image, with default scale type CENTER_INSIDE.
GenericDraweeHierarchyBuilder setRetryImage(Drawable retryDrawable, ScalingUtils.ScaleType retryImageScaleType)
Sets the retry image and scale type.
GenericDraweeHierarchyBuilder setRoundingParams(RoundingParams roundingParams)
Sets rounding params.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DEFAULT_FADE_DURATION

Constant Value: 300 (0x0000012c)

Fields

public static final ScalingUtils.ScaleType DEFAULT_ACTUAL_IMAGE_SCALE_TYPE

public static final ScalingUtils.ScaleType DEFAULT_SCALE_TYPE

Public Constructors

public GenericDraweeHierarchyBuilder (Resources resources)

Public Methods

public GenericDraweeHierarchy build ()

public ColorFilter getActualImageColorFilter ()

public PointF getActualImageFocusPoint ()

public Matrix getActualImageMatrix ()

public ScalingUtils.ScaleType getActualImageScaleType ()

public List<Drawable> getBackgrounds ()

public int getFadeDuration ()

public Drawable getFailureImage ()

public ScalingUtils.ScaleType getFailureImageScaleType ()

public List<Drawable> getOverlays ()

public Drawable getPlaceholderImage ()

public ScalingUtils.ScaleType getPlaceholderImageScaleType ()

public Drawable getPressedStateOverlay ()

public Drawable getProgressBarImage ()

public ScalingUtils.ScaleType getProgressBarImageScaleType ()

public Resources getResources ()

Gets resources.

public Drawable getRetryImage ()

public ScalingUtils.ScaleType getRetryImageScaleType ()

public RoundingParams getRoundingParams ()

public static GenericDraweeHierarchyBuilder newInstance (Resources resources)

public GenericDraweeHierarchyBuilder reset ()

Resets this builder to its initial values making it reusable.

Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setActualImageColorFilter (ColorFilter colorFilter)

Sets the color filter.

Parameters
colorFilter color filter to be set
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setActualImageFocusPoint (PointF focusPoint)

Sets the focus point for the actual image. If scale type FOCUS_CROP is used, focus point will attempted to be centered within a view. Each coordinate is a real number in [0,1] range, in the coordinate system where top-left corner of the image corresponds to (0, 0) and the bottom-right corner corresponds to (1, 1).

Parameters
focusPoint focus point of the image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setActualImageMatrix (Matrix actualImageMatrix)

This method is deprecated.
this is likely not something you want

Sets the transformation matrix, and removes the scale type, for the actual image. If matrix is not set, then the image will be drawn without a matrix being applied to it.

Parameters
actualImageMatrix matrix for the actual image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setActualImageScaleType (ScalingUtils.ScaleType actualImageScaleType)

Sets the scale type, and removes the transformation matrix, for the actual image. If scale type is not set, and nor is a transformation matrix, then the actual image will be drawn with scale type CENTER_CROP.

Parameters
actualImageScaleType scale type for the actual image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setBackground (Drawable background)

Sets a single background.

Parameters
background background drawable
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setBackgrounds (List<Drawable> backgrounds)

Sets the backgrounds. Backgrounds are drawn in list order before the rest of the hierarchy and overlays. The first background will be drawn at the bottom.

Parameters
backgrounds background drawables
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setFadeDuration (int fadeDuration)

Sets the duration of the fade animation. If not set, default value of 300ms will be used.

Parameters
fadeDuration duration in milliseconds
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setFailureImage (Drawable failureDrawable)

Sets the failure image, with default scale type CENTER_INSIDE.

Parameters
failureDrawable drawable to be used as failure image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setFailureImage (Drawable failureDrawable, ScalingUtils.ScaleType failureImageScaleType)

Sets the failure image, and scale type.

Parameters
failureDrawable drawable to be used as failure image
failureImageScaleType scale type for the failure image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setOverlay (Drawable overlay)

Sets a single overlay.

Parameters
overlay overlay drawable
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setOverlays (List<Drawable> overlays)

Sets the overlays. Overlays are drawn in list order after the backgrounds and the rest of the hierarchy. The last overlay will be drawn at the top.

Parameters
overlays overlay drawables
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setPlaceholderImage (Drawable placeholderDrawable, ScalingUtils.ScaleType placeholderImageScaleType)

Sets the placeholder image and scale type. If no placeholder is set, a transparent ColorDrawable will be used.

Parameters
placeholderDrawable drawable to be used as placeholder image
placeholderImageScaleType scale type for the placeholder image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setPlaceholderImage (Drawable placeholderDrawable)

Sets the placeholder image, with default scale type CENTER_INSIDE. If no placeholder is set, a transparent ColorDrawable will be used.

Parameters
placeholderDrawable drawable to be used as placeholder image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setPressedStateOverlay (Drawable drawable)

Sets Overlay for pressed state

Parameters
drawable for pressed state

public GenericDraweeHierarchyBuilder setProgressBarImage (Drawable progressBarImage, ScalingUtils.ScaleType progressBarImageScaleType)

Sets the progressBar image, and scale type.

Parameters
progressBarImage drawable to be used as progressBar image
progressBarImageScaleType scale type for the progressBar image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setProgressBarImage (Drawable progressBarImage)

Sets the progressBar image, with default scale type CENTER_INSIDE.

Parameters
progressBarImage drawable to be used as progressBar image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setRetryImage (Drawable retryDrawable)

Sets the retry image, with default scale type CENTER_INSIDE.

Parameters
retryDrawable drawable to be used as retry image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setRetryImage (Drawable retryDrawable, ScalingUtils.ScaleType retryImageScaleType)

Sets the retry image and scale type.

Parameters
retryDrawable drawable to be used as retry image
retryImageScaleType scale type for the retry image
Returns
  • modified instance of this builder

public GenericDraweeHierarchyBuilder setRoundingParams (RoundingParams roundingParams)

Sets rounding params.

Parameters
roundingParams rounding params to be set
Returns
  • modified instance of this builder