Code example for AnimationDrawable

Methods: isRunning

0
 
	private void bindDotPosition(final ViewHolder holder, final int position) {
		final AnimationDrawable animationDrawable = (AnimationDrawable) holder.dotLocation.getDrawable(); 
		if (mNearestPosition == position) { 
			holder.dotLocation.setVisibility(View.VISIBLE); 
			if (!animationDrawable.isRunning()) { 
				holder.dotLocation.post(new Runnable() { 
					@Override 
					public void run() { 
						animationDrawable.start(); 
					} 
				}); 
			} 
		} else { 
			holder.dotLocation.setVisibility(View.GONE); 
			if (animationDrawable.isRunning()) { 
				holder.dotLocation.post(new Runnable() { 
					@Override 
					public void run() { 
						animationDrawable.stop(); 
					}