Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.view.View;

import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;

public class Main {
    public static void startRepeatSelfRotateAnimation(View v, long duration, Animation.AnimationListener listener) {
        RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,
                Animation.RELATIVE_TO_SELF, 0.5f);
        animation.setDuration(duration);
        animation.setRepeatCount(-1); // Repeat animation
        animation.setFillAfter(true);
        animation.setRepeatMode(Animation.INFINITE); //
        LinearInterpolator lir = new LinearInterpolator();
        animation.setInterpolator(lir);
        if (listener != null) {
            animation.setAnimationListener(listener);
        }
        v.startAnimation(animation);
    }
}