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.AlphaAnimation;
import android.view.animation.Interpolator;

public class Main {
    /**
     * Animate a view to fade in.
     *
     * @param view         The view to be animated.
     * @param duration     Duration that the animation should run, in milliseconds; specify -1 to use the default.
     * @param interpolator The interpolator which defines the acceleration curve; can be null to use default.
     */
    public static void startFadeIn(View view, long duration, Interpolator interpolator) {
        AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
        if (duration > 0) {
            alphaAnimation.setDuration(duration);
        }
        if (interpolator != null) {
            alphaAnimation.setInterpolator(interpolator);
        }
        view.startAnimation(alphaAnimation);
    }
}