ble.
* @return top level drawable
*/
public Drawable getTopLevelDrawable();
}
DraweeController 也是一个接口,暴露了设置 hierarchy 和接收 Event 的方法。
void setHierarchy(@Nullable DraweeHierarchy hierarchy)
public boolean onTouchEvent(MotionEvent event)
/**
* Interface that represents a Drawee controller used by a DraweeView.
*
The view forwards events to the controller. The controller controls * its hierarchy based on those events. */ public interface DraweeController { /** Gets the hierarchy. */ @Nullable public DraweeHierarchy getHierarchy(); /** Sets a new hierarchy. */ void setHierarchy(@Nullable DraweeHierarchy hierarchy); /** * Called when the view containing the hierarchy is attached to a window * (either temporarily or permanently). */ public void onAttach(); /** * Called when the view containing the hierarchy is detached from a window * (either temporarily or permanently). */ public void onDetach(); /** * Called when the view containing the hierarchy receives a touch event. * @return true if the event was handled by the controller, false otherwise */ public boolean onTouchEvent(MotionEvent event); /** * For an animated image, returns an Animatable that lets clients control the animation. * @return animatable, or null if the image is not animated or not loaded yet */ public Animatable getAnimatable(); }
通过以上分析可以看出,DraweeController、DraweeHierarchy、DraweeView 三者共同构成了 Fresco 的三驾马车,下面的博文会各个击破,分析他们的实现原理和代码层次。