Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.view.View;

import android.view.animation.Animation.AnimationListener;

import android.view.animation.RotateAnimation;

public class Main {
    private static final int ANIMATION_DURATION = 300;

    public static void animateRotate(final View animated, float fromDegrees, float toDegrees,
            AnimationListener listener) {
        if (animated == null) {
            return;
        }

        final RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, animated.getWidth() / 2,
                animated.getHeight() / 2);
        rotate.setDuration(ANIMATION_DURATION);
        rotate.setAnimationListener(listener);
        animated.startAnimation(rotate);
    }
}