java.lang.Object | |
↳ | com.facebook.drawee.view.DraweeHolder<DH extends com.facebook.drawee.interfaces.DraweeHierarchy> |
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.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DraweeHolder(DH hierarchy)
Creates a new instance of DraweeHolder.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static <DH extends DraweeHierarchy> 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.
| ||||||||||
DraweeController |
getController()
Gets the controller if set, null otherwise.
| ||||||||||
DH |
getHierarchy()
Gets the drawee hierarchy if set, throws NPE otherwise.
| ||||||||||
Drawable |
getTopLevelDrawable()
Gets the top-level drawable if hierarchy is set, null otherwise.
| ||||||||||
boolean |
hasHierarchy()
Returns whether the hierarchy is set or not.
| ||||||||||
boolean |
isAttached()
Checks whether the view that uses this holder is currently attached to a window.
| ||||||||||
boolean |
isControllerValid()
Returns whether currently set controller is valid: not null and attached to the hierarchy that
is held by the holder
| ||||||||||
void |
onAttach()
Gets the controller ready to display the image.
| ||||||||||
void |
onDetach()
Releases resources used to display the image.
| ||||||||||
void |
onDraw()
Callback used to notify about top-level-drawable being drawn.
| ||||||||||
boolean |
onTouchEvent(MotionEvent event)
Forwards the touch event to the controller.
| ||||||||||
void |
onVisibilityChange(boolean isVisible)
Callback used to notify about top-level-drawable's visibility changes.
| ||||||||||
void |
registerWithContext(Context context)
For future use.
| ||||||||||
void |
setController(DraweeController draweeController)
Sets a new controller.
| ||||||||||
void |
setHierarchy(DH hierarchy)
Sets the drawee hierarchy.
| ||||||||||
String | toString() |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DraweeEventTracker | getDraweeEventTracker() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.facebook.drawee.drawable.VisibilityCallback
|
Creates a new instance of DraweeHolder.
Creates a new instance of DraweeHolder that detaches / attaches controller whenever context notifies it about activity's onStop and onStart callbacks.
Gets the drawee hierarchy if set, throws NPE otherwise.
Gets the top-level drawable if hierarchy is set, null otherwise.
Returns whether the hierarchy is set or not.
Checks whether the view that uses this holder is currently attached to a window.
Returns whether currently set controller is valid: not null and attached to the hierarchy that is held by the holder
Gets the controller ready to display the image.
The containing view must call this method from both onFinishTemporaryDetach()
and onAttachedToWindow()
.
Releases resources used to display the image.
The containing view must call this method from both onStartTemporaryDetach()
and onDetachedFromWindow()
.
Callback used to notify about top-level-drawable being drawn.
Forwards the touch event to the controller.
event | touch event to handle |
---|
Callback used to notify about top-level-drawable's visibility changes.
isVisible | whether or not the drawable is visible |
---|
For future use.
Sets the drawee hierarchy.