Animation setAnimationListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Animation setAnimationListener method.

This code example shows how to use the following methods:setAnimationListener, setDuration, setFillBefore, setFillEnabled, setInterpolator
This code example shows how to use the following methods:setAnimationListener, setDuration, setInterpolator
      anim=new TranslateAnimation(0.0f, 0.0f,
                                  getHeight(),
                                  0.0f); 
    } 
    else { 
      anim=new TranslateAnimation(0.0f, 0.0f, 0.0f,
                                  getHeight());
      anim.setAnimationListener(collapseListener);
    } 
     
    anim.setDuration(speed);
    anim.setInterpolator(new AccelerateInterpolator(1.0f));
    startAnimation(anim);
  } 
   
  Animation.AnimationListener collapseListener=new Animation.AnimationListener() {
    public void onAnimationEnd(Animation animation) { 
      setVisibility(View.INVISIBLE); 
    } 
     
8
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration
	            break; 
	        case BOTTOM:
	            y=getHeight();
	            break; 
		}		 
		TranslateAnimation anim=new TranslateAnimation(0, x, 0,y);
		anim.setDuration(ANIM_DURATION);
		anim.setAnimationListener(new AnimationListener() {
			 
			//@Override 
			public void onAnimationStart(Animation animation) {
				// TODO Auto-generated method stub 
			} 
			 
			//@Override 
			public void onAnimationRepeat(Animation animation) {
				// TODO Auto-generated method stub 
			} 
			 
			//@Override 
7
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration, setFillBefore, setFillEnabled, setInterpolator
This code example shows how to use the following methods:setAnimationListener, setDuration
    } 
 
    @Override 
    public void onSizeChanged(int w, int h, int oldW, int oldH) {
        mWidth = w;
        inLeft   = new TranslateAnimation(mWidth, 0, 0, 0);
        inLeft.setAnimationListener(this);
        outLeft  = new TranslateAnimation(0, -mWidth, 0, 0);
        inRight  = new TranslateAnimation(-mWidth, 0, 0, 0);
        inRight.setAnimationListener(this);
        outRight = new TranslateAnimation(0, mWidth, 0, 0);
 
        inLeft.setDuration(ANIM_DURATION);
        outLeft.setDuration(ANIM_DURATION);
        inRight.setDuration(ANIM_DURATION);
        outRight.setDuration(ANIM_DURATION);
    } 
 
    @Override 
    protected void onFinishInflate() { 
7
CodeRank
This code example shows how to use the following methods:setAnimationListener
      anim=new TranslateAnimation(0.0f, 0.0f,
                                  getHeight(),
                                  0.0f); 
    } 
    else { 
      anim=new TranslateAnimation(0.0f, 0.0f, 0.0f,
                                  getHeight());
      anim.setAnimationListener(collapseListener);
      set.addAnimation(fadeOut);
    } 
     
    set.addAnimation(anim);
    set.setDuration(speed);
    set.setInterpolator(new AccelerateInterpolator(1.0f));
    startAnimation(set);
  } 
   
  Animation.AnimationListener collapseListener=new Animation.AnimationListener() {
    public void onAnimationEnd(Animation animation) { 
      setVisibility(View.INVISIBLE); 
7
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration, setInterpolator
				} 
				postProcess(); 
				return; 
			} 
			 
			animation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta); 
			animation.setDuration(calculatedDuration); 
			animation.setAnimationListener(animationListener); 
			if (mState == State.FLYING && mLinearFlying) { 
				animation.setInterpolator(new LinearInterpolator()); 
			} else 
			if (mInterpolator != null) { 
				animation.setInterpolator(mInterpolator); 
			} 
			startAnimation(animation); 
		} 
	}; 
 
	private AnimationListener animationListener = new AnimationListener() {
		public void onAnimationEnd(Animation animation) { 
7
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration
public class Shake { 
	public static void shake(final View v, final int time){
		int duration = 50;
		int length = 10;
		final TranslateAnimation toRight = new TranslateAnimation(0, length, 0, 0);
		final TranslateAnimation toLeft = new TranslateAnimation(length, -length, 0, 0);
		final TranslateAnimation toCenter = new TranslateAnimation(-length, 0, 0, 0);
		toRight.setDuration(duration);
		toLeft.setDuration(duration * 2);
		toCenter.setDuration(duration);
		toRight.setAnimationListener(new AnimationListener() {
			 
			public void onAnimationStart(Animation animation) {
				 
			} 
			 
			public void onAnimationRepeat(Animation animation) {
				 
			} 
			 

7
CodeRank
This code example shows how to use the following methods:setAnimation, setAnimationListener, startNow, addAnimation, setDuration
			anim.setDuration(500);
			anim.startNow();
		} else if (!visible && mStates[menu] != STATE_OUT) {
			mStates[menu] = STATE_OUT;
 
			AnimationSet anim = new AnimationSet(true);
			anim.addAnimation(new AlphaAnimation(1f, 0f));
			if (fadeRight) {
				anim.addAnimation(new TranslateAnimation(0f, 100f, 0f, 0f));
			} else { 
				anim.addAnimation(new TranslateAnimation(0f, -100f, 0f, 0f));
			} 
 
			mMenus[menu].setAnimation(anim);
			anim.setDuration(500);
			anim.setAnimationListener(new Animation.AnimationListener() {
				@Override 
				public void onAnimationEnd(Animation anim) {
					mMenus[menu].setVisibility(View.GONE);
				} 

7
CodeRank
This code example shows how to use the following methods:setAnimationListener, setDuration, setFillAfter, setInterpolator, setStartOffset
    } 
 
    private static Animation createExpandAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
            long startOffset, long duration, Interpolator interpolator) {
        Animation animation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 0, 720);
        animation.setStartOffset(startOffset);
        animation.setDuration(duration);
        animation.setInterpolator(interpolator);
        animation.setFillAfter(true);
 
        return animation;
    } 
 
    private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta,
            long startOffset, long duration, Interpolator interpolator) {
        AnimationSet animationSet = new AnimationSet(false);
        animationSet.setFillAfter(true);
 
        final long preDuration = duration / 2;
        Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f,

8
CodeRank

Related Animation setAnimationListener Questions & Answers:

Other Animation setAnimationListener Examples

32:			
33:			// set animation listener
34:			animFadein.setAnimationListener(this);
35:	
36:			// button click event

Read More

setAnimationListener Method Overview
Binds an animation listener to this animation.
See Code Examples for other Android Animation Methods: