Search in sources :

Example 31 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project PhotoNoter by yydcdut.

the class PhotoDetailActivity method showWidget.

@Override
public void showWidget(final IPhotoDetailPresenter.OnAnimationAdapter onAnimationAdapter) {
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(1000);
    animation.playTogether(ObjectAnimator.ofFloat(mAppBarLayout, "Y", -getActionBarSize() - (AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0), AppCompat.AFTER_LOLLIPOP ? getStatusBarSize() : 0), ObjectAnimator.ofFloat(mBottomLayout, "Y", mBottomLayout.getTop() + getActionBarSize(), mBottomLayout.getTop()), ObjectAnimator.ofFloat(mStatusCoverView, "Y", -getActionBarSize(), 0f));
    animation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            if (onAnimationAdapter != null) {
                onAnimationAdapter.onAnimationStarted(IPhotoDetailPresenter.STATE_SHOW);
            }
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (onAnimationAdapter != null) {
                onAnimationAdapter.onAnimationEnded(IPhotoDetailPresenter.STATE_SHOW);
            }
        }
    });
    animation.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 32 with AnimatorSet

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

the class AnimEmoticonsIndicatorView method playTo.

public void playTo(int position, PageSetEntity pageSetEntity) {
    if (!checkPageSetEntity(pageSetEntity)) {
        return;
    }
    updateIndicatorCount(pageSetEntity.getPageCount());
    for (ImageView iv : mImageViews) {
        iv.setImageDrawable(mDrawableNomal);
    }
    mImageViews.get(position).setImageDrawable(mDrawableSelect);
    final ImageView imageViewStrat = mImageViews.get(position);
    ObjectAnimator animIn1 = ObjectAnimator.ofFloat(imageViewStrat, "scaleX", 0.25f, 1.0f);
    ObjectAnimator animIn2 = ObjectAnimator.ofFloat(imageViewStrat, "scaleY", 0.25f, 1.0f);
    if (mPlayToAnimatorSet != null && mPlayToAnimatorSet.isRunning()) {
        mPlayToAnimatorSet.cancel();
        mPlayToAnimatorSet = null;
    }
    mPlayToAnimatorSet = new AnimatorSet();
    mPlayToAnimatorSet.play(animIn1).with(animIn2);
    mPlayToAnimatorSet.setDuration(100);
    mPlayToAnimatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) ImageView(android.widget.ImageView)

Example 33 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project android-shapeLoadingView by zzz40500.

the class LoadingView method upThrow.

/**
 * 上抛
 */
public void upThrow() {
    if (mUpAnimatorSet == null) {
        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mShapeLoadingView, "translationY", mDistance, 0);
        ObjectAnimator scaleIndication = ObjectAnimator.ofFloat(mIndicationIm, "scaleX", 1f, 0.2f);
        ObjectAnimator objectAnimator1 = null;
        switch(mShapeLoadingView.getShape()) {
            case SHAPE_RECT:
                objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
                break;
            case SHAPE_CIRCLE:
                objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
                break;
            case SHAPE_TRIANGLE:
                objectAnimator1 = ObjectAnimator.ofFloat(mShapeLoadingView, "rotation", 0, 180);
                break;
        }
        mUpAnimatorSet = new AnimatorSet();
        mUpAnimatorSet.playTogether(objectAnimator, objectAnimator1, scaleIndication);
        mUpAnimatorSet.setDuration(ANIMATION_DURATION);
        mUpAnimatorSet.setInterpolator(new DecelerateInterpolator(FACTOR));
        mUpAnimatorSet.addListener(new Animator.AnimatorListener() {

            @Override
            public void onAnimationStart(Animator animation) {
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                if (!mStopped) {
                    freeFall();
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {
            }

            @Override
            public void onAnimationRepeat(Animator animation) {
            }
        });
    }
    mUpAnimatorSet.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 34 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project Meizhi by drakeet.

the class FloatView method translationX.

public void translationX(float fromX, float toX, float formAlpha, final float toAlpha) {
    ObjectAnimator a1 = ObjectAnimator.ofFloat(rootView, "alpha", formAlpha, toAlpha);
    ObjectAnimator a2 = ObjectAnimator.ofFloat(rootView, "translationX", fromX, toX);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(a1, a2);
    animatorSet.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (toAlpha == 0) {
                HeadsUpManager.getInstant(getContext()).dismiss();
                cutDown = -1;
                if (velocityTracker != null) {
                    velocityTracker.clear();
                    try {
                        velocityTracker.recycle();
                    } catch (IllegalStateException e) {
                    }
                }
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

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

Example 35 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project datetimepicker by flavienlaurent.

the class RadialPickerLayout method setCurrentItemShowing.

/**
     * Set either minutes or hours as showing.
     *
     * @param animate True to animate the transition, false to show with no animation.
     */
public void setCurrentItemShowing(int index, boolean animate) {
    if (index != HOUR_INDEX && index != MINUTE_INDEX) {
        Log.e(TAG, "TimePicker does not support view at index " + index);
        return;
    }
    //NineOldDroids does not work in this case due to dependency recursion.
    //Don't animate on API 14
    animate = animate && Build.VERSION.SDK_INT > 14;
    int lastIndex = getCurrentItemShowing();
    mCurrentItemShowing = index;
    if (animate && (index != lastIndex)) {
        ObjectAnimator[] anims = new ObjectAnimator[4];
        if (index == MINUTE_INDEX) {
            anims[0] = mHourRadialTextsView.getDisappearAnimator();
            anims[1] = mHourRadialSelectorView.getDisappearAnimator();
            anims[2] = mMinuteRadialTextsView.getReappearAnimator();
            anims[3] = mMinuteRadialSelectorView.getReappearAnimator();
        } else if (index == HOUR_INDEX) {
            anims[0] = mHourRadialTextsView.getReappearAnimator();
            anims[1] = mHourRadialSelectorView.getReappearAnimator();
            anims[2] = mMinuteRadialTextsView.getDisappearAnimator();
            anims[3] = mMinuteRadialSelectorView.getDisappearAnimator();
        }
        if (mTransition != null && mTransition.isRunning()) {
            mTransition.end();
        }
        mTransition = new AnimatorSet();
        mTransition.playTogether(anims);
        mTransition.start();
    } else {
        if (Build.VERSION.SDK_INT >= 11) {
            int hourAlpha = (index == HOUR_INDEX) ? 255 : 0;
            int minuteAlpha = (index == MINUTE_INDEX) ? 255 : 0;
            mHourRadialTextsView.setAlpha(hourAlpha);
            mHourRadialSelectorView.setAlpha(hourAlpha);
            mMinuteRadialTextsView.setAlpha(minuteAlpha);
            mMinuteRadialSelectorView.setAlpha(minuteAlpha);
        } else {
            int hourVisibility = (index == HOUR_INDEX) ? View.VISIBLE : View.INVISIBLE;
            int minuteVisibility = (index == MINUTE_INDEX) ? View.VISIBLE : View.INVISIBLE;
            mHourRadialTextsView.setVisibility(hourVisibility);
            mHourRadialSelectorView.setVisibility(hourVisibility);
            mMinuteRadialTextsView.setVisibility(minuteVisibility);
            mMinuteRadialSelectorView.setVisibility(minuteVisibility);
        }
    }
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) SuppressLint(android.annotation.SuppressLint)

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