Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;
import android.view.View;

import android.view.animation.BounceInterpolator;
import android.view.animation.TranslateAnimation;

public class Main {
    /**
     *    move the background view(translate animation).
     * 
     * @param view
     *          the view will be moved
     * @param durationMillis
     *          translate animation duration
     * @param fromX
     *          from X coordinate
     * @param toX
     *          to X coordinate
     * @param fromY
     *          from Y coordinate
     * @param toY
     *          to Y coordinate
     */
    public static void translateFromAbove(final Context context, final View view, final long durationMillis,
            boolean fillAfter, float fromX, float toX, final float fromY, final float toY) {
        TranslateAnimation translateAnimation = new TranslateAnimation(fromX, toX, fromY, toY + 5);
        translateAnimation.setInterpolator(new BounceInterpolator());
        translateAnimation.setDuration(durationMillis);
        translateAnimation.setFillAfter(fillAfter);//this animation performed will persist when it is finished
        view.startAnimation(translateAnimation);
    }
}