Java Code Examples for android.view.animation.TranslateAnimation#setAnimationListener()

The following examples show how to use android.view.animation.TranslateAnimation#setAnimationListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewUtils.java    From Android-Application-ZJB with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: PinCodeEnterView.java    From bither-android with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: MultiColumnPullToRefreshListView.java    From EverMemo with MIT License 6 votes vote down vote up
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);
}
 
Example 4
Source File: SmartSwitchButton.java    From JianshuApp with GNU General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 5
Source File: TVDetails.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 6
Source File: TVDetails.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 7
Source File: CastDetails.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: CastDetails.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 9
Source File: MovieDetails.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 10
Source File: MovieDetails.java    From moviedb-android with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
}