Java 类com.nineoldandroids.animation.Animator 实例源码

项目:PeSanKita-android    文件:TransferControlView.java   
private void display(@Nullable final View view) {
  final int sourceWidth = current == downloadDetails ? expandedWidth : contractedWidth;
  final int targetWidth = view    == downloadDetails ? expandedWidth : contractedWidth;

  if (current == view || current == null) {
    ViewGroup.LayoutParams layoutParams = getLayoutParams();
    layoutParams.width = targetWidth;
    setLayoutParams(layoutParams);
  } else {
    ViewUtil.fadeOut(current, TRANSITION_MS);
    Animator anim = getWidthAnimator(sourceWidth, targetWidth);
    anim.start();
  }

  if (view == null) {
    ViewUtil.fadeOut(this, TRANSITION_MS);
  } else {
    ViewUtil.fadeIn(this, TRANSITION_MS);
    ViewUtil.fadeIn(view, TRANSITION_MS);
  }

  current = view;
}
项目:exciting-app    文件:ViewPropertyAnimatorHC.java   
@Override
public void cancel() {
    if (mAnimatorMap.size() > 0) {
        HashMap<Animator, PropertyBundle> mAnimatorMapCopy =
                (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone();
        Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
        for (Animator runningAnim : animatorSet) {
            runningAnim.cancel();
        }
    }
    mPendingAnimations.clear();
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
    }
}
项目:exciting-app    文件:ViewPropertyAnimatorPreHC.java   
@Override
public void cancel() {
    if (mAnimatorMap.size() > 0) {
        HashMap<Animator, PropertyBundle> mAnimatorMapCopy =
                (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone();
        Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
        for (Animator runningAnim : animatorSet) {
            runningAnim.cancel();
        }
    }
    mPendingAnimations.clear();
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
    }
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorHC.java   
private void animatePropertyBy(int constantName, float startValue, float byValue) {
    if (this.mAnimatorMap.size() > 0) {
        Animator animatorToCancel = null;
        for (Animator runningAnim : this.mAnimatorMap.keySet()) {
            PropertyBundle bundle = (PropertyBundle) this.mAnimatorMap.get(runningAnim);
            if (bundle.cancel(constantName) && bundle.mPropertyMask == 0) {
                animatorToCancel = runningAnim;
                break;
            }
        }
        if (animatorToCancel != null) {
            animatorToCancel.cancel();
        }
    }
    this.mPendingAnimations.add(new NameValuesHolder(constantName, startValue, byValue));
    View v = (View) this.mView.get();
    if (v != null) {
        v.removeCallbacks(this.mAnimationStarter);
        v.post(this.mAnimationStarter);
    }
}
项目:Cable-Android    文件:TransferControlView.java   
private void display(@Nullable final View view) {
  final int sourceWidth = current == downloadDetails ? expandedWidth : contractedWidth;
  final int targetWidth = view    == downloadDetails ? expandedWidth : contractedWidth;

  if (current == view || current == null) {
    ViewGroup.LayoutParams layoutParams = getLayoutParams();
    layoutParams.width = targetWidth;
    setLayoutParams(layoutParams);
  } else {
    ViewUtil.fadeOut(current, TRANSITION_MS);
    Animator anim = getWidthAnimator(sourceWidth, targetWidth);
    anim.start();
  }

  if (view == null) {
    ViewUtil.fadeOut(this, TRANSITION_MS);
  } else {
    ViewUtil.fadeIn(this, TRANSITION_MS);
    ViewUtil.fadeIn(view, TRANSITION_MS);
  }

  current = view;
}
项目:SIIEScanner    文件:ItemReaderContentExamConfirmationPresence.java   
private void acceptConfirmationIn( View v ) {
    if( !this.opem ) return;
    this.callback( this.confirmationInCallback );
    YoYo.with( Techniques.ZoomOut )
            .duration( 400 )
            .playOn( this.ivExamConfirmationInReject );

    YoYo.with( Techniques.ZoomIn )
            .duration( 400 )
            .withListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    ivExamConfirmationInAccept.setImageResource( R.drawable.ic_sentiment_satisfied_green_500_18dp );
                }
            })
            .playOn( this.ivExamConfirmationInAccept )
            ;

    //Remover o evento
    this.ivExamConfirmationInReject.setOnClickListener( null );
    this.ivExamConfirmationInAccept.setOnClickListener( null );
}
项目:SIIEScanner    文件:ItemReaderContentExamConfirmationPresence.java   
private void acceptConfirmationOut( View v ) {
    if( !this.opem ) return;
    this.callback( this.confirmationOutCallback );
    YoYo.with( Techniques.ZoomOut )
            .duration( 400 )
            .playOn( this.ivExamConfirmationOutReject );

    YoYo.with( Techniques.ZoomIn )
            .duration( 400 )
            .withListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    ivExamConfirmationOutAccept.setImageResource( R.drawable.ic_sentiment_very_dissatisfied_red_500_18dp );
                }
            })
            .playOn( this.ivExamConfirmationOutAccept )
    ;

    //Remover o evento
    this.ivExamConfirmationOutReject.setOnClickListener( null );
    this.ivExamConfirmationOutAccept.setOnClickListener( null );
}
项目:MenuSet    文件:MenuAdapter.java   
/**
 * Filling arrays of animations to build Set of Closing / Opening animations
 */
private void fillOpenClosingAnimations(boolean isCloseAnimation, List<Animator> textAnimations, List<Animator> imageAnimations, int wrapperPosition) {
    AnimatorSet textAnimatorSet = new AnimatorSet();
    Animator textAppearance = isCloseAnimation ?
            AnimatorUtils.alfaDisappear(mTextWrapper.getChildAt(wrapperPosition))
            : AnimatorUtils.alfaAppear(mTextWrapper.getChildAt(wrapperPosition));

    Animator textTranslation = isCloseAnimation ?
            AnimatorUtils.translationRight(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation))
            : AnimatorUtils.translationLeft(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation));

    textAnimatorSet.playTogether(textAppearance, textTranslation);
    textAnimations.add(textAnimatorSet);

    Animator imageRotation = isCloseAnimation ?
            wrapperPosition == 0 ? AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationCloseVertical(mMenuWrapper.getChildAt(wrapperPosition))
            : wrapperPosition == 0 ? AnimatorUtils.rotationOpenFromRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationOpenVertical(mMenuWrapper.getChildAt(wrapperPosition));
    imageAnimations.add(imageRotation);
}
项目:PeSanKita-android    文件:TransferControlView.java   
private Animator getWidthAnimator(final int from, final int to) {
  final ValueAnimator anim = ValueAnimator.ofInt(from, to);
  anim.addUpdateListener(new AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      final int val = (Integer)animation.getAnimatedValue();
      final ViewGroup.LayoutParams layoutParams = getLayoutParams();
      layoutParams.width = val;
      setLayoutParams(layoutParams);
    }
  });
  anim.setInterpolator(new FastOutSlowInInterpolator());
  anim.setDuration(TRANSITION_MS);
  return anim;
}
项目:browser    文件:SwipeListViewTouchListener.java   
/**
 * Create dismiss animation
 *
 * @param view      affected view
 * @param swap      If will change state. If is "false" returns to the original position
 * @param swapRight If swap is true, this parameter tells if move is to the right or left
 * @param position  Position of list
 */
private void generateDismissAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }

    int alpha = 1;
    if (swap) {
        ++dismissAnimationRefCount;
        alpha = 0;
    }

    animate(view)
            .translationX(moveTo)
            .alpha(alpha)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (swap) {
                        closeOpenedItems();
                        performDismiss(view, position, true);
                    }
                    resetCell();
                }
            });

}
项目:browser    文件:SwipeListViewTouchListener.java   
/**
 * Create reveal animation
 *
 * @param view      affected view
 * @param swap      If will change state. If "false" returns to the original position
 * @param swapRight If swap is true, this parameter tells if movement is toward right or left
 * @param position  list position
 */
private void generateRevealAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }

    animate(view)
            .translationX(moveTo)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    swipeListView.resetScrolling();
                    if (swap) {
                        boolean aux = !opened.get(position);
                        opened.set(position, aux);
                        if (aux) {
                            swipeListView.onOpened(position, swapRight);
                            openedRight.set(position, swapRight);
                        } else {
                            swipeListView.onClosed(position, openedRight.get(position));
                        }
                    }
                    resetCell();
                }
            });
}
项目:browser    文件:SwipeListViewTouchListener.java   
/**
 * Perform dismiss action
 *
 * @param dismissView     View
 * @param dismissPosition Position of list
 */
protected void performDismiss(final View dismissView, final int dismissPosition, boolean doPendingDismiss) {
    final ViewGroup.LayoutParams lp = dismissView.getLayoutParams();
    final int originalHeight = dismissView.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(animationTime);

    if (doPendingDismiss) {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                --dismissAnimationRefCount;
                if (dismissAnimationRefCount == 0) {
                    removePendingDismisses(originalHeight);
                }
            }
        });
    }

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            dismissView.setLayoutParams(lp);
        }
    });

    pendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
    animator.start();
}
项目:JewelryUI    文件:ViewAnimationUtils.java   
private static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target) {
    if (SDK_INT >= 18) {
        return new RevealAnimator.RevealFinishedJellyBeanMr2(target);
    } else if (SDK_INT >= 14) {
        return new RevealAnimator.RevealFinishedIceCreamSandwich(target);
    } else {
        return new RevealAnimator.RevealFinishedGingerbread(target);
    }
}
项目:MenuSet    文件:MenuAdapter.java   
@Override
public void onAnimationEnd(Animator animation) {
    toggleIsAnimationRun();
    if (mOnItemLongClickListenerCalled != null) {
        mOnItemLongClickListenerCalled.onLongClick(mClickedView);
    } else if (mOnItemClickListenerCalled != null) {
        mOnItemClickListenerCalled.onClick(mClickedView);
    }
}
项目:JewelryUI    文件:SupportAnimatorPreL.java   
@Override
public void setDuration(int duration) {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setDuration(duration);
    }
}
项目:JewelryUI    文件:SupportAnimatorPreL.java   
@Override
public void setInterpolator(Interpolator value) {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setInterpolator(value);
    }
}
项目:JewelryUI    文件:SupportAnimatorPreL.java   
@Override
public void cancel() {
    Animator a = mAnimator.get();
    if (a != null) {
        a.cancel();
    }
}
项目:JewelryUI    文件:SupportAnimatorPreL.java   
@Override
public void end() {
    Animator a = mAnimator.get();
    if (a != null) {
        a.end();
    }
}
项目:JewelryUI    文件:SupportAnimatorPreL.java   
@Override
public void setupStartValues() {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setupStartValues();
    }
}
项目:JewelryUI    文件:SupportAnimatorPreL.java   
@Override
public void setupEndValues() {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setupEndValues();
    }
}
项目:NeteaseCloudMusic    文件:DiscPageChanger.java   
@Override
public void onAnimationEnd(Animator animator) {
    if (playAfterEndAnimation) {
        playAfterEndAnimation = false;
        mAnimator.start();
    }
}
项目:NeteaseCloudMusic    文件:DiscPageChanger.java   
@Override
public void onAnimationCancel(Animator animator) {
    if (playAfterEndAnimation) {
        playAfterEndAnimation = false;
        mAnimator.start();
    }
}
项目:exciting-app    文件:ViewPropertyAnimatorHC.java   
/**
 * Utility function, called by animateProperty() and animatePropertyBy(), which handles the
 * details of adding a pending animation and posting the request to start the animation.
 *
 * @param constantName The specifier for the property being animated
 * @param startValue The starting value of the property
 * @param byValue The amount by which the property will change
 */
private void animatePropertyBy(int constantName, float startValue, float byValue) {
    // First, cancel any existing animations on this property
    if (mAnimatorMap.size() > 0) {
        Animator animatorToCancel = null;
        Set<Animator> animatorSet = mAnimatorMap.keySet();
        for (Animator runningAnim : animatorSet) {
            PropertyBundle bundle = mAnimatorMap.get(runningAnim);
            if (bundle.cancel(constantName)) {
                // property was canceled - cancel the animation if it's now empty
                // Note that it's safe to break out here because every new animation
                // on a property will cancel a previous animation on that property, so
                // there can only ever be one such animation running.
                if (bundle.mPropertyMask == NONE) {
                    // the animation is no longer changing anything - cancel it
                    animatorToCancel = runningAnim;
                    break;
                }
            }
        }
        if (animatorToCancel != null) {
            animatorToCancel.cancel();
        }
    }

    NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue);
    mPendingAnimations.add(nameValuePair);
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
        v.post(mAnimationStarter);
    }
}
项目:exciting-app    文件:ViewPropertyAnimatorPreHC.java   
/**
 * Utility function, called by animateProperty() and animatePropertyBy(), which handles the
 * details of adding a pending animation and posting the request to start the animation.
 *
 * @param constantName The specifier for the property being animated
 * @param startValue The starting value of the property
 * @param byValue The amount by which the property will change
 */
private void animatePropertyBy(int constantName, float startValue, float byValue) {
    // First, cancel any existing animations on this property
    if (mAnimatorMap.size() > 0) {
        Animator animatorToCancel = null;
        Set<Animator> animatorSet = mAnimatorMap.keySet();
        for (Animator runningAnim : animatorSet) {
            PropertyBundle bundle = mAnimatorMap.get(runningAnim);
            if (bundle.cancel(constantName)) {
                // property was canceled - cancel the animation if it's now empty
                // Note that it's safe to break out here because every new animation
                // on a property will cancel a previous animation on that property, so
                // there can only ever be one such animation running.
                if (bundle.mPropertyMask == NONE) {
                    // the animation is no longer changing anything - cancel it
                    animatorToCancel = runningAnim;
                    break;
                }
            }
        }
        if (animatorToCancel != null) {
            animatorToCancel.cancel();
        }
    }

    NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue);
    mPendingAnimations.add(nameValuePair);
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
        v.post(mAnimationStarter);
    }
}
项目:exciting-app    文件:ViewPropertyAnimatorPreHC.java   
@Override
public void onAnimationEnd(Animator animation) {
    if (mListener != null) {
        mListener.onAnimationEnd(animation);
    }
    mAnimatorMap.remove(animation);
    // If the map is empty, it means all animation are done or canceled, so the listener
    // isn't needed anymore. Not nulling it would cause it to leak any objects used in
    // its implementation
    if (mAnimatorMap.isEmpty()) {
        mListener = null;
    }
}
项目:GongXianSheng    文件:AnimHelper.java   
private BaseViewAnimator play() {
    animator.setTarget(target);
    animator.setDuration(duration)
            .setInterpolator(interpolator)
            .setStartDelay(delay);

    if (callbacks.size() > 0) {
        for (Animator.AnimatorListener callback : callbacks) {
            animator.addAnimatorListener(callback);
        }
    }

    animator.animate();
    return animator;
}
项目:MyAnimeViewer    文件:BaseItemAnimator.java   
@Override
public void onAnimationEnd(Animator animation) {
    //clear(view);
    dispatchAddFinished(mViewHolder);
    mAddAnimations.remove(mViewHolder);
    dispatchFinishedWhenDone();
}
项目:MyAnimeViewer    文件:BaseItemAnimator.java   
@Override
public void onAnimationEnd(Animator animation) {
    //ViewHelper.clear(view);
    dispatchRemoveFinished(mViewHolder);
    mRemoveAnimations.remove(mViewHolder);
    dispatchFinishedWhenDone();
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorHC.java   
public void onAnimationEnd(Animator animation) {
    if (ViewPropertyAnimatorHC.this.mListener != null) {
        ViewPropertyAnimatorHC.this.mListener.onAnimationEnd(animation);
    }
    ViewPropertyAnimatorHC.this.mAnimatorMap.remove(animation);
    if (ViewPropertyAnimatorHC.this.mAnimatorMap.isEmpty()) {
        ViewPropertyAnimatorHC.this.mListener = null;
    }
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorHC.java   
public void cancel() {
    if (this.mAnimatorMap.size() > 0) {
        for (Animator runningAnim : ((HashMap) this.mAnimatorMap.clone()).keySet()) {
            runningAnim.cancel();
        }
    }
    this.mPendingAnimations.clear();
    View v = (View) this.mView.get();
    if (v != null) {
        v.removeCallbacks(this.mAnimationStarter);
    }
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorPreHC.java   
public void onAnimationEnd(Animator animation) {
    if (ViewPropertyAnimatorPreHC.this.mListener != null) {
        ViewPropertyAnimatorPreHC.this.mListener.onAnimationEnd(animation);
    }
    ViewPropertyAnimatorPreHC.this.mAnimatorMap.remove(animation);
    if (ViewPropertyAnimatorPreHC.this.mAnimatorMap.isEmpty()) {
        ViewPropertyAnimatorPreHC.this.mListener = null;
    }
}
项目:boohee_v5.6    文件:ViewPropertyAnimatorPreHC.java   
public void cancel() {
    if (this.mAnimatorMap.size() > 0) {
        for (Animator runningAnim : ((HashMap) this.mAnimatorMap.clone()).keySet()) {
            runningAnim.cancel();
        }
    }
    this.mPendingAnimations.clear();
    View v = (View) this.mView.get();
    if (v != null) {
        v.removeCallbacks(this.mAnimationStarter);
    }
}
项目:Cable-Android    文件:TransferControlView.java   
private Animator getWidthAnimator(final int from, final int to) {
  final ValueAnimator anim = ValueAnimator.ofInt(from, to);
  anim.addUpdateListener(new AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      final int val = (Integer)animation.getAnimatedValue();
      final ViewGroup.LayoutParams layoutParams = getLayoutParams();
      layoutParams.width = val;
      setLayoutParams(layoutParams);
    }
  });
  anim.setInterpolator(new FastOutSlowInInterpolator());
  anim.setDuration(TRANSITION_MS);
  return anim;
}
项目:youkes_browser    文件:SwipeListViewTouchListener.java   
/**
 * Create choice animation
 *
 * @param view     affected view
 * @param position list position
 */
private void generateChoiceAnimate(final View view, final int position) {
    animate(view)
            .translationX(0)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    swipeListView.resetScrolling();
                    resetCell();
                }
            });
}
项目:youkes_browser    文件:SwipeListViewTouchListener.java   
/**
 * Create dismiss animation
 *
 * @param view      affected view
 * @param swap      If will change state. If is "false" returns to the original position
 * @param swapRight If swap is true, this parameter tells if move is to the right or left
 * @param position  Position of list
 */
private void generateDismissAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }

    int alpha = 1;
    if (swap) {
        ++dismissAnimationRefCount;
        alpha = 0;
    }

    animate(view)
            .translationX(moveTo)
            .alpha(alpha)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (swap) {
                        closeOpenedItems();
                        performDismiss(view, position, true);
                    }
                    resetCell();
                }
            });

}
项目:youkes_browser    文件:SwipeListViewTouchListener.java   
/**
 * Create reveal animation
 *
 * @param view      affected view
 * @param swap      If will change state. If "false" returns to the original position
 * @param swapRight If swap is true, this parameter tells if movement is toward right or left
 * @param position  list position
 */
private void generateRevealAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }

    animate(view)
            .translationX(moveTo)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    swipeListView.resetScrolling();
                    if (swap) {
                        boolean aux = !opened.get(position);
                        opened.set(position, aux);
                        if (aux) {
                            swipeListView.onOpened(position, swapRight);
                            openedRight.set(position, swapRight);
                        } else {
                            swipeListView.onClosed(position, openedRight.get(position));
                        }
                    }
                    resetCell();
                }
            });
}
项目:youkes_browser    文件:SwipeListViewTouchListener.java   
/**
 * Perform dismiss action
 *
 * @param dismissView     View
 * @param dismissPosition Position of list
 */
protected void performDismiss(final View dismissView, final int dismissPosition, boolean doPendingDismiss) {
    final ViewGroup.LayoutParams lp = dismissView.getLayoutParams();
    final int originalHeight = dismissView.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(animationTime);

    if (doPendingDismiss) {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                --dismissAnimationRefCount;
                if (dismissAnimationRefCount == 0) {
                    removePendingDismisses(originalHeight);
                }
            }
        });
    }

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            dismissView.setLayoutParams(lp);
        }
    });

    pendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
    animator.start();
}
项目:MenuSet    文件:MenuAdapter.java   
/**
 * Creates Open / Close AnimatorSet
 */
private AnimatorSet setOpenCloseAnimation(boolean isCloseAnimation) {
    List<Animator> textAnimations = new ArrayList<>();
    List<Animator> imageAnimations = new ArrayList<>();

    if (isCloseAnimation) {
        for (int i = getItemCount() - 1; i >= 0; i--) {
            fillOpenClosingAnimations(true, textAnimations, imageAnimations, i);
        }
    } else {
        for (int i = 0; i < getItemCount(); i++) {
            fillOpenClosingAnimations(false, textAnimations, imageAnimations, i);
        }
    }

    AnimatorSet textCloseAnimatorSet = new AnimatorSet();
    textCloseAnimatorSet.playSequentially(textAnimations);

    AnimatorSet imageCloseAnimatorSet = new AnimatorSet();
    imageCloseAnimatorSet.playSequentially(imageAnimations);

    AnimatorSet animatorFullSet = new AnimatorSet();
    animatorFullSet.playTogether(imageCloseAnimatorSet, textCloseAnimatorSet);
    animatorFullSet.setDuration(mAnimationDurationMilis);
    animatorFullSet.addListener(mCloseOpenAnimatorListener);
    animatorFullSet.setStartDelay(0);
    animatorFullSet.setInterpolator(new HesitateInterpolator());
    return animatorFullSet;
}
项目:GitHub    文件:ViewHolderFunc.java   
private void anim(final View v) {

        ObjectAnimator animator = ObjectAnimator.ofFloat(v, "rotationX", 0.0F, 360.0F)
                .setDuration(200);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {

                if (!Utils.login()) {
                    return;
                }
                switch (v.getId()) {

                    case R.id.fun_all:
                        v.getContext().startActivity(new Intent(v.getContext(), CategoryActivity.class));
                        break;
                    case R.id.fun_combo:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudTcActivity.class));
                        break;
                    case R.id.fun_charge:
                        v.getContext().startActivity(new Intent(v.getContext(), PhoneChargeActivity.class));
                        break;
                    case R.id.fun_wolrdgo:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudWorldGoActivity.class));
                        break;
                    case R.id.fun_cloud_p:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudPointActivity.class));
                        break;
                    case R.id.fun_omyo:
                        v.getContext().startActivity(new Intent(v.getContext(), OMYOActivity.class));
                        break;
                    case R.id.fun_cloud_club:
                        v.getContext().startActivity(new Intent(v.getContext(), CloudClubActivity.class));
                        break;
                    case R.id.fun_aboutus:
                        v.getContext().startActivity(new Intent(v.getContext(), AboutUsActivity.class));
                        break;

                }

            }
        });
        animator.start();
    }
项目:MenuSet    文件:MenuAdapter.java   
@Override
public void onAnimationRepeat(Animator animation) {
}