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.AnimatorListenerAdapter;
import android.os.Build;
import android.view.View;

public class Main {
    public static void fadeViewOut(final View view, final int duration) {
        if (view.getVisibility() == View.GONE)
            return;
        if (Build.VERSION.SDK_INT >= 12) {
            view.animate().setDuration(duration).alpha(0f).setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(View.GONE);
                }
            });
        } else {
            view.setVisibility(View.GONE);
        }
    }
}