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

import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class Main {
    private static final int ANIMATION_SPEED = 100;

    public static void slideInLeft(View view) {
        slideInLeft(view, ANIMATION_SPEED);
    }

    /**
     * Animates a view sliding in from the left
     * @param view
     */
    public static void slideInLeft(final View view, int duration) {
        final Animation inLeft = new TranslateAnimation(view.getX() - view.getWidth(), 0, 0, view.getX());
        inLeft.setDuration(duration);
        view.startAnimation(inLeft);
    }
}