Example usage for android.view.animation TranslateAnimation setAnimationListener

List of usage examples for android.view.animation TranslateAnimation setAnimationListener

Introduction

In this page you can find the example usage for android.view.animation TranslateAnimation setAnimationListener.

Prototype

public void setAnimationListener(AnimationListener listener) 

Source Link

Document

Binds an animation listener to this animation.

Usage

From source file:Main.java

public static TranslateAnimation getTranslation(int fromX, int toX, int fromY, int toY, int duration,
        Animation.AnimationListener listener) {

    TranslateAnimation anim = new TranslateAnimation(fromX, toX, fromY, toY);
    anim.setDuration(duration);/*ww  w .  j  ava 2 s .c om*/
    anim.setFillAfter(true);

    anim.setAnimationListener(listener);
    return anim;
}

From source file:Main.java

public static Animation inFromRightAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 1F, 2, 0F, 2, 0F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation inFromBottomQuickAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 1F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new DecelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToBottomQuickAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 0F, 2, 1F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToBottomAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 0F, 2, 1F);
    translateanimation.setDuration(600L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation inFromBottomAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 0F, 2, 1F, 2, 0F);
    translateanimation.setDuration(600L);
    translateanimation.setInterpolator(new DecelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation inFromLeftAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, -1F, 2, 0F, 2, 0F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToLeftAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, -1F, 2, 0F, 2, 0F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static Animation outToRightAnimation(
        final android.view.animation.Animation.AnimationListener animationlistener) {
    final TranslateAnimation translateanimation = new TranslateAnimation(2, 0F, 2, 1F, 2, 0F, 2, -1F);
    translateanimation.setDuration(300L);
    translateanimation.setInterpolator(new AccelerateInterpolator());
    translateanimation.setAnimationListener(animationlistener);
    return translateanimation;
}

From source file:Main.java

public static void SlideInRight(View v, final Runnable onComplete) {
    v.clearAnimation();// w  w  w  . j a  v a 2s  .co  m
    TranslateAnimation aout = new TranslateAnimation(Animation.RELATIVE_TO_SELF, -1f,
            Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f);
    aout.setDuration(300);
    v.startAnimation(aout);
    if (onComplete != null)
        aout.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation arg0) {
            }

            @Override
            public void onAnimationRepeat(Animation arg0) {
            }

            @Override
            public void onAnimationEnd(Animation arg0) {
                onComplete.run();
            }
        });
}