- * {@link #acquire(long)} must have been called before this. - * - * @throws IllegalStateException if the current context is different than the one owned by - * the scene, or if {@link #acquire(long)} was not called. - * - * @see RenderSession#animate(Object, String, boolean, IAnimationListener) - */ - public Result animate(Object targetObject, String animationName, - boolean isFrameworkAnimation, IAnimationListener listener) { - checkLock(); - - BridgeContext context = getContext(); - - // find the animation file. - ResourceValue animationResource = null; - int animationId = 0; - if (isFrameworkAnimation) { - animationResource = context.getRenderResources().getFrameworkResource( - ResourceType.ANIMATOR, animationName); - if (animationResource != null) { - animationId = Bridge.getResourceId(ResourceType.ANIMATOR, animationName); - } - } else { - animationResource = context.getRenderResources().getProjectResource( - ResourceType.ANIMATOR, animationName); - if (animationResource != null) { - animationId = context.getProjectCallback().getResourceId( - ResourceType.ANIMATOR, animationName); - } - } - - if (animationResource != null) { - try { - Animator anim = AnimatorInflater.loadAnimator(context, animationId); - if (anim != null) { - anim.setTarget(targetObject); - - new PlayAnimationThread(anim, this, animationName, listener).start(); - - return SUCCESS.createResult(); - } - } catch (Exception e) { - // get the real cause of the exception. - Throwable t = e; - while (t.getCause() != null) { - t = t.getCause(); - } - - return ERROR_UNKNOWN.createResult(t.getMessage(), t); - } - } - - return ERROR_ANIM_NOT_FOUND.createResult(); - } - /** * Insert a new child into an existing parent. *
@@ -562,7 +455,7 @@ public class RenderSessionImpl extends RenderAction