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.Animator;
import android.animation.ValueAnimator;
import android.view.View;

public class Main {
    private static final long mAnimeDuration = 300;

    public static void startScaleAnime(final View view, float newScale, Animator.AnimatorListener listener) {
        ValueAnimator anime = ValueAnimator.ofFloat(view.getScaleX(), newScale);
        anime.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                float s = Float.parseFloat(animation.getAnimatedValue().toString());
                view.setScaleX(s);
                view.setScaleY(s);
            }
        });
        if (listener != null) {
            anime.addListener(listener);
        }
        anime.setDuration(mAnimeDuration);
        anime.start();
    }
}