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

Fields
protected ControllerListener<INFO> mControllerListener
protected ForwardingControllerListener2<INFO> mControllerListener2
protected Drawable mDrawable
protected LoggingListener mLoggingListener
Public Constructors
AbstractDraweeController(DeferredReleaser deferredReleaser, Executor uiThreadImmediateExecutor, String id, Object callerContext)
Public Methods
void addControllerListener(ControllerListener<? super INFO> controllerListener)
Adds controller listener.
void addControllerListener2(ControllerListener2<INFO> controllerListener2)
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.
abstract Map<String, Object> obtainExtrasFromImage(INFO info)
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 removeControllerListener2(ControllerListener2<INFO> controllerListener2)
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.
void setLoggingListener(LoggingListener loggingListener)
String toString()
Protected Methods
abstract Drawable createDrawable(T image)
T getCachedImage()
ControllerListener<INFO> getControllerListener()
Gets controller listener for internal use.
ControllerListener2<INFO> getControllerListener2()
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)
LoggingListener getLoggingListener()
Uri getMainUri()
RetryManager getRetryManager()
Gets retry manager.
void initialize(String id, Object callerContext)
Initializes this controller with the new id and caller context.
void onImageLoadedFromCacheImmediately(String id, T cachedImage)
abstract void releaseDrawable(Drawable drawable)
abstract void releaseImage(T image)
void reportSubmit(DataSource<T> dataSource, INFO info)
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

Fields

protected ControllerListener<INFO> mControllerListener

protected ForwardingControllerListener2<INFO> mControllerListener2

protected Drawable mDrawable

protected LoggingListener mLoggingListener

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 void addControllerListener2 (ControllerListener2<INFO> controllerListener2)

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 abstract Map<String, Object> obtainExtrasFromImage (INFO info)

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 removeControllerListener2 (ControllerListener2<INFO> controllerListener2)

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 void setLoggingListener (LoggingListener loggingListener)

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 ControllerListener2<INFO> getControllerListener2 ()

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 LoggingListener getLoggingListener ()

protected Uri getMainUri ()

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 void onImageLoadedFromCacheImmediately (String id, T cachedImage)

protected abstract void releaseDrawable (Drawable drawable)

protected abstract void releaseImage (T image)

protected void reportSubmit (DataSource<T> dataSource, INFO info)

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 ()