Java Code Examples for com.nineoldandroids.animation.ObjectAnimator#setTarget()

The following examples show how to use com.nineoldandroids.animation.ObjectAnimator#setTarget() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MyRapidFloatingActionContentLabelList.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
public void onExpandAnimator(AnimatorSet animatorSet) {
    int count = this.contentView.getChildCount();

    for(int i = 0; i < count; ++i) {
        View rootView = this.contentView.getChildAt(i);
        ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
        if(null == iconIv) {
            return;
        }

        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(new float[]{45.0F, 0.0F});
        animator.setPropertyName("rotation");
        animator.setInterpolator(this.mOvershootInterpolator);
        //animator.setStartDelay((long)(count * i * 20));
        animatorSet.playTogether(new Animator[]{animator});
    }

}
 
Example 2
Source File: MyRapidFloatingActionContentLabelList.java    From nono-android with GNU General Public License v3.0 6 votes vote down vote up
public void onCollapseAnimator(AnimatorSet animatorSet) {
    int count = this.contentView.getChildCount();

    for(int i = 0; i < count; ++i) {
        View rootView = this.contentView.getChildAt(i);
        ImageView iconIv = (ImageView)ABViewUtil.obtainView(rootView, com.wangjie.rapidfloatingactionbutton.R.id.rfab__content_label_list_icon_iv);
        if(null == iconIv) {
            return;
        }

        ObjectAnimator animator = new ObjectAnimator();
        animator.setTarget(iconIv);
        animator.setFloatValues(new float[]{0.0F, 45.0F});
        animator.setPropertyName("rotation");
        animator.setInterpolator(this.mOvershootInterpolator);
        //animator.setStartDelay((long)(count * i * 20));
        animatorSet.playTogether(new Animator[]{animator});
    }

}
 
Example 3
Source File: ViewTransitionBuilder.java    From android-transition with Apache License 2.0 5 votes vote down vote up
@Override
public void setupAnimation(@NonNull TransitionControllerManager manager) {
    if (mView == null) {
        mView = manager.getTarget();
    }

    if (mDelayed != null) {
        for (int i = 0, size = mDelayed.size(); i < size; i++) {
            mDelayed.get(i).evaluate(manager.getTarget(), this);
        }
    }

    for (int i = 0, size = mSetupList.size(); i < size; i++) {
        mSetupList.get(i).setupAnimation(manager);
    }

    if (mCustomTransitionController != null) {
        mCustomTransitionController.setTarget(manager.getTarget());
        mCustomTransitionController.setRange(mStart, mEnd);
        manager.addTransitionController(mCustomTransitionController.clone());
    }

    ObjectAnimator anim = new ObjectAnimator();
    anim.setTarget(mView);
    anim.setValues(getValuesHolders());
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(anim);
    animatorSet.setDuration(SCALE_FACTOR);
    manager.addAnimatorSetAsTransition(mView, animatorSet).setRange(mStart, mEnd);
}
 
Example 4
Source File: FloatingActionItemImageView.java    From android-floating-action-menu with Apache License 2.0 4 votes vote down vote up
public FloatingActionItemImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    mShowListener = new Animator.AnimatorListener() {
        boolean isCancelled;

        @Override
        public void onAnimationStart(final Animator animation) {
            isCancelled = false;
            FloatingActionItemImageView.this.onAnimationStart(ANIMATION_SHOW);
        }

        @Override
        public void onAnimationEnd(final Animator animation) {
            if (!isCancelled) {
                FloatingActionItemImageView.this.onAnimationEnd(ANIMATION_SHOW);
            }
        }

        @Override
        public void onAnimationCancel(final Animator animation) {
            isCancelled = true;
        }

        @Override
        public void onAnimationRepeat(final Animator animation) {}
    };

    mHideListener = new Animator.AnimatorListener() {
        boolean isCancelled;

        @Override
        public void onAnimationStart(final Animator animation) {
            isCancelled = false;
            FloatingActionItemImageView.this.onAnimationStart(ANIMATION_HIDE);
        }

        @Override
        public void onAnimationEnd(final Animator animation) {
            if (!isCancelled) {
                FloatingActionItemImageView.this.onAnimationEnd(ANIMATION_HIDE);
            }
        }

        @Override
        public void onAnimationCancel(final Animator animation) {
            isCancelled = true;
        }

        @Override
        public void onAnimationRepeat(final Animator animation) {}
    };

    mShowAnimator = new ObjectAnimator();
    mShowAnimator.setTarget(this);
    if (null != mShowListener) {
        mShowAnimator.addListener(mShowListener);
    }

    mHideAnimator = new ObjectAnimator();
    mHideAnimator.setTarget(this);
    if (null != mHideListener) {
        mHideAnimator.addListener(mHideListener);
    }
}