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

public class Main {
    private static int defaultDuration = 500;

    public static void animAlpha(View view, float fromAlpha, float toAlpha) {
        animAlpha(view, fromAlpha, toAlpha, defaultDuration);
    }

    public static void animAlpha(View view, float fromAlpha, float toAlpha, int duration) {
        ObjectAnimator.ofFloat(view, "alpha", fromAlpha, toAlpha).setDuration(duration).start();
    }

    public static void animAlpha(View view, float fromAlpha, float toAlpha, int duration, int delay) {
        Animator anim = ObjectAnimator.ofFloat(view, "alpha", fromAlpha, toAlpha).setDuration(duration);
        anim.setStartDelay(delay);
        anim.start();
    }
}