Example usage for android.animation AnimatorListenerAdapter AnimatorListenerAdapter

List of usage examples for android.animation AnimatorListenerAdapter AnimatorListenerAdapter

Introduction

In this page you can find the example usage for android.animation AnimatorListenerAdapter AnimatorListenerAdapter.

Prototype

AnimatorListenerAdapter

Source Link

Usage

From source file:com.example.conallcurran.quick_click.English_Infants.java

private void zoomImageFromThumb(final View thumbView, int imageResId) {

    if (mCurrentAnimator != null) {
        mCurrentAnimator.cancel();//w w w.  j a v  a2s .c  o  m
    }

    final ImageView expandedImageView = (ImageView) findViewById(R.id.expanded_image);
    expandedImageView.setImageResource(imageResId);
    final Rect startBounds = new Rect();
    final Rect finalBounds = new Rect();
    final Point globalOffset = new Point();

    thumbView.getGlobalVisibleRect(startBounds);
    findViewById(R.id.container).getGlobalVisibleRect(finalBounds, globalOffset);
    startBounds.offset(-globalOffset.x, -globalOffset.y);
    finalBounds.offset(-globalOffset.x, -globalOffset.y);
    float startScale;
    if ((float) finalBounds.width() / finalBounds.height() > (float) startBounds.width()
            / startBounds.height()) {
        startScale = (float) startBounds.height() / finalBounds.height();
        float startWidth = startScale * finalBounds.width();
        float deltaWidth = (startWidth - startBounds.width()) / 2;
        startBounds.left -= deltaWidth;
        startBounds.right += deltaWidth;
    } else {
        // Extend start bounds vertically
        startScale = (float) startBounds.width() / finalBounds.width();
        float startHeight = startScale * finalBounds.height();
        float deltaHeight = (startHeight - startBounds.height()) / 2;
        startBounds.top -= deltaHeight;
        startBounds.bottom += deltaHeight;
    }

    thumbView.setAlpha(0f);
    expandedImageView.setVisibility(View.VISIBLE);

    expandedImageView.setPivotX(0f);
    expandedImageView.setPivotY(0f);

    AnimatorSet set = new AnimatorSet();
    set.play(ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left, finalBounds.left))
            .with(ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top, finalBounds.top))
            .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScale, 1f))
            .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScale, 1f));
    set.setDuration(mShortAnimationDuration);
    set.setInterpolator(new DecelerateInterpolator());
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mCurrentAnimator = null;
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            mCurrentAnimator = null;
        }
    });
    set.start();
    mCurrentAnimator = set;

    final float startScaleFinal = startScale;
    expandedImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mCurrentAnimator != null) {
                mCurrentAnimator.cancel();
            }

            // Animate the four positioning/sizing properties in parallel, back to their
            // original values.
            AnimatorSet set = new AnimatorSet();
            set.play(ObjectAnimator.ofFloat(expandedImageView, View.X, startBounds.left))
                    .with(ObjectAnimator.ofFloat(expandedImageView, View.Y, startBounds.top))
                    .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X, startScaleFinal))
                    .with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_Y, startScaleFinal));
            set.setDuration(mShortAnimationDuration);
            set.setInterpolator(new DecelerateInterpolator());
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    thumbView.setAlpha(1f);
                    expandedImageView.setVisibility(View.GONE);
                    mCurrentAnimator = null;
                }

                @Override
                public void onAnimationCancel(Animator animation) {
                    thumbView.setAlpha(1f);
                    expandedImageView.setVisibility(View.GONE);
                    mCurrentAnimator = null;
                }
            });
            set.start();
            mCurrentAnimator = set;
        }
    });
}

From source file:com.androzic.MapList.java

@SuppressLint("NewApi")
private void crossfade(boolean direct) {
    View listView = adapter.getCount() > 0 ? getListView() : getListView().getEmptyView();
    final View from = direct ? progressBar : listView;
    final View to = direct ? listView : progressBar;

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        from.setVisibility(View.GONE);
        to.setVisibility(View.VISIBLE);
    } else {/* w  ww .j a  v  a2s .  co  m*/
        // Set the content view to 0% opacity but visible, so that it is visible
        // (but fully transparent) during the animation.
        to.setAlpha(0f);
        to.setVisibility(View.VISIBLE);

        // Animate the content view to 100% opacity, and clear any animation
        // listener set on the view.
        to.animate().alpha(1f).setDuration(shortAnimationDuration).setListener(null);

        // Animate the loading view to 0% opacity. After the animation ends,
        // set its visibility to GONE as an optimization step (it won't
        // participate in layout passes, etc.)
        from.animate().alpha(0f).setDuration(shortAnimationDuration).setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                from.setVisibility(View.GONE);
            }
        });
    }
}

From source file:com.github.shareme.gwsswwipetodismiss.library.SwipeDismissTouchListener.java

@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    // offset because the view is translated during swipe
    motionEvent.offsetLocation(mTranslationX, 0);

    if (mViewWidth < 2) {
        mViewWidth = mView.getWidth();/*from   w w w .  jav  a  2  s.  c o m*/
    }

    switch (MotionEventCompat.getActionMasked(motionEvent)) {
    case MotionEvent.ACTION_DOWN: {
        // TODO: ensure this is a finger, and set a flag
        mDownX = motionEvent.getRawX();
        mDownY = motionEvent.getRawY();
        mVelocityTracker = VelocityTracker.obtain();
        mVelocityTracker.addMovement(motionEvent);
        view.onTouchEvent(motionEvent);
        return false;
    }

    case MotionEvent.ACTION_UP: {
        if (mVelocityTracker == null) {
            break;
        }

        float deltaX = motionEvent.getRawX() - mDownX;
        float deltaY = motionEvent.getRawY() - mDownY;
        mVelocityTracker.addMovement(motionEvent);
        mVelocityTracker.computeCurrentVelocity(1000);
        float velocityX = Math.abs(mVelocityTracker.getXVelocity());
        float velocityY = Math.abs(mVelocityTracker.getYVelocity());
        boolean dismiss = false;
        boolean dismissRight = false;
        if (Math.abs(deltaY) < Math.abs(deltaX)) {
            if (Math.abs(deltaX) > Math.round(mViewWidth * SWIPE_SENSITIVITY)) {
                dismiss = true;
                dismissRight = deltaX > 0;
            } else if (Math.abs(deltaX) > mSlop && mMinFlingVelocity <= velocityX
                    && velocityX <= mMaxFlingVelocity && velocityY < velocityX) {
                dismiss = true;
                dismissRight = mVelocityTracker.getXVelocity() > 0;
            }
        }
        if (dismiss) {
            // dismiss
            mView.animate().translationX(dismissRight ? mViewWidth : -mViewWidth).alpha(0)
                    .setDuration(mAnimationTime).setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            performDismiss();
                        }
                    });
        } else {
            // cancel
            mView.animate().translationX(0).alpha(1).setDuration(mAnimationTime).setListener(null);
        }
        mVelocityTracker = null;
        mTranslationX = 0;
        mDownX = 0;
        mDownY = 0;
        mSwiping = false;
        break;
    }

    case MotionEvent.ACTION_MOVE: {
        if (mVelocityTracker == null) {
            break;
        }

        mVelocityTracker.addMovement(motionEvent);
        float deltaX = motionEvent.getRawX() - mDownX;
        if (Math.abs(deltaX) > mSlop) {
            mSwiping = true;
            mView.getParent().requestDisallowInterceptTouchEvent(true);

            // Cancel listview's touch
            MotionEvent cancelEvent = MotionEvent.obtain(motionEvent);
            cancelEvent.setAction(MotionEvent.ACTION_CANCEL | (MotionEventCompat
                    .getActionIndex(motionEvent) << MotionEventCompat.ACTION_POINTER_INDEX_SHIFT));
            mView.onTouchEvent(cancelEvent);
        }

        if (mSwiping) {
            mTranslationX = deltaX;
            setTranslationX(mView, deltaX);
            // TODO: use an ease-out interpolator or such
            setAlpha(mView, Math.max(0f, Math.min(1f, 1f - Math.abs(deltaX) / SWIPE_SENSITIVITY * mViewWidth)));
            return true;
        }
        break;
    }
    }
    return false;
}

From source file:com.lovejjfg.arsenal.ui.widget.JumpBall.java

private void init() {
    if (mPaint == null) {
        mPaint = new Paint();
        mPaint.setAntiAlias(true);/*  ww  w  . ja v a2  s .c o  m*/
        mPaint.setColor(ContextCompat.getColor(getContext(), R.color.colorAccent));
        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    }

    if (mPath == null) {
        mPath = new Path();
    }

    pullAnimator = ValueAnimator.ofInt(0, pullRange, 0);
    pullAnimator.setDuration((long) (dropTime * 0.5f));
    pullAnimator.addUpdateListener(animation -> {
        mChange = (Integer) animation.getAnimatedValue();
        if (animation.getAnimatedFraction() > 0.3) {
            dropAnimator.setIntValues(dropHeight, 0, dropHeight);
            dropAnimator.setDuration(dropTime * 2);
            dropAnimator.start();
        }
        Log.e("TAG", "onAnimationUpdate: " + mChange);
        invalidate();
    });

    pullAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {

        }
    });

    dropAnimator = ValueAnimator.ofInt(0, dropHeight);
    //        dropAnimator.setRepeatMode(ValueAnimator.REVERSE);
    //        dropAnimator.setRepeatCount(20);
    dropAnimator.setDuration(dropTime);
    dropAnimator.setInterpolator(new LinearInterpolator());
    dropAnimator.addUpdateListener(animation -> {
        mTranslateValue = (Integer) animation.getAnimatedValue();
        invalidate();
    });

    dropAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            //                dropAnimator = ValueAnimator.ofInt(dropHeight, 0, dropHeight);
            pullAnimator.start();
        }
    });
    dropAnimator.start();

    radioAnimator = ValueAnimator.ofFloat(mCircleRadius, mWidth);
    //        radioAnimator.setRepeatMode(ValueAnimator.REVERSE);
    //        radioAnimator.setRepeatCount(20);
    radioAnimator.setDuration(600);
    radioAnimator.setInterpolator(new LinearInterpolator());
    radioAnimator.addUpdateListener(animation -> {
        mCurrentRadio = (float) animation.getAnimatedValue();
        invalidate();
    });

    radioAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            super.onAnimationStart(animation);
            pullAnimator.cancel();
            dropAnimator.cancel();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            isEnd = false;
            mCurrentRadio = mCircleRadius;
            if (dismissListener != null) {
                dismissListener.onDismiss();
            }
            setVisibility(GONE);

        }
    });
    //        radioAnimator.start();
}

From source file:com.andremion.music.MusicCoverView.java

public MusicCoverView(Context context, AttributeSet attrs, final int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MusicCoverView);
    @Shape// w  w w . j a  v a 2s. co  m
    int shape = a.getInt(R.styleable.MusicCoverView_shape, SHAPE_SQUARE);
    @ColorInt
    int trackColor = a.getColor(R.styleable.MusicCoverView_trackColor, TRACK_COLOR);
    a.recycle();

    // TODO: Canvas.clipPath works wrong when running with hardware acceleration on Android N
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
        setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }

    final float density = getResources().getDisplayMetrics().density;
    mTrackSize = TRACK_SIZE * density;
    mTrackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTrackPaint.setStyle(Paint.Style.STROKE);
    mTrackPaint.setStrokeWidth(TRACK_WIDTH * density);

    mDiscPaintCenterDecor = new Paint(Paint.ANTI_ALIAS_FLAG);
    mDiscPaintCenterDecor.setStyle(Paint.Style.FILL);
    mDiscPaintCenter = new Paint(Paint.ANTI_ALIAS_FLAG);
    mDiscPaintCenter.setStyle(Paint.Style.FILL);

    setShape(shape);
    setTrackColor(trackColor);
    if (getDrawable() != null && ((BitmapDrawable) getDrawable()).getBitmap() != null) {
        setCenterColor(DISC_CENTER_COLOR, Palette.generate(((BitmapDrawable) getDrawable()).getBitmap(), 32)
                .getLightVibrantColor(DISC_CENTER_DECOR_COLOR));
    } else {
        setCenterColor(DISC_CENTER_COLOR, DISC_CENTER_DECOR_COLOR);
    }
    setScaleType();

    mStartRotateAnimator = ObjectAnimator.ofFloat(this, View.ROTATION, 0, FULL_ANGLE);
    mStartRotateAnimator.setInterpolator(new LinearInterpolator());
    if (SHAPE_SQUARE == mShape) {
        mStartRotateAnimator.setDuration(DURATION_SQUARE);
    } else {
        mStartRotateAnimator.setDuration(DURATION);
        mStartRotateAnimator.setRepeatCount(Animation.INFINITE);
    }

    mStartRotateAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            float current = getRotation();
            float target = current > HALF_ANGLE ? FULL_ANGLE : 0; // Choose the shortest distance to 0 rotation
            float diff = target > 0 ? FULL_ANGLE - current : current;
            mEndRotateAnimator.setFloatValues(current, target);
            if (SHAPE_SQUARE == mShape) {
                mEndRotateAnimator.setDuration((int) (DURATION_SQUARE_PER_DEGREES * diff));
            } else {
                mEndRotateAnimator.setDuration((int) (DURATION_PER_DEGREES * diff));
            }

            mEndRotateAnimator.start();
        }
    });

    mEndRotateAnimator = ObjectAnimator.ofFloat(MusicCoverView.this, View.ROTATION, 0);
    mEndRotateAnimator.setInterpolator(new LinearInterpolator());
    mEndRotateAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            setRotation(0);
            // isRunning method return true if it's called form here.
            // So we need call from post method to get the right returning.
            post(new Runnable() {
                @Override
                public void run() {
                    if (mCallbacks != null) {
                        mCallbacks.onRotateEnd(MusicCoverView.this);
                    }
                }
            });
        }
    });

    mRectToCircleTransition = new MorphTransition(SHAPE_RECTANGLE);
    mRectToCircleTransition.addTarget(this);
    mRectToCircleTransition.addListener(new TransitionAdapter() {
        @Override
        public void onTransitionStart(Transition transition) {
            mIsMorphing = true;
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            mIsMorphing = false;
            mShape = SHAPE_CIRCLE;
            if (mCallbacks != null) {
                mCallbacks.onMorphEnd(MusicCoverView.this);
            }
        }
    });

    mCircleToRectTransition = new MorphTransition(SHAPE_CIRCLE);
    mCircleToRectTransition.addTarget(this);
    mCircleToRectTransition.addListener(new TransitionAdapter() {
        @Override
        public void onTransitionStart(Transition transition) {
            mIsMorphing = true;
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            mIsMorphing = false;
            mShape = SHAPE_RECTANGLE;
            if (mCallbacks != null) {
                mCallbacks.onMorphEnd(MusicCoverView.this);
            }
        }
    });

    mSquareToSquareTransition = new MorphTransition(SHAPE_SQUARE);
    mSquareToSquareTransition.addTarget(this);
    mSquareToSquareTransition.addListener(new TransitionAdapter() {
        @Override
        public void onTransitionStart(Transition transition) {
            mIsMorphing = true;
        }

        @Override
        public void onTransitionEnd(Transition transition) {
            mIsMorphing = false;
            mShape = SHAPE_SQUARE;
            if (mCallbacks != null) {
                mCallbacks.onMorphEnd(MusicCoverView.this);
            }
        }
    });
}

From source file:com.android.clear.reminder.ItemAnimator.java

@Override
public boolean animateChange(@NonNull final ViewHolder oldHolder, @NonNull final ViewHolder newHolder,
        @NonNull ItemHolderInfo preInfo, @NonNull ItemHolderInfo postInfo) {
    endAnimation(oldHolder);/*from  w  w w . j a v  a 2  s. c o  m*/
    endAnimation(newHolder);

    final long changeDuration = getChangeDuration();
    List<Object> payloads = preInfo instanceof PayloadItemHolderInfo
            ? ((PayloadItemHolderInfo) preInfo).getPayloads()
            : null;

    if (oldHolder == newHolder) {
        final Animator animator = ((OnAnimateChangeListener) newHolder).onAnimateChange(payloads, preInfo.left,
                preInfo.top, preInfo.right, preInfo.bottom, changeDuration);
        if (animator == null) {
            dispatchChangeFinished(newHolder, false);
            return false;
        }
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animator) {
                dispatchChangeStarting(newHolder, false);
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                animator.removeAllListeners();
                mAnimators.remove(newHolder);
                dispatchChangeFinished(newHolder, false);
            }
        });
        mChangeAnimatorsList.add(animator);
        mAnimators.put(newHolder, animator);
        return true;
    } else if (!(oldHolder instanceof OnAnimateChangeListener)
            || !(newHolder instanceof OnAnimateChangeListener)) {
        // Both holders must implement OnAnimateChangeListener in order to animate.
        dispatchChangeFinished(oldHolder, true);
        dispatchChangeFinished(newHolder, true);
        return false;
    }

    final Animator oldChangeAnimator = ((OnAnimateChangeListener) oldHolder).onAnimateChange(oldHolder,
            newHolder, changeDuration);
    if (oldChangeAnimator != null) {
        oldChangeAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animator) {
                dispatchChangeStarting(oldHolder, true);
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                animator.removeAllListeners();
                mAnimators.remove(oldHolder);
                dispatchChangeFinished(oldHolder, true);
            }
        });
        mAnimators.put(oldHolder, oldChangeAnimator);
        mChangeAnimatorsList.add(oldChangeAnimator);
    } else {
        dispatchChangeFinished(oldHolder, true);
    }

    final Animator newChangeAnimator = ((OnAnimateChangeListener) newHolder).onAnimateChange(oldHolder,
            newHolder, changeDuration);
    if (newChangeAnimator != null) {
        newChangeAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animator) {
                dispatchChangeStarting(newHolder, false);
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                animator.removeAllListeners();
                mAnimators.remove(newHolder);
                dispatchChangeFinished(newHolder, false);
            }
        });
        mAnimators.put(newHolder, newChangeAnimator);
        mChangeAnimatorsList.add(newChangeAnimator);
    } else {
        dispatchChangeFinished(newHolder, false);
    }

    return true;
}

From source file:com.druk.bonjour.browser.ui.fragment.ServiceBrowserFragment.java

protected boolean showList(int itemsBefore) {
    if (itemsBefore > 0 && mAdapter.getItemCount() == 0) {
        mRecyclerView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override//from   w  w w . ja  v a2 s  .com
                    public void onAnimationEnd(Animator animation) {
                        mRecyclerView.setVisibility(View.GONE);
                    }
                }).start();
        mProgressView.setAlpha(0.0f);
        mProgressView.setVisibility(View.VISIBLE);
        mProgressView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start();
        return true;
    }
    if (itemsBefore == 0 && mAdapter.getItemCount() > 0) {
        mProgressView.animate().alpha(0.0f).setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mProgressView.setVisibility(View.GONE);
                    }
                }).start();
        mRecyclerView.setAlpha(0.0f);
        mRecyclerView.setVisibility(View.VISIBLE);
        mRecyclerView.animate().alpha(1.0f).setInterpolator(new AccelerateDecelerateInterpolator()).start();
        return false;
    }
    return mAdapter.getItemCount() > 0;
}

From source file:com.example.devesh.Coride.DriverRegistration.java

/**
 * Shows the progress UI and hides the login form.
 *///from  www  .  ja v a2 s.  c  om
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private void showProgress(final boolean show) {
    // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
    // for very easy animations. If available, use these APIs to fade-in
    // the progress spinner.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);

        mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
        mLoginFormView.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
                    }
                });

        mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
        mProgressView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
                    }
                });
    } else {
        // The ViewPropertyAnimator APIs are not available, so simply show
        // and hide the relevant UI components.
        mProgressView.setVisibility(show ? View.VISIBLE : View.GONE);
        mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
    }
}

From source file:com.artemchep.horario.ui.widgets.ContainersLayout.java

private void animateInFrameDetails() {
    frameDetails.setVisibility(View.VISIBLE);
    ViewUtils.onLaidOut(frameDetails, new Runnable() {
        @Override/* w  w w  .j  av  a2  s  .c  o  m*/
        public void run() {
            ObjectAnimator alpha = ofFloat(frameDetails, View.ALPHA, 0.4f, 1f);
            ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y,
                    frameDetails.getHeight() * 0.3f, 0f);

            AnimatorSet set = new AnimatorSet();
            set.playTogether(alpha, translate);
            set.setDuration(ANIM_DURATION);
            set.setInterpolator(new LinearOutSlowInInterpolator());
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    frameMaster.setVisibility(View.GONE);
                }
            });
            set.start();
        }
    });
}

From source file:com.haibin.calendarview.CalendarView.java

public void showSelectLayout(final int year) {
    mLinearWeek.animate().translationY(-mLinearWeek.getHeight()).setInterpolator(new LinearInterpolator())
            .setDuration(180).setListener(new AnimatorListenerAdapter() {
                @Override//from  www  . j  a  v a2 s.  c  o  m
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mLinearWeek.setVisibility(GONE);
                    mSelectLayout.setVisibility(VISIBLE);
                    mSelectLayout.init(year);
                }
            });
    mViewPager.animate().scaleX(0).scaleY(0).setDuration(180).setInterpolator(new LinearInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    mViewPager.setVisibility(GONE);
                }
            });
}