Java Code Examples for com.nineoldandroids.animation.Animator#AnimatorListener

The following examples show how to use com.nineoldandroids.animation.Animator#AnimatorListener . 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: AnimationProxy.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
private AnimationProxy(View hoverView, int resId, Techniques technique, long duration, long delay, boolean invisibleWhenDelaying, Interpolator interpolator, Animator.AnimatorListener... listeners){
    if(hoverView == null)
        throw new IllegalStateException("Hover view is null");

    View child = hoverView.findViewById(resId);

    if(child == null)
        throw new IllegalStateException("Can not find the child view");

    if(duration < 0)
        throw new IllegalArgumentException("Duration can not be less than 0");

    if(delay < 0)
        throw new IllegalArgumentException("Delay can not be less than 0");

    this.composer = YoYo.with(technique).duration(duration).delay(delay).interpolate(interpolator);

    this.targetView = child;
    this.interpolator = interpolator;
    this.delay = delay;
    this.duration = duration;
    this.invisibleWhenDelaying = invisibleWhenDelaying;

    for(Animator.AnimatorListener l : listeners)
        this.composer.withListener(l);
}
 
Example 2
Source File: BlurLayout.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public void addChildAppearAnimator(View hoverView, int resId, Techniques technique, long duration, long delay, boolean hiddenWhenDelaying, Interpolator interpolator, Animator.AnimatorListener... listeners){
    AnimationProxy executor = AnimationProxy.build(hoverView, resId, technique, duration, delay, hiddenWhenDelaying, interpolator, listeners);

    View child = executor.getTarget();

    if(mChildAppearAnimators.get(child) == null)
        mChildAppearAnimators.put(child, new ArrayList<AnimationProxy>());

    executor.withListener(mGlobalListener);
    executor.withListener(mGlobalAppearingAnimators);
    child.setVisibility(INVISIBLE);

    mChildAppearAnimators.get(child).add(executor);
}
 
Example 3
Source File: ViewAnimationUtils.java    From Jide-Note with MIT License 5 votes vote down vote up
static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target, Rect bounds){
    if(SDK_INT >= 17){
        return new RevealAnimator.RevealFinishedJellyBeanMr1(target, bounds);
    }else if(SDK_INT >= 14){
        return new RevealAnimator.RevealFinishedIceCreamSandwich(target, bounds);
    }else {
        return new RevealAnimator.RevealFinishedGingerbread(target, bounds);
    }
}
 
Example 4
Source File: BlurLayout.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
public void setHoverDisappearAnimator(Techniques technique, long duration, long delay, Interpolator interpolator, Animator.AnimatorListener... listeners){
    mHoverDisappearAnimator = null;
    mHoverDisappearAnimationComposer = YoYo.with(technique).delay(delay).duration(duration).interpolate(interpolator);

    for(Animator.AnimatorListener l : listeners)
        mHoverDisappearAnimationComposer.withListener(l);

    mHoverDisappearAnimationComposer.withListener(mGlobalListener);
    mHoverDisappearAnimationComposer.withListener(mGlobalDisappearAnimators);
}
 
Example 5
Source File: ViewAnimationUtils.java    From WeGit with Apache License 2.0 5 votes vote down vote up
static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target, Rect bounds){
    if(SDK_INT >= 17){
        return new RevealAnimator.RevealFinishedJellyBeanMr1(target, bounds);
    }else if(SDK_INT >= 14){
        return new RevealAnimator.RevealFinishedIceCreamSandwich(target, bounds);
    }else {
        return new RevealAnimator.RevealFinishedGingerbread(target, bounds);
    }
}
 
Example 6
Source File: ScrollAnimator.java    From ButtonMenu with Apache License 2.0 5 votes vote down vote up
/**
 * Hide the animated view using a "translationY" animation and configure an AnimatorListener to be notified
 * during the animation.
 */
public void hideWithAnimationWithListener(Animator.AnimatorListener animatorListener) {
	scrollDirection = SCROLL_TO_BOTTOM;
	ObjectAnimator objectAnimator = objectAnimatorFactory.getObjectAnimator(animatedView, ANIMATION_TYPE, animatedView.getHeight());
	if (animatorListener != null) {
		objectAnimator.addListener(animatorListener);
	}
	objectAnimator.setDuration(durationInMillis);
	objectAnimator.start();
}
 
Example 7
Source File: ScrollAnimator.java    From ButtonMenu with Apache License 2.0 5 votes vote down vote up
/**
 * Show the animated view using a "translationY" animation and configure an AnimatorListener to be notified during
 * the animation.
 */
public void showWithAnimationWithListener(Animator.AnimatorListener animatorListener) {
	scrollDirection = SCROLL_TO_TOP;
	ObjectAnimator objectAnimator = objectAnimatorFactory.getObjectAnimator(animatedView, ANIMATION_TYPE, HIDDEN_Y_POSITION);
	if (animatorListener != null) {
		objectAnimator.addListener(animatorListener);
	}
	objectAnimator.setDuration(durationInMillis);
	objectAnimator.start();
}
 
Example 8
Source File: ViewAnimationUtils.java    From RecyclerView-Animation-Demo with Apache License 2.0 5 votes vote down vote up
private static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target){
    if(SDK_INT >= 18){
        return new RevealAnimator.RevealFinishedJellyBeanMr2(target);
    }else if(SDK_INT >= 14){
        return new RevealAnimator.RevealFinishedIceCreamSandwich(target);
    }else {
        return new RevealAnimator.RevealFinishedGingerbread(target);
    }
}
 
Example 9
Source File: Shimmer.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public Shimmer setAnimatorListener(Animator.AnimatorListener animatorListener) {
    this.animatorListener = animatorListener;
    return this;
}
 
Example 10
Source File: YoYo.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public AnimationComposer withListener(Animator.AnimatorListener listener) {
    callbacks.add(listener);
    return this;
}
 
Example 11
Source File: FloatingActionItemImageView.java    From android-floating-action-menu with Apache License 2.0 4 votes vote down vote up
public FloatingActionItemImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mShowListener = new Animator.AnimatorListener() {
        boolean isCancelled;

        @Override
        public void onAnimationStart(final Animator animation) {
            isCancelled = false;
            FloatingActionItemImageView.this.onAnimationStart(ANIMATION_SHOW);
        }

        @Override
        public void onAnimationEnd(final Animator animation) {
            if (!isCancelled) {
                FloatingActionItemImageView.this.onAnimationEnd(ANIMATION_SHOW);
            }
        }

        @Override
        public void onAnimationCancel(final Animator animation) {
            isCancelled = true;
        }

        @Override
        public void onAnimationRepeat(final Animator animation) {}
    };

    mHideListener = new Animator.AnimatorListener() {
        boolean isCancelled;

        @Override
        public void onAnimationStart(final Animator animation) {
            isCancelled = false;
            FloatingActionItemImageView.this.onAnimationStart(ANIMATION_HIDE);
        }

        @Override
        public void onAnimationEnd(final Animator animation) {
            if (!isCancelled) {
                FloatingActionItemImageView.this.onAnimationEnd(ANIMATION_HIDE);
            }
        }

        @Override
        public void onAnimationCancel(final Animator animation) {
            isCancelled = true;
        }

        @Override
        public void onAnimationRepeat(final Animator animation) {}
    };

    mShowAnimator = new ObjectAnimator();
    mShowAnimator.setTarget(this);
    if (null != mShowListener) {
        mShowAnimator.addListener(mShowListener);
    }

    mHideAnimator = new ObjectAnimator();
    mHideAnimator.setTarget(this);
    if (null != mHideListener) {
        mHideAnimator.addListener(mHideListener);
    }
}
 
Example 12
Source File: ViewPropertyAnimatorHC.java    From Mover with Apache License 2.0 4 votes vote down vote up
@Override
public ViewPropertyAnimator setListener(Animator.AnimatorListener listener) {
    mListener = listener;
    return this;
}
 
Example 13
Source File: Titanic.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public void setAnimatorListener(Animator.AnimatorListener animatorListener) {
    this.animatorListener = animatorListener;
}
 
Example 14
Source File: Shimmer.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public Animator.AnimatorListener getAnimatorListener() {
    return animatorListener;
}
 
Example 15
Source File: MaterialMenuView.java    From NHentai-android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setAnimationListener(Animator.AnimatorListener listener) {
    drawable.setAnimationListener(listener);
}
 
Example 16
Source File: CircularBarActivity.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
private void animate(final HoloCircularProgressBar progressBar, final Animator.AnimatorListener listener) {
    final float progress = (float) (Math.random() * 2);
    int duration = 3000;
    animate(progressBar, listener, progress, duration);
}
 
Example 17
Source File: BaseAnimator.java    From ToggleExpandLayout with MIT License 4 votes vote down vote up
public void addAnimatorListener(Animator.AnimatorListener l) {
    animatorSet.addListener(l);
}
 
Example 18
Source File: ViewPropertyAnimator.java    From Mover with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a listener for events in the underlying Animators that run the property
 * animations.
 *
 * @param listener The listener to be called with AnimatorListener events.
 * @return This object, allowing calls to methods in this class to be chained.
 */
public abstract ViewPropertyAnimator setListener(Animator.AnimatorListener listener);
 
Example 19
Source File: MaterialMenu.java    From NHentai-android with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Set listener for {@code MaterialMenuDrawable} animation events
 *
 * @param listener new listener or null to remove any listener
 */
public void setAnimationListener(Animator.AnimatorListener listener);
 
Example 20
Source File: MaterialMenu.java    From WeGit with Apache License 2.0 2 votes vote down vote up
/**
 * Set listener for {@code MaterialMenuDrawable} animation events
 *
 * @param listener new listener or null to remove any listener
 */
public void setAnimationListener(Animator.AnimatorListener listener);