public abstract class

AbstractDraweeController

extends Object
implements DeferredReleaser.Releasable GestureDetector.ClickListener DraweeController
java.lang.Object
   ↳ com.facebook.drawee.controller.AbstractDraweeController<T, INFO>
Known Direct Subclasses

Class Overview

Abstract Drawee controller that implements common functionality regardless of the backend used to fetch the image. All methods should be called on the main UI thread.

Summary

Public Constructors
AbstractDraweeController(DeferredReleaser deferredReleaser, Executor uiThreadImmediateExecutor, String id, Object callerContext)
Public Methods
void addControllerListener(ControllerListener<? super INFO> controllerListener)
Adds controller listener.
Animatable getAnimatable()
For an animated image, returns an Animatable that lets clients control the animation.
Object getCallerContext()
Gets the analytic tag & caller context
String getContentDescription()
Gets accessibility content description.
DraweeHierarchy getHierarchy()
Gets the hierarchy
String getId()
Gets the controller id.
void onAttach()
Called when the view containing the hierarchy is attached to a window (either temporarily or permanently).
boolean onClick()
void onDetach()
Called when the view containing the hierarchy is detached from a window (either temporarily or permanently).
boolean onTouchEvent(MotionEvent event)
Called when the view containing the hierarchy receives a touch event.
void onViewportVisibilityHint(boolean isVisibleInViewportHint)
An optional hint whether the view containing the hierarchy is currently within the visible viewport or not.
void release()
void removeControllerListener(ControllerListener<? super INFO> controllerListener)
Removes controller listener.
void setContentDescription(String contentDescription)
Sets accessibility content description.
void setControllerViewportVisibilityListener(ControllerViewportVisibilityListener controllerViewportVisibilityListener)
Sets the controller viewport visibility listener
void setHierarchy(DraweeHierarchy hierarchy)
Sets the hierarchy.
String toString()
Protected Methods
abstract Drawable createDrawable(T image)
T getCachedImage()
ControllerListener<INFO> getControllerListener()
Gets controller listener for internal use.
Drawable getControllerOverlay()
Gets the controller overlay
abstract DataSource<T> getDataSource()
GestureDetector getGestureDetector()
Gets gesture detector.
String getImageClass(T image)
int getImageHash(T image)
abstract INFO getImageInfo(T image)
RetryManager getRetryManager()
Gets retry manager.
void initialize(String id, Object callerContext)
Initializes this controller with the new id and caller context.
abstract void releaseDrawable(Drawable drawable)
abstract void releaseImage(T image)
void setControllerOverlay(Drawable controllerOverlay)
Sets the controller overlay
void setGestureDetector(GestureDetector gestureDetector)
Sets gesture detector.
void setRetainImageOnFailure(boolean enabled)
Sets whether to display last available image in case of failure.
boolean shouldHandleGesture()
Returns whether the gesture should be handled by the controller
void submitRequest()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.facebook.drawee.components.DeferredReleaser.Releasable
From interface com.facebook.drawee.gestures.GestureDetector.ClickListener
From interface com.facebook.drawee.interfaces.DraweeController

Public Constructors

public AbstractDraweeController (DeferredReleaser deferredReleaser, Executor uiThreadImmediateExecutor, String id, Object callerContext)

Public Methods

public void addControllerListener (ControllerListener<? super INFO> controllerListener)

Adds controller listener.

public Animatable getAnimatable ()

For an animated image, returns an Animatable that lets clients control the animation.

Returns
  • animatable, or null if the image is not animated or not loaded yet

public Object getCallerContext ()

Gets the analytic tag & caller context

public String getContentDescription ()

Gets accessibility content description.

Returns
  • content description, or null if the image has no content description

public DraweeHierarchy getHierarchy ()

Gets the hierarchy

public String getId ()

Gets the controller id.

public void onAttach ()

Called when the view containing the hierarchy is attached to a window (either temporarily or permanently).

public boolean onClick ()

public void onDetach ()

Called when the view containing the hierarchy is detached from a window (either temporarily or permanently).

public boolean onTouchEvent (MotionEvent event)

Called when the view containing the hierarchy receives a touch event.

Returns
  • true if the event was handled by the controller, false otherwise

public void onViewportVisibilityHint (boolean isVisibleInViewportHint)

An optional hint whether the view containing the hierarchy is currently within the visible viewport or not.

public void release ()

public void removeControllerListener (ControllerListener<? super INFO> controllerListener)

Removes controller listener.

public void setContentDescription (String contentDescription)

Sets accessibility content description.

public void setControllerViewportVisibilityListener (ControllerViewportVisibilityListener controllerViewportVisibilityListener)

Sets the controller viewport visibility listener

public void setHierarchy (DraweeHierarchy hierarchy)

Sets the hierarchy.

The controller should be detached when this method is called.

Parameters
hierarchy This must be an instance of SettableDraweeHierarchy

public String toString ()

Protected Methods

protected abstract Drawable createDrawable (T image)

protected T getCachedImage ()

protected ControllerListener<INFO> getControllerListener ()

Gets controller listener for internal use.

protected Drawable getControllerOverlay ()

Gets the controller overlay

protected abstract DataSource<T> getDataSource ()

protected GestureDetector getGestureDetector ()

Gets gesture detector.

protected String getImageClass (T image)

protected int getImageHash (T image)

protected abstract INFO getImageInfo (T image)

protected RetryManager getRetryManager ()

Gets retry manager.

protected void initialize (String id, Object callerContext)

Initializes this controller with the new id and caller context. This allows for reusing of the existing controller instead of instantiating a new one. This method should be called when the controller is in detached state.

Parameters
id unique id for this controller
callerContext tag and context for this controller

protected abstract void releaseDrawable (Drawable drawable)

protected abstract void releaseImage (T image)

protected void setControllerOverlay (Drawable controllerOverlay)

Sets the controller overlay

protected void setGestureDetector (GestureDetector gestureDetector)

Sets gesture detector.

protected void setRetainImageOnFailure (boolean enabled)

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

protected boolean shouldHandleGesture ()

Returns whether the gesture should be handled by the controller

protected void submitRequest ()