android.view.animation.TranslateAnimation#setAnimationListener()源码实例Demo

下面列出了android.view.animation.TranslateAnimation#setAnimationListener() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Android-Application-ZJB   文件: ViewUtils.java
public static void hideViewFromBottom(final View view) {
    if (view.getVisibility() == View.INVISIBLE) {
        return;
    }
    int height = view.getHeight();
    TranslateAnimation translateAnimation = new TranslateAnimation(Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, height);
    translateAnimation.setDuration(ANIMATION_DURATION);
    translateAnimation.setInterpolator(sAnimationInterpolator);
    translateAnimation.setAnimationListener(new AnimationAdapter() {
        @Override
        public void onAnimationEnd(Animation animation) {
            view.setVisibility(View.INVISIBLE);
        }
    });
    view.startAnimation(translateAnimation);
}
 
源代码2 项目: bither-android   文件: PinCodeEnterView.java
public void animateToNext() {
    et.setEnabled(false);
    int totalWidth = getWidth();
    int dvWidth = dv.getWidth();
    int animDistance = (totalWidth - dvWidth) / 2 + dvWidth;
    TranslateAnimation animOut = new TranslateAnimation(0, -animDistance, 0, 0);
    animOut.setInterpolator(new AccelerateDecelerateInterpolator());
    animOut.setFillAfter(true);
    animOut.setDuration(AnimDuration);
    TranslateAnimation animIn = new TranslateAnimation(animDistance, 0, 0, 0);
    animIn.setInterpolator(new AccelerateDecelerateInterpolator());
    animIn.setFillBefore(true);
    animIn.setDuration(AnimDuration);
    animIn.setAnimationListener(animateToNextListener);
    dvNew.setVisibility(View.VISIBLE);
    dv.startAnimation(animOut);
    dvNew.startAnimation(animIn);
}
 
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);
}
 
源代码4 项目: JianshuApp   文件: SmartSwitchButton.java
private void startAnim() {
    this.isPlayingAnim = true;
    int distance = this.mLine.getMeasuredWidth() - this.mCircle.getMeasuredWidth();
    TranslateAnimation anim = new TranslateAnimation(0.0f, this.isChecked ? (float) (-distance) : (float) distance, 0.0f, 0.0f);
    anim.setDuration(40);
    anim.setFillAfter(false);
    anim.setAnimationListener(this);
    this.mCircle.startAnimation(anim);
}
 
源代码5 项目: moviedb-android   文件: TVDetails.java
/**
 * Creates animation for the gallery and homePage Icons with up direction.
 */
public void createIconUpAnimation(float dy, int delay) {
    iconUpAnimation = new TranslateAnimation(0, 0, 0, (-(scale * 67.3f) + 0.5f - (dy * scale)) * iconDirection);
    iconUpAnimation.setDuration(250);
    iconUpAnimation.setFillAfter(false);
    iconUpAnimation.setStartOffset(delay);
    iconUpAnimation.setAnimationListener(iconUpAnimationListener);
}
 
源代码6 项目: moviedb-android   文件: TVDetails.java
/**
 * Creates animation for the gallery and homePage Icons with down direction.
 */
public void createIconDownAnimation(float dy) {
    iconDownAnimation = new TranslateAnimation(0, 0, 0, ((scale * 67.3f) + 0.5f + (dy * scale)) * iconDirection);
    iconDownAnimation.setDuration(250);
    iconDownAnimation.setFillAfter(false);
    iconDownAnimation.setAnimationListener(iconDownAnimationListener);
}
 
源代码7 项目: moviedb-android   文件: CastDetails.java
/**
 * Creates animation for the gallery and homePage Icons with up direction.
 */
public void createIconUpAnimation(float dy, int delay) {
    iconUpAnimation = new TranslateAnimation(0, 0, 0, (-(scale * 67.3f) + 0.5f - (dy * scale)) * iconDirection);
    iconUpAnimation.setDuration(250);
    iconUpAnimation.setFillAfter(false);
    iconUpAnimation.setStartOffset(delay);
    iconUpAnimation.setAnimationListener(iconUpAnimationListener);
}
 
源代码8 项目: moviedb-android   文件: CastDetails.java
/**
 * Creates animation for the gallery and homePage Icons with down direction.
 */
public void createIconDownAnimation(float dy) {
    iconDownAnimation = new TranslateAnimation(0, 0, 0, ((scale * 67.3f) + 0.5f + (dy * scale)) * iconDirection);
    iconDownAnimation.setDuration(250);
    iconDownAnimation.setFillAfter(false);
    iconDownAnimation.setAnimationListener(iconDownAnimationListener);
}
 
源代码9 项目: moviedb-android   文件: MovieDetails.java
/**
 * Creates animation for the gallery and gallery, homePage and trailer Icons with up direction.
 */
public void createIconUpAnimation(float dy, int delay) {
    iconUpAnimation = new TranslateAnimation(0, 0, 0, (-(scale * 67.3f) + 0.5f - (dy * scale)) * iconDirection);
    iconUpAnimation.setDuration(250);
    iconUpAnimation.setFillAfter(false);
    iconUpAnimation.setStartOffset(delay);
    iconUpAnimation.setAnimationListener(iconUpAnimationListener);
}
 
源代码10 项目: moviedb-android   文件: MovieDetails.java
/**
 * Creates animation for the gallery, homePage and trailer Icons with down direction.
 */
public void createIconDownAnimation(float dy) {
    iconDownAnimation = new TranslateAnimation(0, 0, 0, ((scale * 67.3f) + 0.5f + (dy * scale)) * iconDirection);
    iconDownAnimation.setDuration(250);
    iconDownAnimation.setFillAfter(false);
    iconDownAnimation.setAnimationListener(iconDownAnimationListener);
}