Search in sources :

Example 11 with AnimatorSet

use of com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet in project UltimateAndroid by cymcsg.

the class AnimateDismissAdapter method animateDismiss.

/**
     * Animate dismissal of the items at given positions.
     */
public void animateDismiss(final Collection<Integer> positions) {
    final List<Integer> positionsCopy = new ArrayList<Integer>(positions);
    if (getAbsListView() == null) {
        throw new IllegalStateException("Call setAbsListView() on this AnimateDismissAdapter before calling setAdapter()!");
    }
    List<View> views = getVisibleViewsForPositions(positionsCopy);
    if (!views.isEmpty()) {
        List<Animator> animators = new ArrayList<Animator>();
        for (final View view : views) {
            animators.add(createAnimatorForView(view));
        }
        AnimatorSet animatorSet = new AnimatorSet();
        Animator[] animatorsArray = new Animator[animators.size()];
        for (int i = 0; i < animatorsArray.length; i++) {
            animatorsArray[i] = animators.get(i);
        }
        animatorSet.playTogether(animatorsArray);
        animatorSet.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(final Animator animator) {
                invokeCallback(positionsCopy);
            }
        });
        animatorSet.start();
    } else {
        invokeCallback(positionsCopy);
    }
}
Also used : AnimatorSet(com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet) View(android.view.View) ValueAnimator(com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator) Animator(com.marshalchen.common.uimodule.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorListenerAdapter)

Example 12 with AnimatorSet

use of com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet in project UltimateAndroid by cymcsg.

the class ResideMenu method closeMenu.

/**
     * close the reslide menu;
     */
public void closeMenu() {
    isOpened = false;
    AnimatorSet scaleUp_activity = buildScaleUpAnimation(viewActivity, 1.0f, 1.0f);
    AnimatorSet scaleUp_shadow = buildScaleUpAnimation(imageViewShadow, 1.0f, 1.0f);
    AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 0.0f);
    scaleUp_activity.addListener(animationListener);
    scaleUp_activity.playTogether(scaleUp_shadow);
    scaleUp_activity.playTogether(alpha_menu);
    scaleUp_activity.start();
}
Also used : AnimatorSet(com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet)

Example 13 with AnimatorSet

use of com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet in project UltimateAndroid by cymcsg.

the class AnimationAdapter method animateView.

private void animateView(final ViewGroup parent, final View view) {
    if (mAnimationStartMillis == -1) {
        mAnimationStartMillis = System.currentTimeMillis();
    }
    ViewHelper.setAlpha(view, 0);
    Animator[] childAnimators;
    if (mDecoratedBaseAdapter instanceof AnimationAdapter) {
        childAnimators = ((AnimationAdapter) mDecoratedBaseAdapter).getAnimators(parent, view);
    } else {
        childAnimators = new Animator[0];
    }
    Animator[] animators = getAnimators(parent, view);
    Animator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);
    AnimatorSet set = new AnimatorSet();
    set.playTogether(concatAnimators(childAnimators, animators, alphaAnimator));
    set.setStartDelay(calculateAnimationDelay());
    set.setDuration(getAnimationDurationMillis());
    set.start();
    mAnimators.put(view.hashCode(), set);
}
Also used : ObjectAnimator(com.marshalchen.common.uimodule.nineoldandroids.animation.ObjectAnimator) Animator(com.marshalchen.common.uimodule.nineoldandroids.animation.Animator) AnimatorSet(com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet)

Aggregations

AnimatorSet (com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorSet)13 Animator (com.marshalchen.common.uimodule.nineoldandroids.animation.Animator)5 View (android.view.View)4 ObjectAnimator (com.marshalchen.common.uimodule.nineoldandroids.animation.ObjectAnimator)4 ListView (android.widget.ListView)3 AnimatorListenerAdapter (com.marshalchen.common.uimodule.nineoldandroids.animation.AnimatorListenerAdapter)3 ValueAnimator (com.marshalchen.common.uimodule.nineoldandroids.animation.ValueAnimator)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)1 LinearInterpolator (android.view.animation.LinearInterpolator)1 AdapterView (android.widget.AdapterView)1 BaseEasingMethod (com.marshalchen.common.uimodule.easing.BaseEasingMethod)1 Skill (com.marshalchen.common.uimodule.easing.Skill)1 AnimatorProxy (com.marshalchen.common.uimodule.nineoldandroids.view.animation.AnimatorProxy)1 Entry (java.util.Map.Entry)1