Code example for ConcurrentLinkedQueue

Methods: poll, size

0
	int x1 = 0, y1 = 0;
	int x2 = 0, y2 = 0;
	 
	private void animateBlob(final boolean hideOnAnimationEnd){
		Point p;
		p = pendingList.poll();
		if(p != null){
			if (x1 <= 0 && y1 <= 0) {
				x1 = p.x;
				y1 = p.y;
			}else{ 
				x2 = p.x;
				y2 = p.y;
			} 
 
			if(x2 == 0 && y2 == 0){
				animateBlob(hideOnAnimationEnd);
			}else{ 
				animateBlob(x1, y1, x2, y2, mInterpolator, hideOnAnimationEnd);
			} 
		} 
	} 
 
	public void setInterpolatorForDestination(Interpolator interpolator) {
		mInterpolator = interpolator;
	} 
 
	private void animateBlob(final int tx1, final int ty1, final int tx2, final int ty2,
			Interpolator interpolator, final boolean hideOnAnimationEnd) {
		 
		ValueAnimator animX = ObjectAnimator.ofFloat(this, "translationX",
				tx2 - mViewWidth/2);
		ValueAnimator animY = ObjectAnimator.ofFloat(this, "translationY",
				ty2 - mViewWidth/2);
		animX.setDuration(animationDuration);
		animY.setDuration(animationDuration);
 
		AnimatorSet aset = new AnimatorSet();
		ArrayList<Animator> items = new ArrayList<Animator>();
 
		if(pendingList.size() == 0) {
			animX.setInterpolator(interpolator);
			animY.setInterpolator(interpolator);
			if(hideOnAnimationEnd) {
				hide(); 
			} 
		} 
		 
		aset.addListener(new AnimatorListener(){
 
			@Override 
			public void onAnimationCancel(Animator animation) {
			} 
 
			@Override 
			public void onAnimationEnd(Animator vanimation) {
				x1 = tx2;
				y1 = ty2;
				if(pendingList.size() == 0){
					isAnimating = false;
					setDefaultAnimationDuration(); 
				}else{ 
					isAnimating = true;
					animateBlob(false);