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.view.View;

import android.view.animation.Animation;

import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation;

import java.util.List;

public class Main {
    /**
     * Helps to show views.
     *
     * @param views             Views to show.
     * @param animationDuration Animation duration.
     * @param animationDelay    Animation delay.
     */
    static void orderedShowViews(final List<View> views, long animationDuration, int animationDelay) {
        if (views != null) {
            for (int viewIndex = 0; viewIndex < views.size(); viewIndex++) {
                final View childView = views.get(viewIndex);
                childView.setVisibility(View.VISIBLE);
                final ScaleAnimation scaleAnimation = new ScaleAnimation(0, childView.getScaleX(), 0,
                        childView.getScaleY(), Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
                scaleAnimation.setInterpolator(new DecelerateInterpolator());
                scaleAnimation.setDuration(animationDuration);
                scaleAnimation.setStartOffset(viewIndex * animationDelay);
                childView.startAnimation(scaleAnimation);
            }
        }
    }
}