Search in sources :

Example 1 with AnimatorViewHolder

use of im.actor.sdk.controllers.fragment.AnimatorViewHolder in project actor-platform by actorapp.

the class CustomItemAnimator method animateMove.

@Override
public boolean animateMove(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
    if (holder instanceof AnimatorViewHolder) {
        if (!((AnimatorViewHolder) holder).performAnimation()) {
            return false;
        }
    }
    final View view = holder.itemView;
    fromX += ViewCompat.getTranslationX(holder.itemView);
    fromY += ViewCompat.getTranslationY(holder.itemView);
    resetAnimation(holder);
    int deltaX = toX - fromX;
    int deltaY = toY - fromY;
    if (deltaX == 0 && deltaY == 0) {
        dispatchMoveFinished(holder);
        return false;
    }
    if (deltaX != 0) {
        ViewCompat.setTranslationX(view, -deltaX);
    }
    if (deltaY != 0) {
        ViewCompat.setTranslationY(view, -deltaY);
    }
    mPendingMoves.add(new MoveInfo(holder, fromX, fromY, toX, toY));
    return true;
}
Also used : AnimatorViewHolder(im.actor.sdk.controllers.fragment.AnimatorViewHolder) View(android.view.View)

Aggregations

View (android.view.View)1 AnimatorViewHolder (im.actor.sdk.controllers.fragment.AnimatorViewHolder)1