Code example for ImageView

Methods: setVisibility, clearAnimation, startAnimation

0
					setHeaderPadding(newHeaderPadding);
 
					if(state == State.PULL_TO_REFRESH && headerPadding > 0){
						setState(State.RELEASE_TO_REFRESH);
 
						image.clearAnimation();
						image.startAnimation(flipAnimation);
					}else if(state == State.RELEASE_TO_REFRESH && headerPadding < 0){
						setState(State.PULL_TO_REFRESH);
 
						image.clearAnimation();
						image.startAnimation(reverseFlipAnimation);
					} 
				} 
			} 
 
			break; 
		} 
 
		return super.onTouchEvent(event);
	} 
 
	private void bounceBackHeader(){ 
		int yTranslate = state == State.REFRESHING ?
				header.getHeight() - headerContainer.getHeight() :
					-headerContainer.getHeight() - headerContainer.getTop();
 
				bounceAnimation = new TranslateAnimation(
						TranslateAnimation.ABSOLUTE, 0,
						TranslateAnimation.ABSOLUTE, 0,
						TranslateAnimation.ABSOLUTE, 0,
						TranslateAnimation.ABSOLUTE, yTranslate);
 
				bounceAnimation.setDuration(BOUNCE_ANIMATION_DURATION);
				bounceAnimation.setFillEnabled(true);
				bounceAnimation.setFillAfter(false);
				bounceAnimation.setFillBefore(true);
				//bounceAnimation.setInterpolator(new OvershootInterpolator(BOUNCE_OVERSHOOT_TENSION)); 
				bounceAnimation.setAnimationListener(new HeaderAnimationListener(yTranslate));
				startAnimation(bounceAnimation);
	} 
 
	private void resetHeader(){ 
		if(getFirstVisiblePosition() > 0){ 
			setHeaderPadding(-header.getHeight());
			setState(State.PULL_TO_REFRESH);
			return; 
		} 
 
		if(getAnimation() != null && !getAnimation().hasEnded()){ 
			bounceBackHeader = true;
		}else{ 
			bounceBackHeader(); 
		} 
	} 
 
	private void setUiRefreshing(){ 
		spinner.setVisibility(View.VISIBLE);
		image.clearAnimation();
		image.setVisibility(View.INVISIBLE);
		text.setText(refreshingText);
	} 
 
	private void setState(State state){
		this.state = state;