/*
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.drawee.interfaces;
import javax.annotation.Nullable;
import android.graphics.drawable.Animatable;
import android.view.MotionEvent;
/**
* Interface that represents a Drawee controller used by a DraweeView.
* <p> 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();
}