Search in sources :

Example 41 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project Context-Menu.Android by Yalantis.

the class AnimatorUtils method fadeOutSet.

public static AnimatorSet fadeOutSet(View v, float x) {
    AnimatorSet fadeOutSet = new AnimatorSet();
    fadeOutSet.playTogether(alfaDisappear(v), translationRight(v, x));
    return fadeOutSet;
}
Also used : AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 42 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project Carbon by ZieIony.

the class RippleForeground method createSoftwareExit.

@Override
protected Animator createSoftwareExit() {
    final int radiusDuration;
    final int originDuration;
    final int opacityDuration;
    if (mIsBounded) {
        computeBoundedTargetValues();
        radiusDuration = BOUNDED_RADIUS_EXIT_DURATION;
        originDuration = BOUNDED_ORIGIN_EXIT_DURATION;
        opacityDuration = BOUNDED_OPACITY_EXIT_DURATION;
    } else {
        radiusDuration = getRadiusExitDuration();
        originDuration = radiusDuration;
        opacityDuration = getOpacityExitDuration();
    }
    final ObjectAnimator tweenRadius = ObjectAnimator.ofFloat(this, TWEEN_RADIUS, 1);
    AnimatorsCompat.setAutoCancel(tweenRadius);
    //tweenRadius.setAutoCancel(true);
    tweenRadius.setDuration(radiusDuration);
    tweenRadius.setInterpolator(DECELERATE_INTERPOLATOR);
    final ObjectAnimator tweenOrigin = ObjectAnimator.ofFloat(this, TWEEN_ORIGIN, 1);
    AnimatorsCompat.setAutoCancel(tweenOrigin);
    //tweenOrigin.setAutoCancel(true);
    tweenOrigin.setDuration(originDuration);
    tweenOrigin.setInterpolator(DECELERATE_INTERPOLATOR);
    final ObjectAnimator opacity = ObjectAnimator.ofFloat(this, OPACITY, 0);
    AnimatorsCompat.setAutoCancel(opacity);
    //opacity.setAutoCancel(true);
    opacity.setDuration(opacityDuration);
    opacity.setInterpolator(LINEAR_INTERPOLATOR);
    final AnimatorSet set = new AnimatorSet();
    set.play(tweenOrigin).with(tweenRadius).with(opacity);
    set.addListener(mAnimationListener);
    return set;
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) Paint(android.graphics.Paint)

Example 43 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project XhsEmoticonsKeyboard by w446108264.

the class AnimEmoticonsIndicatorView method playBy.

public void playBy(int startPosition, int nextPosition, PageSetEntity pageSetEntity) {
    if (!checkPageSetEntity(pageSetEntity)) {
        return;
    }
    updateIndicatorCount(pageSetEntity.getPageCount());
    boolean isShowInAnimOnly = false;
    if (startPosition < 0 || nextPosition < 0 || nextPosition == startPosition) {
        startPosition = nextPosition = 0;
    }
    if (startPosition < 0) {
        isShowInAnimOnly = true;
        startPosition = nextPosition = 0;
    }
    final ImageView imageViewStrat = mImageViews.get(startPosition);
    final ImageView imageViewNext = mImageViews.get(nextPosition);
    ObjectAnimator anim1 = ObjectAnimator.ofFloat(imageViewStrat, "scaleX", 1.0f, 0.25f);
    ObjectAnimator anim2 = ObjectAnimator.ofFloat(imageViewStrat, "scaleY", 1.0f, 0.25f);
    if (mPlayByOutAnimatorSet != null && mPlayByOutAnimatorSet.isRunning()) {
        mPlayByOutAnimatorSet.cancel();
        mPlayByOutAnimatorSet = null;
    }
    mPlayByOutAnimatorSet = new AnimatorSet();
    mPlayByOutAnimatorSet.play(anim1).with(anim2);
    mPlayByOutAnimatorSet.setDuration(100);
    ObjectAnimator animIn1 = ObjectAnimator.ofFloat(imageViewNext, "scaleX", 0.25f, 1.0f);
    ObjectAnimator animIn2 = ObjectAnimator.ofFloat(imageViewNext, "scaleY", 0.25f, 1.0f);
    if (mPlayByInAnimatorSet != null && mPlayByInAnimatorSet.isRunning()) {
        mPlayByInAnimatorSet.cancel();
        mPlayByInAnimatorSet = null;
    }
    mPlayByInAnimatorSet = new AnimatorSet();
    mPlayByInAnimatorSet.play(animIn1).with(animIn2);
    mPlayByInAnimatorSet.setDuration(100);
    if (isShowInAnimOnly) {
        mPlayByInAnimatorSet.start();
        return;
    }
    anim1.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            imageViewStrat.setImageDrawable(mDrawableNomal);
            ObjectAnimator animFil1l = ObjectAnimator.ofFloat(imageViewStrat, "scaleX", 1.0f);
            ObjectAnimator animFill2 = ObjectAnimator.ofFloat(imageViewStrat, "scaleY", 1.0f);
            AnimatorSet mFillAnimatorSet = new AnimatorSet();
            mFillAnimatorSet.play(animFil1l).with(animFill2);
            mFillAnimatorSet.start();
            imageViewNext.setImageDrawable(mDrawableSelect);
            mPlayByInAnimatorSet.start();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    mPlayByOutAnimatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) ImageView(android.widget.ImageView)

Example 44 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project ListViewAnimations by nhaarman.

the class AnimateAdditionAdapter method getView.

@Override
@NonNull
public View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent) {
    final View view = super.getView(position, convertView, parent);
    if (mInsertQueue.getActiveIndexes().contains(position)) {
        int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.MATCH_PARENT, View.MeasureSpec.AT_MOST);
        int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED);
        view.measure(widthMeasureSpec, heightMeasureSpec);
        int originalHeight = view.getMeasuredHeight();
        ValueAnimator heightAnimator = ValueAnimator.ofInt(1, originalHeight);
        heightAnimator.addUpdateListener(new HeightUpdater(view));
        Animator[] customAnimators = getAdditionalAnimators(view, parent);
        Animator[] animators = new Animator[customAnimators.length + 1];
        animators[0] = heightAnimator;
        System.arraycopy(customAnimators, 0, animators, 1, customAnimators.length);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(animators);
        ViewHelper.setAlpha(view, 0);
        ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);
        AnimatorSet allAnimatorsSet = new AnimatorSet();
        allAnimatorsSet.playSequentially(animatorSet, alphaAnimator);
        allAnimatorsSet.setDuration(mInsertionAnimationDurationMs);
        allAnimatorsSet.addListener(new ExpandAnimationListener(position));
        allAnimatorsSet.start();
    }
    return view;
}
Also used : ValueAnimator(com.nineoldandroids.animation.ValueAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) ValueAnimator(com.nineoldandroids.animation.ValueAnimator) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) NonNull(android.support.annotation.NonNull)

Example 45 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project ListViewAnimations by nhaarman.

the class SwipeTouchListener method restoreCurrentViewTranslation.

/**
     * Animates the pending {@link android.view.View} back to its original position.
     */
private void restoreCurrentViewTranslation() {
    if (mCurrentView == null) {
        return;
    }
    ObjectAnimator xAnimator = ObjectAnimator.ofFloat(mSwipingView, TRANSLATION_X, 0);
    ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mSwipingView, ALPHA, 1);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(xAnimator, alphaAnimator);
    animatorSet.setDuration(mAnimationTime);
    animatorSet.addListener(new RestoreAnimatorListener(mCurrentView, mCurrentPosition));
    animatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Aggregations

AnimatorSet (com.nineoldandroids.animation.AnimatorSet)57 ObjectAnimator (com.nineoldandroids.animation.ObjectAnimator)42 Animator (com.nineoldandroids.animation.Animator)24 AnimatorListenerAdapter (com.nineoldandroids.animation.AnimatorListenerAdapter)11 View (android.view.View)6 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)4 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 SuppressLint (android.annotation.SuppressLint)3 Paint (android.graphics.Paint)3 OvershootInterpolator (android.view.animation.OvershootInterpolator)3 Point (android.graphics.Point)2 DisplayMetrics (android.util.DisplayMetrics)2 LinearInterpolator (android.view.animation.LinearInterpolator)2 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)2 IDetailView (com.yydcdut.note.views.note.IDetailView)2 FontTextView (com.yydcdut.note.widget.FontTextView)2 RevealView (com.yydcdut.note.widget.RevealView)2