Animator addListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Animator addListener method.

This code example shows how to use the following methods:addListener, playTogether, setDuration, start
        // Post this on the UI thread's message queue. It's needed for the items to be already measured 
        new Handler().post(new Runnable() {
 
            @Override 
            public void run() { 
                mSetAnim = new AnimatorSet();
                mTopImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
                mBottomImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
                mSetAnim.addListener(new Animator.AnimatorListener() {
                    @Override 
                    public void onAnimationStart(Animator animation) {
                    } 
 
                    @Override 
                    public void onAnimationEnd(Animator animation) {
                        clean(destActivity);
                    } 
 
                    @Override 
                    public void onAnimationCancel(Animator animation) {

7
CodeRank
This code example shows how to use the following methods:addListener, playTogether, setDuration, setInterpolator, start
This code example shows how to use the following methods:addListener, cancel
6
CodeRank
This code example shows how to use the following methods:addListener, play, start
        } else { 
            final long duration = getResources().getInteger(android.R.integer.config_shortAnimTime);
 
            // Animate if we have Honeycomb APIs, don't animate otherwise 
            mIsAnimating = true;
            AnimatorSet animatorSet = new AnimatorSet();
            mMasterView.setLayerType(LAYER_TYPE_HARDWARE, null);
            mDetailView.setLayerType(LAYER_TYPE_HARDWARE, null);
            animatorSet
                    .play(ObjectAnimator
                            .ofFloat(mMasterView, "translationX", translationX)
                            .setDuration(duration))
                    .with(ObjectAnimator
                            .ofFloat(mDetailView, "translationX", translationX)
                            .setDuration(duration));
            animatorSet.addListener(this);
            animatorSet.start();
 
            // For API level 12+, use this instead: 
            // mMasterView.animate().translationX().setDuration(duration); 

6
CodeRank
This code example shows how to use the following methods:addListener, start
6
CodeRank
This code example shows how to use the following methods:addListener, play, start
        } else { 
            final long duration = getResources().getInteger(android.R.integer.config_shortAnimTime);
 
            // Animate if we have Honeycomb APIs, don't animate otherwise 
            mIsAnimating = true;
            AnimatorSet animatorSet = new AnimatorSet();
            mMasterView.setLayerType(LAYER_TYPE_HARDWARE, null);
            mDetailView.setLayerType(LAYER_TYPE_HARDWARE, null);
            animatorSet
                    .play(ObjectAnimator
                            .ofFloat(mMasterView, "translationX", translationX)
                            .setDuration(duration))
                    .with(ObjectAnimator
                            .ofFloat(mDetailView, "translationX", translationX)
                            .setDuration(duration));
            animatorSet.addListener(this);
            animatorSet.start();
 
            // For API level 12+, use this instead: 
            // mMasterView.animate().translationX().setDuration(duration); 

6
CodeRank
This code example shows how to use the following methods:addListener, play, start
This code example shows how to use the following methods:addListener, end
6
CodeRank
This code example shows how to use the following methods:addListener, setDuration, start
            } 
 
            CrossFadeDrawable crossFadeDrawable = newCrossFadeDrawable(from, to);
            ObjectAnimator animator = crossFadeDrawable.getAnimator();
            imageView.setImageDrawable(crossFadeDrawable);
            animator.setDuration(ANIMATION_DURATION);
            animator.addListener(new AnimatorListenerAdapter() {
                @Override 
                public void onAnimationStart(Animator animation) {
                    if (FADE_DBG) {
                        log("cross-fade animation start (" 
                                + Integer.toHexString(from.hashCode()) + " -> "
                                + Integer.toHexString(to.hashCode()) + ")");
                    } 
                } 
 
                @Override 
                public void onAnimationEnd(Animator animation) {
                    if (FADE_DBG) {
                        log("cross-fade animation ended (" 

7
CodeRank
This code example shows how to use the following methods:addListener, play, setDuration
        mModestyPanel.setLayoutParams(layout);
        addView(mModestyPanel);
        mFadePanel = ObjectAnimator.ofFloat(mModestyPanel, "alpha", 0f);
        mFadeView = ObjectAnimator.ofFloat(null, "alpha", 0f);
        mAnimatorListener = new BringToFrontOnEnd();
        mTransitionAnimation = new AnimatorSet();
        mTransitionAnimation.play(mFadeView).with(mFadePanel);
        mTransitionAnimation.setDuration(CROSSFADE_TIME);
        mTransitionAnimation.addListener(mAnimatorListener);
    } 
 
    /** 
     * Visible for testing 
     * @hide 
     */ 
    public Animator getTransitionAnimation() {
        return mTransitionAnimation;
    } 
 
    /** 
6
CodeRank

Related Animator addListener Questions & Answers:

Other Animator addListener Examples

30:	    set = createAnimation();
31:	    set.start();
32:	    set.addListener(new AnimatorListenerAdapter() {
33:	
34:	      @Override

Read More

addListener Method Overview
Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.
See Code Examples for other Android Animator Methods: