Search in sources :

Example 21 with AnimatorSet

use of com.nineoldandroids.animation.AnimatorSet in project AdvancedMaterialDrawer by madcyph3r.

the class MaterialRippleLayoutNineOld method startRipple.

private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled)
        return;
    float endRadius = getEndRadius();
    cancelAnimations();
    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
                setRadius(0);
                setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
                animationEndRunnable.run();
            }
            childView.setPressed(false);
        }
    });
    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);
    if (ripplePersistent) {
        rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
        fade.setStartDelay(0);
        rippleAnimator.play(fade);
    } else {
        rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 22 with AnimatorSet

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

the class SettingActivity method closeActivityAnimation.

private void closeActivityAnimation() {
    int actionBarHeight = getActionBarSize();
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenHeight = dm.heightPixels;
    int contentHeight = screenHeight - actionBarHeight;
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(Const.DURATION_ACTIVITY);
    animation.playTogether(ObjectAnimator.ofFloat(mToolbarLayout, "translationY", 0, -actionBarHeight), ObjectAnimator.ofFloat(mScrollView, "translationY", 0, contentHeight));
    animation.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mIsHiding = false;
            finish();
            overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_no_animation);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

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

Example 23 with AnimatorSet

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

the class SettingActivity method startActivityAnimation.

@Override
public void startActivityAnimation() {
    int actionBarHeight = getActionBarSize();
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenHeight = dm.heightPixels;
    int contentHeight = screenHeight - actionBarHeight;
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(Const.DURATION_ACTIVITY);
    animation.playTogether(ObjectAnimator.ofFloat(mToolbarLayout, "translationY", -actionBarHeight, 0), ObjectAnimator.ofFloat(mScrollView, "translationY", contentHeight, 0));
    animation.start();
}
Also used : AnimatorSet(com.nineoldandroids.animation.AnimatorSet) DisplayMetrics(android.util.DisplayMetrics)

Example 24 with AnimatorSet

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

the class AnimationTopLayout method doAnimation.

public void doAnimation() {
    ObjectAnimator downAnimation = ObjectAnimator.ofFloat(mChildView, "Y", 0f, getResources().getDimension(R.dimen.dimen_48dip));
    downAnimation.setDuration(ANIMATION_TIME / 2);
    downAnimation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (mOnAnimationHalfFinishListener != null) {
                mOnAnimationHalfFinishListener.onHalf(mChildView);
            }
        }
    });
    ObjectAnimator upAnimation = ObjectAnimator.ofFloat(mChildView, "Y", -getResources().getDimension(R.dimen.dimen_48dip), 0f);
    upAnimation.setDuration(ANIMATION_TIME / 2);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playSequentially(downAnimation, upAnimation);
    animatorSet.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) AnimatorSet(com.nineoldandroids.animation.AnimatorSet)

Example 25 with AnimatorSet

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

the class EditTextActivity method finishActivityWithAnimation.

@Override
public void finishActivityWithAnimation(final boolean saved, final int categoryId, final int position, final int comparator) {
    int actionBarHeight = getActionBarSize();
    int screenHeight = Utils.sScreenHeight;
    int contentEditHeight = screenHeight - actionBarHeight;
    AnimatorSet animation = new AnimatorSet();
    animation.setDuration(Const.DURATION_ACTIVITY);
    animation.playTogether(ObjectAnimator.ofFloat(mAppBarLayout, "translationY", 0, -actionBarHeight), ObjectAnimator.ofFloat(mTitleTextInputLayout, "translationY", 0, -actionBarHeight * 3), ObjectAnimator.ofFloat(mContentEdit, "translationY", 0, contentEditHeight), ObjectAnimator.ofFloat(mFabMenuLayout, "translationY", 0, contentEditHeight), ObjectAnimator.ofFloat(mHorizontalEditScrollView, "translationY", 0, contentEditHeight));
    animation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            if (!saved) {
                setResult(RESULT_NOTHING);
                EditTextActivity.this.finish();
                overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_no_animation);
            } else {
                Intent intent = new Intent();
                Bundle bundle = new Bundle();
                bundle.putInt(Const.PHOTO_POSITION, position);
                bundle.putInt(Const.CATEGORY_ID_4_PHOTNOTES, categoryId);
                bundle.putInt(Const.COMPARATOR_FACTORY, comparator);
                intent.putExtras(bundle);
                setResult(RESULT_DATA, intent);
                EditTextActivity.this.finish();
                overridePendingTransition(R.anim.activity_no_animation, R.anim.activity_no_animation);
            }
        }
    });
    animation.start();
}
Also used : ObjectAnimator(com.nineoldandroids.animation.ObjectAnimator) Animator(com.nineoldandroids.animation.Animator) AnimatorListenerAdapter(com.nineoldandroids.animation.AnimatorListenerAdapter) Bundle(android.os.Bundle) AnimatorSet(com.nineoldandroids.animation.AnimatorSet) Intent(android.content.Intent) Point(android.graphics.Point)

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