Search in sources :

Example 66 with AnimationSet

use of android.view.animation.AnimationSet in project ArcMenu by daCapricorn.

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)

Example 67 with AnimationSet

use of android.view.animation.AnimationSet in project ADWLauncher2 by boombuler.

the class DeleteZone method createAnimations.

private void createAnimations() {
    if (mInAnimation == null) {
        mInAnimation = new FastAnimationSet();
        final AnimationSet animationSet = mInAnimation;
        animationSet.setInterpolator(new AccelerateInterpolator());
        animationSet.addAnimation(new AlphaAnimation(0.0f, 1.0f));
        if (mOrientation == ORIENTATION_HORIZONTAL) {
            animationSet.addAnimation(new TranslateAnimation(Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f));
        } else {
            animationSet.addAnimation(new TranslateAnimation(Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f));
        }
        animationSet.setDuration(ANIMATION_DURATION);
    }
    if (mHandleInAnimation == null) {
        mHandleInAnimation = new AlphaAnimation(0.0f, 1.0f);
        mHandleInAnimation.setDuration(ANIMATION_DURATION);
    }
    if (mOutAnimation == null) {
        mOutAnimation = new FastAnimationSet();
        final AnimationSet animationSet = mOutAnimation;
        animationSet.setInterpolator(new AccelerateInterpolator());
        animationSet.addAnimation(new AlphaAnimation(1.0f, 0.0f));
        if (mOrientation == ORIENTATION_HORIZONTAL) {
            animationSet.addAnimation(new FastTranslateAnimation(Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f));
        } else {
            animationSet.addAnimation(new FastTranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 1.0f, Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f));
        }
        animationSet.setDuration(ANIMATION_DURATION);
    }
    if (mHandleOutAnimation == null) {
        mHandleOutAnimation = new AlphaAnimation(1.0f, 0.0f);
        mHandleOutAnimation.setFillAfter(true);
        mHandleOutAnimation.setDuration(ANIMATION_DURATION);
    }
}
Also used : AccelerateInterpolator(android.view.animation.AccelerateInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 68 with AnimationSet

use of android.view.animation.AnimationSet in project actor-platform by actorapp.

the class SearchFileFragment method showItems.

private void showItems(ArrayList<ExplorerItem> found) {
    items.clear();
    items.addAll(found);
    status.setVisibility(View.GONE);
    adapter.notifyDataSetChanged();
    if (!animated) {
        listView.setAlpha(0);
        listView.post(new Runnable() {

            @Override
            public void run() {
                listView.setAlpha(1);
                for (int i = 0; i < listView.getChildCount(); i++) {
                    View searchItemView = listView.getChildAt(i);
                    AnimationSet slideInAnimation = new AnimationSet(true);
                    slideInAnimation.setInterpolator(new MaterialInterpolator());
                    slideInAnimation.setDuration(200);
                    if (i != 0) {
                        slideInAnimation.setStartOffset(i * 50 + 25);
                    } else {
                        slideInAnimation.setStartOffset(75);
                    }
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1);
                    slideInAnimation.addAnimation(alphaAnimation);
                    TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 150, 0);
                    slideInAnimation.addAnimation(translateAnimation);
                    searchItemView.startAnimation(slideInAnimation);
                }
            }
        });
        animated = true;
    } else
        listView.setVisibility(View.VISIBLE);
}
Also used : MaterialInterpolator(im.actor.sdk.controllers.pickers.file.view.MaterialInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) SearchView(android.support.v7.widget.SearchView) View(android.view.View) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 69 with AnimationSet

use of android.view.animation.AnimationSet in project Signal-Android by WhisperSystems.

the class HidingLinearLayout method hide.

public void hide() {
    if (!isEnabled() || getVisibility() == GONE)
        return;
    AnimationSet animation = new AnimationSet(true);
    animation.addAnimation(new ScaleAnimation(1, 0, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f));
    animation.addAnimation(new AlphaAnimation(1, 0));
    animation.setDuration(100);
    animation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            setVisibility(GONE);
        }
    });
    animateWith(animation);
}
Also used : 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) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

Example 70 with AnimationSet

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

the class AppTransition method createScaleUpAnimationLocked.

private Animation createScaleUpAnimationLocked(int transit, boolean enter, int appWidth, int appHeight) {
    Animation a = null;
    if (enter) {
        // Entering app zooms out from the center of the initial rect.
        float scaleW = mNextAppTransitionStartWidth / (float) appWidth;
        float scaleH = mNextAppTransitionStartHeight / (float) appHeight;
        Animation scale = new ScaleAnimation(scaleW, 1, scaleH, 1, computePivot(mNextAppTransitionStartX, scaleW), computePivot(mNextAppTransitionStartY, scaleH));
        scale.setInterpolator(mDecelerateInterpolator);
        Animation alpha = new AlphaAnimation(0, 1);
        alpha.setInterpolator(mThumbnailFadeoutInterpolator);
        AnimationSet set = new AnimationSet(false);
        set.addAnimation(scale);
        set.addAnimation(alpha);
        set.setDetachWallpaper(true);
        a = set;
    } else if (transit == TRANSIT_WALLPAPER_INTRA_OPEN || transit == TRANSIT_WALLPAPER_INTRA_CLOSE) {
        // If we are on top of the wallpaper, we need an animation that
        // correctly handles the wallpaper staying static behind all of
        // the animated elements.  To do this, will just have the existing
        // element fade out.
        a = new AlphaAnimation(1, 0);
        a.setDetachWallpaper(true);
    } else {
        // For normal animations, the exiting element just holds in place.
        a = new AlphaAnimation(1, 1);
    }
    // Pick the desired duration.  If this is an inter-activity transition,
    // it  is the standard duration for that.  Otherwise we use the longer
    // task transition duration.
    final long duration;
    switch(transit) {
        case TRANSIT_ACTIVITY_OPEN:
        case TRANSIT_ACTIVITY_CLOSE:
            duration = mConfigShortAnimTime;
            break;
        default:
            duration = DEFAULT_APP_TRANSITION_DURATION;
            break;
    }
    a.setDuration(duration);
    a.setFillAfter(true);
    a.setInterpolator(mDecelerateInterpolator);
    a.initialize(appWidth, appHeight, appWidth, appHeight);
    return a;
}
Also used : ScaleAnimation(android.view.animation.ScaleAnimation) WindowAnimation_wallpaperIntraCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation) WindowAnimation_taskToBackExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation) WindowAnimation_wallpaperCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation) WindowAnimation_activityOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation) WindowAnimation_wallpaperOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation) WindowAnimation_activityCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation) WindowAnimation_taskToBackEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation) WindowAnimation_activityOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation) WindowAnimation_taskCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation) WindowAnimation_taskOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation) Animation(android.view.animation.Animation) WindowAnimation_wallpaperIntraCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation) WindowAnimation_taskOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation) WindowAnimation_wallpaperOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation) WindowAnimation_activityCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation) WindowAnimation_taskToFrontEnterAnimation(com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation) WindowAnimation_wallpaperIntraOpenEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation) WindowAnimation_taskCloseExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation) WindowAnimation_wallpaperIntraOpenExitAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) WindowAnimation_taskToFrontExitAnimation(com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation) WindowAnimation_wallpaperCloseEnterAnimation(com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation) ScaleAnimation(android.view.animation.ScaleAnimation)

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