Back to Fresco

DraweeHolder

docs/javadoc/reference/com/facebook/drawee/view/DraweeHolder.html

3.6.018.0 KB
Original Source

Fresco

|

|

Packages | Classes

Classes

Packages | Classes

Summary: Ctors | Methods | Protected Methods | Inherited Methods | [Expand All]

public class

DraweeHolder

extends Object
implements VisibilityCallback

| java.lang.Object | | ↳ | com.facebook.drawee.view.DraweeHolder<DH extends com.facebook.drawee.interfaces.DraweeHierarchy> |

Class Overview

A holder class for Drawee controller and hierarchy.

Drawee users, should, as a rule, use DraweeView or its subclasses. There are situations where custom views are required, however, and this class is for those circumstances.

Each DraweeHierarchy object should be contained in a single instance of this class.

Users of this class must call setBounds(Rect) on the top-level drawable of the DraweeHierarchy. Otherwise the drawable will not be drawn.

The containing view must also call onDetach() from its onStartTemporaryDetach() and onDetachedFromWindow() methods. It must call onAttach() from its onFinishTemporaryDetach() and onAttachedToWindow() methods.

Summary

Public Constructors
Creates a new instance of DraweeHolder.
Public Methods
static <DH extends DraweeHierarchy> DraweeHolder<DH>
Creates a new instance of DraweeHolder that detaches / attaches controller whenever context notifies it about activity's onStop and onStart callbacks.
DraweeController
Gets the controller if set, null otherwise.
DH
Gets the drawee hierarchy if set, throws NPE otherwise.
Drawable
Gets the top-level drawable if hierarchy is set, null otherwise.
boolean
Returns whether the hierarchy is set or not.
boolean
Checks whether the view that uses this holder is currently attached to a window.
boolean
Returns whether currently set controller is valid: not null and attached to the hierarchy that is held by the holder
void
Gets the controller ready to display the image.
void
Releases resources used to display the image.
void
Callback used to notify about top-level-drawable being drawn.
boolean
Forwards the touch event to the controller.
void
Callback used to notify about top-level-drawable's visibility changes.
void
For future use.
void
Sets a new controller.
void
Sets the drawee hierarchy.
String
Protected Methods
DraweeEventTracker

| [Expand] Inherited Methods | | --- | | From class java.lang.Object

| Object | clone() | | boolean | equals(Object arg0) | | void | finalize() | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |

| | From interface com.facebook.drawee.drawable.VisibilityCallback

| abstract void | onDraw() Called when the drawable gets drawn. | | abstract void | onVisibilityChange(boolean visible) Called when the drawable's visibility changes. |

|

Public Constructors

public DraweeHolder(DH hierarchy)

Creates a new instance of DraweeHolder.

Public Methods

public static DraweeHolder<DH> create(DH hierarchy, Context context)

Creates a new instance of DraweeHolder that detaches / attaches controller whenever context notifies it about activity's onStop and onStart callbacks.

public DraweeController getController()

Gets the controller if set, null otherwise.

public DH getHierarchy()

Gets the drawee hierarchy if set, throws NPE otherwise.

public Drawable getTopLevelDrawable()

Gets the top-level drawable if hierarchy is set, null otherwise.

public boolean hasHierarchy()

Returns whether the hierarchy is set or not.

public boolean isAttached()

Checks whether the view that uses this holder is currently attached to a window.

Returns
  • true if the holder is currently attached
See Also
  • onAttach()
  • onDetach()

public boolean isControllerValid()

Returns whether currently set controller is valid: not null and attached to the hierarchy that is held by the holder

public void onAttach()

Gets the controller ready to display the image.

The containing view must call this method from both onFinishTemporaryDetach() and onAttachedToWindow().

public void onDetach()

Releases resources used to display the image.

The containing view must call this method from both onStartTemporaryDetach() and onDetachedFromWindow().

public void onDraw()

Callback used to notify about top-level-drawable being drawn.

public boolean onTouchEvent(MotionEvent event)

Forwards the touch event to the controller.

Parameters

| event | touch event to handle |

Returns
  • whether the event was handled or not

public void onVisibilityChange(boolean isVisible)

Callback used to notify about top-level-drawable's visibility changes.

Parameters

| isVisible | whether or not the drawable is visible |

public void registerWithContext(Context context)

For future use.

public void setController(DraweeController draweeController)

Sets a new controller.

public void setHierarchy(DH hierarchy)

Sets the drawee hierarchy.

public String toString()

Protected Methods

protected DraweeEventTracker getDraweeEventTracker()

+Generated by Doclava. +