Search in sources :

Example 86 with Animator

use of android.animation.Animator in project platform_frameworks_base by android.

the class SettingsButton method startAccelSpin.

protected void startAccelSpin() {
    cancelAnimation();
    mAnimator = ObjectAnimator.ofFloat(this, View.ROTATION, 0, 360);
    mAnimator.setInterpolator(AnimationUtils.loadInterpolator(mContext, android.R.interpolator.accelerate_quad));
    mAnimator.setDuration(ACCEL_LENGTH);
    mAnimator.addListener(new AnimatorListener() {

        @Override
        public void onAnimationStart(Animator animation) {
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            startContinuousSpin();
        }

        @Override
        public void onAnimationCancel(Animator animation) {
        }
    });
    mAnimator.start();
}
Also used : AnimatorListener(android.animation.Animator.AnimatorListener) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator)

Example 87 with Animator

use of android.animation.Animator in project platform_frameworks_base by android.

the class KeyguardUserSwitcher method startAppearAnimation.

private void startAppearAnimation() {
    int count = mUserSwitcher.getChildCount();
    View[] objects = new View[count];
    for (int i = 0; i < count; i++) {
        objects[i] = mUserSwitcher.getChildAt(i);
    }
    mUserSwitcher.setClipChildren(false);
    mUserSwitcher.setClipToPadding(false);
    mAppearAnimationUtils.startAnimation(objects, new Runnable() {

        @Override
        public void run() {
            mUserSwitcher.setClipChildren(true);
            mUserSwitcher.setClipToPadding(true);
        }
    });
    mAnimating = true;
    mBgAnimator = ObjectAnimator.ofInt(mBackground, "alpha", 0, 255);
    mBgAnimator.setDuration(400);
    mBgAnimator.setInterpolator(Interpolators.ALPHA_IN);
    mBgAnimator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mBgAnimator = null;
            mAnimating = false;
        }
    });
    mBgAnimator.start();
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) UserDetailItemView(com.android.systemui.qs.tiles.UserDetailItemView) NotificationPanelView(com.android.systemui.statusbar.phone.NotificationPanelView) View(android.view.View) KeyguardStatusBarView(com.android.systemui.statusbar.phone.KeyguardStatusBarView)

Example 88 with Animator

use of android.animation.Animator in project platform_frameworks_base by android.

the class PanelView method startUnlockHintAnimationPhase1.

/**
     * Phase 1: Move everything upwards.
     */
private void startUnlockHintAnimationPhase1(final Runnable onAnimationFinished) {
    float target = Math.max(0, getMaxPanelHeight() - mHintDistance);
    ValueAnimator animator = createHeightAnimator(target);
    animator.setDuration(250);
    animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
    animator.addListener(new AnimatorListenerAdapter() {

        private boolean mCancelled;

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

        @Override
        public void onAnimationEnd(Animator animation) {
            if (mCancelled) {
                mHeightAnimator = null;
                onAnimationFinished.run();
            } else {
                startUnlockHintAnimationPhase2(onAnimationFinished);
            }
        }
    });
    animator.start();
    mHeightAnimator = animator;
    mKeyguardBottomArea.getIndicationView().animate().translationY(-mHintDistance).setDuration(250).setInterpolator(Interpolators.FAST_OUT_SLOW_IN).withEndAction(new Runnable() {

        @Override
        public void run() {
            mKeyguardBottomArea.getIndicationView().animate().translationY(0).setDuration(450).setInterpolator(mBounceInterpolator).start();
        }
    }).start();
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 89 with Animator

use of android.animation.Animator in project platform_frameworks_base by android.

the class PanelView method startUnlockHintAnimationPhase2.

/**
     * Phase 2: Bounce down.
     */
private void startUnlockHintAnimationPhase2(final Runnable onAnimationFinished) {
    ValueAnimator animator = createHeightAnimator(getMaxPanelHeight());
    animator.setDuration(450);
    animator.setInterpolator(mBounceInterpolator);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            mHeightAnimator = null;
            onAnimationFinished.run();
            notifyBarPanelExpansionChanged();
        }
    });
    animator.start();
    mHeightAnimator = animator;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ValueAnimator(android.animation.ValueAnimator)

Example 90 with Animator

use of android.animation.Animator in project platform_frameworks_base by android.

the class AnimatedVectorDrawable method inflate.

@Override
public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
    final AnimatedVectorDrawableState state = mAnimatedVectorState;
    int eventType = parser.getEventType();
    float pathErrorScale = 1;
    final int innerDepth = parser.getDepth() + 1;
    // Parse everything until the end of the animated-vector element.
    while (eventType != XmlPullParser.END_DOCUMENT && (parser.getDepth() >= innerDepth || eventType != XmlPullParser.END_TAG)) {
        if (eventType == XmlPullParser.START_TAG) {
            final String tagName = parser.getName();
            if (ANIMATED_VECTOR.equals(tagName)) {
                final TypedArray a = obtainAttributes(res, theme, attrs, R.styleable.AnimatedVectorDrawable);
                int drawableRes = a.getResourceId(R.styleable.AnimatedVectorDrawable_drawable, 0);
                if (drawableRes != 0) {
                    VectorDrawable vectorDrawable = (VectorDrawable) res.getDrawable(drawableRes, theme).mutate();
                    vectorDrawable.setAllowCaching(false);
                    vectorDrawable.setCallback(mCallback);
                    pathErrorScale = vectorDrawable.getPixelSize();
                    if (state.mVectorDrawable != null) {
                        state.mVectorDrawable.setCallback(null);
                    }
                    state.mVectorDrawable = vectorDrawable;
                }
                a.recycle();
            } else if (TARGET.equals(tagName)) {
                final TypedArray a = obtainAttributes(res, theme, attrs, R.styleable.AnimatedVectorDrawableTarget);
                final String target = a.getString(R.styleable.AnimatedVectorDrawableTarget_name);
                final int animResId = a.getResourceId(R.styleable.AnimatedVectorDrawableTarget_animation, 0);
                if (animResId != 0) {
                    if (theme != null) {
                        // The animator here could be ObjectAnimator or AnimatorSet.
                        final Animator animator = AnimatorInflater.loadAnimator(res, theme, animResId, pathErrorScale);
                        updateAnimatorProperty(animator, target, state.mVectorDrawable, state.mShouldIgnoreInvalidAnim);
                        state.addTargetAnimator(target, animator);
                    } else {
                        // The animation may be theme-dependent. As a
                        // workaround until Animator has full support for
                        // applyTheme(), postpone loading the animator
                        // until we have a theme in applyTheme().
                        state.addPendingAnimator(animResId, pathErrorScale, target);
                    }
                }
                a.recycle();
            }
        }
        eventType = parser.next();
    }
    // If we don't have any pending animations, we don't need to hold a
    // reference to the resources.
    mRes = state.mPendingAnims == null ? null : res;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) TypedArray(android.content.res.TypedArray)

Aggregations

Animator (android.animation.Animator)1413 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)868 ObjectAnimator (android.animation.ObjectAnimator)724 ValueAnimator (android.animation.ValueAnimator)630 AnimatorSet (android.animation.AnimatorSet)285 View (android.view.View)230 ViewGroup (android.view.ViewGroup)110 ArrayList (java.util.ArrayList)104 PropertyValuesHolder (android.animation.PropertyValuesHolder)96 Paint (android.graphics.Paint)79 StackStateAnimator (com.android.systemui.statusbar.stack.StackStateAnimator)75 ImageView (android.widget.ImageView)68 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)67 AnimatorUpdateListener (android.animation.ValueAnimator.AnimatorUpdateListener)65 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)64 TextView (android.widget.TextView)61 RenderNodeAnimator (android.view.RenderNodeAnimator)51 ViewPropertyAnimator (android.view.ViewPropertyAnimator)51 Rect (android.graphics.Rect)50 Interpolator (android.view.animation.Interpolator)49