Animation setRepeatCount - 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 setRepeatCount method.

This code example shows how to use the following methods:setRepeatCount, addAnimation, setRepeatMode
  /* 
   * Animates a component moving it horizontally. 
   */ 
  private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
    float sign = left ? 1f : -1f;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setRepeatCount(Animation.INFINITE);
    animationSet.setRepeatMode(Animation.RESTART);
 
    TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
        Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
        Animation.RELATIVE_TO_PARENT, 0);
    move.setStartOffset(0);
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
  } 
 
  /** 
   * Animates a component (using pre-defined animation kinds). 
7
CodeRank
This code example shows how to use the following methods:setDuration, setInterpolator, setRepeatCount
			return; 
		} 
		float centerX = m_icon.getWidth()/2.0f;
		float centerY = m_icon.getHeight()/2.0f;
 
		RotateAnimation ra = new RotateAnimation(0, 360, centerX, centerY);
		ra.setDuration(1000);
		ra.setRepeatCount(-1);
		ra.setInterpolator(new LinearInterpolator());
		this.m_icon.startAnimation(ra);
	} 
	 
	public void endRefresh() { 
		this.m_icon.clearAnimation();
	} 
	 
	public boolean isRefreshing() { 
		Animation a = this.m_icon.getAnimation();
		return (a != null)?!a.hasEnded():false;
	} 
7
CodeRank
This code example shows how to use the following methods:setDuration, setFillAfter, setFillEnabled, setRepeatCount
			} 
		} 
	} 
 
	public void startAnimation(int previous, int current) {
		Animation animation = new RotateAnimation(previous, current,
				Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		animation.setDuration(250);
		animation.setRepeatCount(0);
		animation.setFillAfter(true);
		animation.setFillEnabled(true);
 
		mRecordButton.startAnimation(animation);
		mPlayButton.startAnimation(animation);
	} 
	 
	public static interface AudioRecorderPlayerListener { 
		public void onAudioStatusChanged(int stated);
	} 
} 
7
CodeRank
This code example shows how to use the following methods:setRepeatCount, addAnimation, setRepeatMode
  /* 
   * Animates a component moving it horizontally. 
   */ 
  private static void ApplyHorizontalScrollAnimation(View view, boolean left, int speed) {
    float sign = left ? 1f : -1f;
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.setRepeatCount(Animation.INFINITE);
    animationSet.setRepeatMode(Animation.RESTART);
 
    TranslateAnimation move = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, sign * 0.70f,
        Animation.RELATIVE_TO_PARENT, sign * -0.70f, Animation.RELATIVE_TO_PARENT, 0,
        Animation.RELATIVE_TO_PARENT, 0);
    move.setStartOffset(0);
    move.setDuration(speed);
    move.setFillAfter(true);
    animationSet.addAnimation(move);
    view.startAnimation(animationSet);
  } 
 
  /** 
   * Animates a component (using pre-defined animation kinds). 
6
CodeRank
This code example shows how to use the following methods:setDuration, setRepeatCount, setRepeatMode
        final BitmapsView view = new BitmapsView(this);
        final FrameLayout layout = new FrameLayout(this);
        layout.addView(view, new FrameLayout.LayoutParams(480, 800, Gravity.CENTER));
        setContentView(layout);
         
        ScaleAnimation a = new ScaleAnimation(1.0f, 2.0f, 1.0f, 2.0f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                ScaleAnimation.RELATIVE_TO_SELF,0.5f);
        a.setDuration(2000);
        a.setRepeatCount(Animation.INFINITE);
        a.setRepeatMode(Animation.REVERSE);
        view.startAnimation(a);
    } 
 
    static class BitmapsView extends View {
        private Paint mBitmapPaint;
        private final Bitmap mBitmap1;
        private final Bitmap mBitmap2;
        private final PorterDuffXfermode mDstIn;
 
9
CodeRank
This code example shows how to use the following methods:setAnimationListener, setRepeatCount
        removeFrom(mItem);
        mItem = null;
    } 
 
    public void removeFrom(final MenuItem item) {
        mAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override 
            public void onAnimationStart(Animation animation) {
            } 
 
            @Override 
            public void onAnimationEnd(Animation animation) {
                clearAnimation();
                item.setActionView(null);
            } 
 
            @Override 
            public void onAnimationRepeat(Animation animation) {
            } 
        }); 

7
CodeRank
This code example shows how to use the following methods:setDuration, setInterpolator, setRepeatCount
    	intent.putExtras(extra_msg);
		startActivity(intent);
    } 
	 
	private void slideDown() { 
		final TranslateAnimation anim = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f, 
																Animation.RELATIVE_TO_SELF, 0f,
																Animation.RELATIVE_TO_SELF, -1f,
																Animation.RELATIVE_TO_SELF, 0f);
		anim.setDuration(500);
		anim.setRepeatCount(0);
		anim.setInterpolator(AnimationUtils.loadInterpolator(this, android.R.anim.accelerate_decelerate_interpolator));
		m_start_dialog.setVisibility(View.VISIBLE);
		m_stop_dialog.setVisibility(View.VISIBLE);
		m_start_dialog.startAnimation(anim);
		m_stop_dialog.startAnimation(anim);
	} 
	 
	@Override 
	protected void onPause() { 
	 	//... 
6
CodeRank
This code example shows how to use the following methods:setDuration, setInterpolator, setRepeatCount, setRepeatMode, setStartTime
            if (mInterpolator == null) {
                mInterpolator = new LinearInterpolator();
            } 
 
            mTransformation = new Transformation();
            mAnimation = new AlphaAnimation(0.0f, 1.0f);
            mAnimation.setRepeatMode(mBehavior);
            mAnimation.setRepeatCount(Animation.INFINITE);
            mAnimation.setDuration(mDuration);
            mAnimation.setInterpolator(mInterpolator);
            mAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
        } 
        postInvalidate(); 
    } 
 
    /** 
     * <p>Stop the indeterminate progress animation.</p> 
     */ 
    void stopAnimation() { 
        mAnimation = null;
7
CodeRank
This code example shows how to use the following methods:reset, setDuration, setFillAfter, setFillEnabled, setInterpolator
 
	public PostalAdapter(Context context) {
		this.context = context;
		this.mProvider = (MemoryProvider) context.getApplicationContext();
		if (rotateAnimation == null){
			rotateAnimation = new RotateAnimation(0f, 360f,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
			rotateAnimation.setInterpolator(new LinearInterpolator());
			rotateAnimation.setDuration(1500);
			rotateAnimation.setFillEnabled(true);
			rotateAnimation.setRepeatCount(Animation.INFINITE);
			rotateAnimation.setFillAfter(true);
		} 
		rotateAnimation.reset();
	} 
 
	public int getCount() { 
		return mProvider.getPostalSize();
	} 
 
	public Object getItem(int arg0) {
6
CodeRank
This code example shows how to use the following methods:setInterpolator, setRepeatCount, addAnimation, setDuration, setFillAfter

Related Animation setRepeatCount Questions & Answers:

setRepeatCount Method Overview
Sets how many times the animation should be repeated.
See Code Examples for other Android Animation Methods: