Search in sources :

Example 1 with AnimatorListener

use of net.qiujuer.genius.ui.animation.AnimatorListener in project Genius-Android by qiujuer.

the class BalloonMarker method animateClose.

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void animateClose() {
    mBalloonMarkerDrawable.stop();
    ViewPropertyAnimator animator = mNumber.animate();
    animator.alpha(0f);
    animator.setDuration(100);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        animator.withEndAction(new Runnable() {

            @Override
            public void run() {
                //We use INVISIBLE instead of GONE to avoid a requestLayout
                mNumber.setVisibility(View.INVISIBLE);
                mBalloonMarkerDrawable.animateToNormal();
            }
        });
    } else {
        animator.setListener(new AnimatorListener() {

            @Override
            public void onAnimationEnd(Animator animation) {
                //We use INVISIBLE instead of GONE to avoid a requestLayout
                mNumber.setVisibility(View.INVISIBLE);
                mBalloonMarkerDrawable.animateToNormal();
            }
        });
    }
    animator.start();
}
Also used : AnimatorListener(net.qiujuer.genius.ui.animation.AnimatorListener) Animator(android.animation.Animator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) ViewPropertyAnimator(android.view.ViewPropertyAnimator) TargetApi(android.annotation.TargetApi)

Aggregations

Animator (android.animation.Animator)1 TargetApi (android.annotation.TargetApi)1 ViewPropertyAnimator (android.view.ViewPropertyAnimator)1 AnimatorListener (net.qiujuer.genius.ui.animation.AnimatorListener)1