Search in sources :

Example 86 with AnimatorSet

use of android.animation.AnimatorSet in project Timber by naman14.

the class FastScroller method showBubble.

private void showBubble() {
    AnimatorSet animatorSet = new AnimatorSet();
    bubble.setVisibility(VISIBLE);
    if (currentAnimator != null)
        currentAnimator.cancel();
    currentAnimator = ObjectAnimator.ofFloat(bubble, "alpha", 0f, 1f).setDuration(BUBBLE_ANIMATION_DURATION);
    currentAnimator.start();
}
Also used : AnimatorSet(android.animation.AnimatorSet)

Example 87 with AnimatorSet

use of android.animation.AnimatorSet in project AnimationEasingFunctions by daimajia.

the class MyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    mEasingList = (ListView) findViewById(R.id.easing_list);
    mAdapter = new EasingAdapter(this);
    mEasingList.setAdapter(mAdapter);
    mTarget = findViewById(R.id.target);
    mHistory = (DrawView) findViewById(R.id.history);
    mEasingList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            mHistory.clear();
            Skill s = (Skill) view.getTag();
            AnimatorSet set = new AnimatorSet();
            mTarget.setTranslationX(0);
            mTarget.setTranslationY(0);
            set.playTogether(Glider.glide(s, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, dipToPixels(MyActivity.this, -(160 - 3))), new BaseEasingMethod.EasingListener() {

                @Override
                public void on(float time, float value, float start, float end, float duration) {
                    mHistory.drawPoint(time, duration, value - dipToPixels(MyActivity.this, 60));
                }
            }));
            set.setDuration(1200);
            set.start();
        }
    });
}
Also used : BaseEasingMethod(com.daimajia.easing.BaseEasingMethod) AnimatorSet(android.animation.AnimatorSet) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Skill(com.daimajia.easing.Skill) AdapterView(android.widget.AdapterView)

Example 88 with AnimatorSet

use of android.animation.AnimatorSet in project circular-progress-button by dmytrodanylyk.

the class MorphingAnimation method start.

public void start() {
    ValueAnimator widthAnimation = ValueAnimator.ofInt(mFromWidth, mToWidth);
    final GradientDrawable gradientDrawable = mDrawable.getGradientDrawable();
    widthAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            Integer value = (Integer) animation.getAnimatedValue();
            int leftOffset;
            int rightOffset;
            int padding;
            if (mFromWidth > mToWidth) {
                leftOffset = (mFromWidth - value) / 2;
                rightOffset = mFromWidth - leftOffset;
                padding = (int) (mPadding * animation.getAnimatedFraction());
            } else {
                leftOffset = (mToWidth - value) / 2;
                rightOffset = mToWidth - leftOffset;
                padding = (int) (mPadding - mPadding * animation.getAnimatedFraction());
            }
            gradientDrawable.setBounds(leftOffset + padding, padding, rightOffset - padding, mView.getHeight() - padding);
        }
    });
    ObjectAnimator bgColorAnimation = ObjectAnimator.ofInt(gradientDrawable, "color", mFromColor, mToColor);
    bgColorAnimation.setEvaluator(new ArgbEvaluator());
    ObjectAnimator strokeColorAnimation = ObjectAnimator.ofInt(mDrawable, "strokeColor", mFromStrokeColor, mToStrokeColor);
    strokeColorAnimation.setEvaluator(new ArgbEvaluator());
    ObjectAnimator cornerAnimation = ObjectAnimator.ofFloat(gradientDrawable, "cornerRadius", mFromCornerRadius, mToCornerRadius);
    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.setDuration(mDuration);
    animatorSet.playTogether(widthAnimation, bgColorAnimation, strokeColorAnimation, cornerAnimation);
    animatorSet.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mListener != null) {
                mListener.onAnimationEnd();
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    animatorSet.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) ObjectAnimator(android.animation.ObjectAnimator) ArgbEvaluator(android.animation.ArgbEvaluator) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator) GradientDrawable(android.graphics.drawable.GradientDrawable)

Example 89 with AnimatorSet

use of android.animation.AnimatorSet in project UltimateAndroid by cymcsg.

the class KugouLayout method init.

private void init(Context context) {
    setBackgroundColor(0x0);
    /**
         * Distance in pixels a touch can wander before we think the user is scrolling
         * */
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaxVelocity = configuration.getScaledMaximumFlingVelocity();
    mContentContainer = new UnClickableFrameLayout(context);
    mContentContainer.setId(R.id.kugou_layout_md__content);
    /**
         * init Property Animation
         * */
    mAnimatorSet = new AnimatorSet();
    mOffsetAnimator = ObjectAnimator.ofFloat(this, aOffset, 0, 0);
    mOffsetAnimator.setDuration(ANIM_DURATION);
    mAnimatorSet.playTogether(mOffsetAnimator);
    mAnimatorSet.setInterpolator(mInterpolator);
    mOffsetAnimator.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            float endValue = (Float) mOffsetAnimator.getAnimatedValue();
            if ((endValue == getWidth() || endValue == -getWidth())) {
                setVisibility(INVISIBLE);
                if (null != mLayoutCloseListener) {
                    mLayoutCloseListener.onLayoutClose();
                }
            } else if (endValue == 0 && showingChangeAlpha) {
                showingChangeAlpha = false;
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }
    });
    /**
         * create rebound animator
         * */
    mSpringSystem = SpringSystem.create();
    mSpring = mSpringSystem.createSpring();
    SpringConfig config = new SpringConfig(70, 9);
    mSpring.setSpringConfig(config);
    mSpring.setCurrentValue(0);
    mSpring.addListener(new SpringListener() {

        @Override
        public void onSpringUpdate(Spring spring) {
            if (doAnim) {
                double newValue = 1 - spring.getCurrentValue();
                mOffsetPixels = (float) newValue * mBeginOffsetX;
                moveContent();
                if (showingChangeAlpha) {
                    changeAlpha();
                }
            }
        }

        @Override
        public void onSpringAtRest(Spring spring) {
        }

        @Override
        public void onSpringActivate(Spring spring) {
        }

        @Override
        public void onSpringEndStateChange(Spring spring) {
        }
    });
    /**
         * add frame_layout mContentContainer as the parent of the activity's content view
         * */
    super.addView(mContentContainer, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    mContentContainer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
Also used : ViewConfiguration(android.view.ViewConfiguration) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) SpringListener(com.marshalchen.common.uimodule.rebound.SpringListener) AnimatorSet(android.animation.AnimatorSet) SpringConfig(com.marshalchen.common.uimodule.rebound.SpringConfig) Spring(com.marshalchen.common.uimodule.rebound.Spring)

Example 90 with AnimatorSet

use of android.animation.AnimatorSet in project UltimateAndroid by cymcsg.

the class MenuCircleShowingAnimation method closePromotedActions.

/**
     * Set close animation for promoted actions
     */
public AnimatorSet closePromotedActions() {
    if (objectAnimator == null) {
        objectAnimatorSetup();
    }
    AnimatorSet animation = new AnimatorSet();
    for (int i = 0; i < promotedActions.size(); i++) {
        objectAnimator[i] = setCloseAnimation(promotedActions.get(i), i);
    }
    if (objectAnimator.length == 0) {
        objectAnimator = null;
    }
    animation.playTogether(objectAnimator);
    animation.addListener(new Animator.AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animator) {
            mainImageButton.startAnimation(rotateCloseAnimation);
            mainImageButton.setClickable(false);
        }

        @Override
        public void onAnimationEnd(Animator animator) {
            mainImageButton.setClickable(true);
            hidePromotedActions();
        }

        @Override
        public void onAnimationCancel(Animator animator) {
            mainImageButton.setClickable(true);
        }

        @Override
        public void onAnimationRepeat(Animator animator) {
        }
    });
    return animation;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorSet(android.animation.AnimatorSet)

Aggregations

AnimatorSet (android.animation.AnimatorSet)491 ObjectAnimator (android.animation.ObjectAnimator)343 Animator (android.animation.Animator)285 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)144 View (android.view.View)109 ValueAnimator (android.animation.ValueAnimator)103 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)52 ArrayList (java.util.ArrayList)50 Rect (android.graphics.Rect)43 ViewGroup (android.view.ViewGroup)42 ImageView (android.widget.ImageView)36 TextView (android.widget.TextView)32 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)26 PropertyValuesHolder (android.animation.PropertyValuesHolder)25 Paint (android.graphics.Paint)25 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)25 Bitmap (android.graphics.Bitmap)17 Point (android.graphics.Point)15 OvershootInterpolator (android.view.animation.OvershootInterpolator)15 BitmapDrawable (android.graphics.drawable.BitmapDrawable)14