Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;

public class Main {
    public static final long DEFAULT_DURATION = 300;

    public static ObjectAnimator animateMove(Object target, int x, int y, long duration, long startDelay) {
        ObjectAnimator animator = getAnimator(target);
        animator.setDuration(duration).setStartDelay(startDelay);

        animator.setValues(PropertyValuesHolder.ofInt("x", x), PropertyValuesHolder.ofInt("y", y));

        animator.start();
        return animator;
    }

    public static ObjectAnimator animateMove(Object target, int x, int y) {
        return animateMove(target, x, y, DEFAULT_DURATION, 0);
    }

    private static ObjectAnimator getAnimator(Object target) {
        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(target);
        return animator;
    }
}