Search in sources :

Example 61 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project Libraries-for-Android-Developers by eoecn.

the class ActionBarContextView method makeInAnimation.

private Animator makeInAnimation() {
    mClose.setTranslationX(-mClose.getWidth() - ((MarginLayoutParams) mClose.getLayoutParams()).leftMargin);
    ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX", 0);
    buttonAnimator.setDuration(200);
    buttonAnimator.addListener(this);
    buttonAnimator.setInterpolator(new DecelerateInterpolator());
    AnimatorSet set = new AnimatorSet();
    AnimatorSet.Builder b = set.play(buttonAnimator);
    if (mMenuView != null) {
        final int count = mMenuView.getChildCount();
        if (count > 0) {
            for (int i = count - 1, j = 0; i >= 0; i--, j++) {
                AnimatorProxy child = AnimatorProxy.wrap(mMenuView.getChildAt(i));
                child.setScaleY(0);
                ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0, 1);
                a.setDuration(100);
                a.setStartDelay(j * 70);
                b.with(a);
            }
        }
    }
    return set;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator) AnimatorSet(com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet) AnimatorProxy(com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy)

Example 62 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project android-app by eoecn.

the class XListView method initWithContext.

private void initWithContext(Context context) {
    mScroller = new Scroller(context, new DecelerateInterpolator());
    // XListView need the scroll event, and it will dispatch the event to
    // user's listener (as a proxy).
    super.setOnScrollListener(this);
    // init header view
    mHeaderView = new XListViewHeader(context);
    mHeaderViewContent = (RelativeLayout) mHeaderView.findViewById(R.id.xlistview_header_content);
    mHeaderTimeView = (TextView) mHeaderView.findViewById(R.id.xlistview_header_time);
    addHeaderView(mHeaderView);
    // init footer view
    mFooterView = new XListViewFooter(context);
    // init header height
    mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            mHeaderViewHeight = mHeaderViewContent.getHeight();
            getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) OnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener) Scroller(android.widget.Scroller)

Example 63 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project ActivityAnimationLib by dkmeteor.

the class SplitEffect method animate.

public void animate(final Activity destActivity, final int duration) {
    final Interpolator interpolator = new DecelerateInterpolator();
    destActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
    new Handler().post(new Runnable() {

        @Override
        public void run() {
            mSetAnim = new AnimatorSet();
            mTopImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mBottomImage.setLayerType(View.LAYER_TYPE_HARDWARE, null);
            mSetAnim.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animation) {
                }

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

                @Override
                public void onAnimationCancel(Animator animation) {
                    clean(destActivity);
                }

                @Override
                public void onAnimationRepeat(Animator animation) {
                }
            });
            Animator anim1 = ObjectAnimator.ofFloat(mTopImage, "translationY", mTopImage.getHeight() * -1);
            Animator anim2 = ObjectAnimator.ofFloat(mBottomImage, "translationY", mBottomImage.getHeight());
            if (interpolator != null) {
                anim1.setInterpolator(interpolator);
                anim2.setInterpolator(interpolator);
            }
            mSetAnim.setDuration(duration);
            mSetAnim.playTogether(anim1, anim2);
            mSetAnim.start();
        }
    });
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) Handler(android.os.Handler) Interpolator(android.view.animation.Interpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimatorSet(android.animation.AnimatorSet)

Example 64 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project Meizhi by drakeet.

the class GankActivity method hideOrShowToolbar.

@Override
protected void hideOrShowToolbar() {
    View toolbar = findViewById(R.id.toolbar_with_indicator);
    assert toolbar != null;
    toolbar.animate().translationY(mIsHidden ? 0 : -mToolbar.getHeight()).setInterpolator(new DecelerateInterpolator(2)).start();
    mIsHidden = !mIsHidden;
    if (mIsHidden) {
        mViewPager.setTag(mViewPager.getPaddingTop());
        mViewPager.setPadding(0, 0, 0, 0);
    } else {
        mViewPager.setPadding(0, (int) mViewPager.getTag(), 0, 0);
        mViewPager.setTag(null);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) View(android.view.View)

Example 65 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project Launcher3 by chislon.

the class Workspace method animateBackgroundGradient.

private void animateBackgroundGradient(float finalAlpha, boolean animated) {
    if (mBackground == null)
        return;
    if (mBackgroundFadeInAnimation != null) {
        mBackgroundFadeInAnimation.cancel();
        mBackgroundFadeInAnimation = null;
    }
    if (mBackgroundFadeOutAnimation != null) {
        mBackgroundFadeOutAnimation.cancel();
        mBackgroundFadeOutAnimation = null;
    }
    float startAlpha = getBackgroundAlpha();
    if (finalAlpha != startAlpha) {
        if (animated) {
            mBackgroundFadeOutAnimation = LauncherAnimUtils.ofFloat(this, startAlpha, finalAlpha);
            mBackgroundFadeOutAnimation.addUpdateListener(new AnimatorUpdateListener() {

                public void onAnimationUpdate(ValueAnimator animation) {
                    setBackgroundAlpha(((Float) animation.getAnimatedValue()).floatValue());
                }
            });
            mBackgroundFadeOutAnimation.setInterpolator(new DecelerateInterpolator(1.5f));
            mBackgroundFadeOutAnimation.setDuration(BACKGROUND_FADE_OUT_DURATION);
            mBackgroundFadeOutAnimation.start();
        } else {
            setBackgroundAlpha(finalAlpha);
        }
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AnimatorUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener) ValueAnimator(android.animation.ValueAnimator)

Aggregations

DecelerateInterpolator (android.view.animation.DecelerateInterpolator)312 ObjectAnimator (android.animation.ObjectAnimator)80 Animator (android.animation.Animator)66 ValueAnimator (android.animation.ValueAnimator)59 View (android.view.View)58 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)55 AnimatorSet (android.animation.AnimatorSet)52 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)36 ImageView (android.widget.ImageView)32 AlphaAnimation (android.view.animation.AlphaAnimation)30 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)29 Animation (android.view.animation.Animation)21 TextView (android.widget.TextView)20 Point (android.graphics.Point)18 ValueAnimator (com.nineoldandroids.animation.ValueAnimator)18 Paint (android.graphics.Paint)14 LinearInterpolator (android.view.animation.LinearInterpolator)14 ScaleAnimation (android.view.animation.ScaleAnimation)14 AnimatorSet (com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet)14 ObjectAnimator (com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator)14