private void setAction(Action action, boolean animate, int rotation) { if (action == null) { return; } this.rotation = rotation; if (currentAction == null) { currentAction = action; currentAction.flipHorizontally(); animationProgress = 1f; UiHelper.postInvalidateOnAnimation(this); return; } if (currentAction.getClass().equals(action.getClass())) { return; } oldAction = currentAction; currentAction = action; if (animate) { animationProgress = 0f; if (ready) { startAnimation(); } else { animateWhenReady = true; } } else { animationProgress = 1f; UiHelper.postInvalidateOnAnimation(this); } }
/** * Set the color used for drawing an {@link at.markushi.ui.action.Action}. * * @param color */ public void setColor(final int color) { this.color = color; paint.setColor(color); UiHelper.postInvalidateOnAnimation(this); }
public void setAnimationProgress(float animationProgress) { this.animationProgress = animationProgress; UiHelper.postInvalidateOnAnimation(this); }