Search in sources :

Example 91 with AnimationSet

use of android.view.animation.AnimationSet in project android_frameworks_base by DirtyUnicorns.

the class WindowStateAnimator method applyFadeoutDuringKeyguardExitAnimation.

private void applyFadeoutDuringKeyguardExitAnimation() {
    long startTime = mAnimation.getStartTime();
    long duration = mAnimation.getDuration();
    long elapsed = mLastAnimationTime - startTime;
    long fadeDuration = duration - elapsed;
    if (fadeDuration <= 0) {
        // Never mind, this would be no visible animation, so abort the animation change.
        return;
    }
    AnimationSet newAnimation = new AnimationSet(false);
    newAnimation.setDuration(duration);
    newAnimation.setStartTime(startTime);
    newAnimation.addAnimation(mAnimation);
    Animation fadeOut = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.app_starting_exit);
    fadeOut.setDuration(fadeDuration);
    fadeOut.setStartOffset(elapsed);
    newAnimation.addAnimation(fadeOut);
    newAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), mAnimDx, mAnimDy);
    mAnimation = newAnimation;
}
Also used : AppWindowAnimator.sDummyAnimation(com.android.server.wm.AppWindowAnimator.sDummyAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet)

Example 92 with AnimationSet

use of android.view.animation.AnimationSet in project simple-tool-tip by xizzhu.

the class ToolTipView method remove.

/**
     * Removes the tool tip view from the view hierarchy.
     */
@UiThread
public void remove() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        container.setPivotX(pivotX);
        container.setPivotY(pivotY);
        container.animate().setDuration(ANIMATION_DURATION).alpha(0.0F).scaleX(0.0F).scaleY(0.0F).setListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                popupWindow.dismiss();
            }
        });
    } else {
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(ANIMATION_DURATION);
        animationSet.addAnimation(new AlphaAnimation(1.0F, 0.0F));
        animationSet.addAnimation(new ScaleAnimation(1.0F, 0.0F, 1.0F, 0.0F, pivotX, pivotY));
        animationSet.setAnimationListener(new Animation.AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
            // do nothing
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                popupWindow.dismiss();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            // do nothing
            }
        });
        container.startAnimation(animationSet);
    }
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) UiThread(android.support.annotation.UiThread)

Example 93 with AnimationSet

use of android.view.animation.AnimationSet in project PhotoNoter by yydcdut.

the class PGEditView method showBottomSecondMenuWithAnimation.

public void showBottomSecondMenuWithAnimation() {
    mSecondMenusLayout.setVisibility(View.VISIBLE);
    if (Build.VERSION.SDK_INT >= 11) {
        float secondBottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_second_bottom_height);
        TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, secondBottomHeight, 0f);
        translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        translateAnimation.setDuration(ANIMATION_TIME);
        mSecondMenusLayout.startAnimation(translateAnimation);
        float bottomHeight = mActivity.getResources().getDimension(R.dimen.pg_sdk_edit_bottom_height);
        TranslateAnimation firstTranslateAnimation = new TranslateAnimation(0f, 0f, 0f, bottomHeight);
        firstTranslateAnimation.setDuration(ANIMATION_TIME);
        firstTranslateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        AlphaAnimation firstAlphaAnimation = new AlphaAnimation(1f, 0f);
        firstAlphaAnimation.setDuration(ANIMATION_TIME);
        firstAlphaAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.addAnimation(firstTranslateAnimation);
        animationSet.addAnimation(firstAlphaAnimation);
        animationSet.setAnimationListener(new AnimationAdapter() {

            @Override
            public void onAnimationEnd(Animation animation) {
                mActivity.runOnUiThread(new Runnable() {

                    @Override
                    public void run() {
                        mFirstHorizontalLayout.setVisibility(View.INVISIBLE);
                    }
                });
            }
        });
        mFirstHorizontalLayout.startAnimation(animationSet);
    } else {
        mFirstHorizontalLayout.setVisibility(View.INVISIBLE);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) AnimationAdapter(us.pinguo.edit.sdk.base.widget.AnimationAdapter)

Example 94 with AnimationSet

use of android.view.animation.AnimationSet in project PhotoNoter by yydcdut.

the class PGEditMenuItemView method deleteViewWithAnimation.

private void deleteViewWithAnimation(final View v) {
    final ViewGroup parent = (ViewGroup) getParent();
    final int index = parent.indexOfChild(this);
    final int moveDis = getLayoutParams().width;
    float deleteViewMoveWidth = 0.25f * getLayoutParams().width;
    float deleteViewMoveHeight = 0.25f * getLayoutParams().height;
    ScaleAnimation scaleAnimation = new ScaleAnimation(1f, 0.5f, 1f, 0.5f);
    scaleAnimation.setDuration(200l);
    TranslateAnimation translateAnimation = new TranslateAnimation(0f, deleteViewMoveWidth, 0f, deleteViewMoveHeight);
    translateAnimation.setDuration(200l);
    AnimationSet animationSet = new AnimationSet(true);
    animationSet.addAnimation(scaleAnimation);
    animationSet.addAnimation(translateAnimation);
    animationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            parent.post(new Runnable() {

                @Override
                public void run() {
                    PGEditMenuItemView.this.setVisibility(View.INVISIBLE);
                }
            });
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    this.startAnimation(animationSet);
    if (index == parent.getChildCount() - 1) {
        parent.post(new Runnable() {

            @Override
            public void run() {
                parent.removeView(PGEditMenuItemView.this);
                if (null != mOnDeleteViewClick) {
                    mOnDeleteViewClick.onClick(v);
                }
            }
        });
        return;
    }
    for (int i = index + 1; i < parent.getChildCount(); i++) {
        final View childView = parent.getChildAt(i);
        childView.clearAnimation();
        TranslateAnimation leftTranslateAnimation = new TranslateAnimation(0f, -moveDis, 0f, 0f);
        leftTranslateAnimation.setDuration(300l);
        if (i == index + 1) {
            leftTranslateAnimation.setAnimationListener(new Animation.AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    parent.post(new Runnable() {

                        @Override
                        public void run() {
                            parent.removeView(PGEditMenuItemView.this);
                            if (null != mOnDeleteViewClick) {
                                mOnDeleteViewClick.onClick(v);
                            }
                            ((PGEditMenuItemView) childView).startRotateAnimation();
                        }
                    });
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
        } else {
            leftTranslateAnimation.setAnimationListener(new Animation.AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    parent.post(new Runnable() {

                        @Override
                        public void run() {
                            ((PGEditMenuItemView) childView).startRotateAnimation();
                        }
                    });
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
        }
        childView.startAnimation(leftTranslateAnimation);
    }
}
Also used : ViewGroup(android.view.ViewGroup) TranslateAnimation(android.view.animation.TranslateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet) IMenuItemView(us.pinguo.edit.sdk.base.view.IMenuItemView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 95 with AnimationSet

use of android.view.animation.AnimationSet in project UltimateAndroid by cymcsg.

the class RayLayout method createShrinkAnimation.

private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);
    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);
    animationSet.addAnimation(rotateAnimation);
    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet)

Aggregations

AnimationSet (android.view.animation.AnimationSet)118 AlphaAnimation (android.view.animation.AlphaAnimation)86 TranslateAnimation (android.view.animation.TranslateAnimation)75 Animation (android.view.animation.Animation)71 ScaleAnimation (android.view.animation.ScaleAnimation)69 ClipRectAnimation (android.view.animation.ClipRectAnimation)32 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)32 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)30 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)30 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)30 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)30 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)30 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)30 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)30 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)30 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)30 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)30 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)30 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)30 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)30