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.LinearInterpolator;
import android.view.animation.TranslateAnimation;

public class Main {
    private static final int ANIMATION_DURATION = 200;
    private static final LinearInterpolator sAnimationInterpolator = new LinearInterpolator();

    public static void showViewFromBottom(View view) {
        if (view.getVisibility() == View.VISIBLE) {
            return;
        }
        view.setVisibility(View.VISIBLE);
        int height = view.getHeight();
        TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0,
                Animation.ABSOLUTE, height, Animation.ABSOLUTE, 0);
        translateAnimation.setDuration(ANIMATION_DURATION);
        translateAnimation.setInterpolator(sAnimationInterpolator);
        view.startAnimation(translateAnimation);
    }
}