Code example for ValueAnimator

0
        } 
    } 
 
    private void onDragStartLocal(final boolean start) {
        mDragHasPerformed = start;
        ValueAnimator fade = new ValueAnimator().setDuration(ANIMATION_DURATION);
        if (start) {
            fade.setFloatValues(0f, 1f);
        } else { 
            fade.setFloatValues(1f, 0f);
        } 
        fade.addUpdateListener(new AnimatorUpdateListener() {
            @Override 
            public void onAnimationUpdate(ValueAnimator animation) {
                float percent = (Float) animation.getAnimatedValue();
                setBackgroundAlpha(percent);
            } 
        }); 
        fade.addListener(new AnimatorListenerAdapter() {
            @Override 
            public void onAnimationStart(Animator animation) {