Search in sources :

Example 86 with ScaleAnimation

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

the class DragState method createCancelAnimationLocked.

private Animation createCancelAnimationLocked() {
    final AnimationSet set = new AnimationSet(false);
    set.addAnimation(new ScaleAnimation(1, 0, 1, 0, mThumbOffsetX, mThumbOffsetY));
    set.addAnimation(new AlphaAnimation(mOriginalAlpha, 0));
    set.setDuration(ANIMATION_DURATION_MS);
    set.setInterpolator(mCubicEaseOutInterpolator);
    set.initialize(0, 0, 0, 0);
    // Will start on the first call to getTransformation.
    set.start();
    return set;
}
Also used : AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 87 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project QLibrary by DragonsQC.

the class AnimationUtils method getAmplificationAnimation.

/**
     * 获取一个放大动画
     *
     * @param durationMillis    时间
     * @param animationListener 监听
     * @return 返回一个放大的效果
     */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation)

Example 88 with ScaleAnimation

use of android.view.animation.ScaleAnimation 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 89 with ScaleAnimation

use of android.view.animation.ScaleAnimation in project WordPress-Android by wordpress-mobile.

the class StatsUIHelper method hideChildViews.

private static void hideChildViews(View groupView, int groupPosition, boolean animate) {
    final ViewGroup childContainer = (ViewGroup) groupView.findViewById(R.id.layout_child_container);
    if (childContainer == null) {
        return;
    }
    if (childContainer.getVisibility() != View.GONE) {
        if (animate) {
            Animation expand = new ScaleAnimation(1.0f, 1.0f, 1.0f, 0.0f);
            expand.setDuration(ANIM_DURATION);
            expand.setInterpolator(getInterpolator());
            expand.setAnimationListener(new Animation.AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    childContainer.setVisibility(View.GONE);
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
            childContainer.startAnimation(expand);
        } else {
            childContainer.setVisibility(View.GONE);
        }
    }
    StatsUIHelper.setGroupChevron(false, groupView, groupPosition, animate);
}
Also used : ViewGroup(android.view.ViewGroup) ScaleAnimation(android.view.animation.ScaleAnimation) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 90 with ScaleAnimation

use of android.view.animation.ScaleAnimation 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)

Aggregations

ScaleAnimation (android.view.animation.ScaleAnimation)114 AnimationSet (android.view.animation.AnimationSet)60 AlphaAnimation (android.view.animation.AlphaAnimation)56 Animation (android.view.animation.Animation)50 TranslateAnimation (android.view.animation.TranslateAnimation)40 ClipRectAnimation (android.view.animation.ClipRectAnimation)28 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)28 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)26 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)26 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)26 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)26 WindowAnimation_taskCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation)26 WindowAnimation_taskCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation)26 WindowAnimation_taskOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation)26 WindowAnimation_taskOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation)26 WindowAnimation_taskToBackEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation)26 WindowAnimation_taskToBackExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation)26 WindowAnimation_taskToFrontEnterAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation)26 WindowAnimation_taskToFrontExitAnimation (com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation)26 WindowAnimation_wallpaperCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation)26