Search in sources :

Example 21 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 22 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project Libraries-for-Android-Developers 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() {

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

Example 23 with DecelerateInterpolator

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

the class ActionBarContextView method makeOutAnimation.

private Animator makeOutAnimation() {
    ObjectAnimator buttonAnimator = ObjectAnimator.ofFloat(mClose, "translationX", -mClose.getWidth() - ((MarginLayoutParams) mClose.getLayoutParams()).leftMargin);
    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 = 0; i < 0; i++) {
                View child = mMenuView.getChildAt(i);
                child.setScaleY(0);
                ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0);
                a.setDuration(300);
                b.with(a);
            }
        }
    }
    return set;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) ActionMenuView(com.android.internal.view.menu.ActionMenuView) TextView(android.widget.TextView) View(android.view.View)

Example 24 with DecelerateInterpolator

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

the class VelocityTest method testDragDeceleration.

@MediumTest
public void testDragDeceleration() {
    long t = System.currentTimeMillis();
    VelocityTracker vt = VelocityTracker.obtain();
    drag(vt, 100, 200, 100, 200, 15, t, 400, new DecelerateInterpolator());
    vt.computeCurrentVelocity(1000);
    assertLower(250.0f, vt.getXVelocity());
    assertLower(250.0f, vt.getYVelocity());
    vt.recycle();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) VelocityTracker(android.view.VelocityTracker) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 25 with DecelerateInterpolator

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

the class HaloProperties method setHaloOverlay.

public void setHaloOverlay(Overlay overlay, float overlayAlpha) {
    Drawable d = null;
    switch(overlay) {
        case BLACK_X:
            d = mHaloBlackX;
            break;
        case BACK_LEFT:
            d = mHaloBackL;
            break;
        case BACK_RIGHT:
            d = mHaloBackR;
            break;
        case DISMISS:
            d = mHaloDismiss;
            break;
        case SILENCE_LEFT:
            d = mHaloSilenceL;
            break;
        case SILENCE_RIGHT:
            d = mHaloSilenceR;
            break;
        case CLEAR_ALL:
            d = mHaloClearAll;
            break;
        case MESSAGE:
            d = mHaloMessage;
            break;
    }
    if (d != mHaloCurrentOverlay) {
        mHaloOverlay.setImageDrawable(d);
        mHaloCurrentOverlay = d;
        // Fade out number batch
        if (overlay != Overlay.NONE) {
            msgNumberAlphaAnimator.animate(ObjectAnimator.ofFloat(mHaloNumberContainer, "alpha", 0f).setDuration(100), new DecelerateInterpolator(), null);
        }
    }
    mHaloOverlay.setAlpha(overlayAlpha);
    updateResources(mLastContentStateLeft);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Drawable(android.graphics.drawable.Drawable)

Aggregations

DecelerateInterpolator (android.view.animation.DecelerateInterpolator)305 ObjectAnimator (android.animation.ObjectAnimator)77 Animator (android.animation.Animator)65 ValueAnimator (android.animation.ValueAnimator)57 View (android.view.View)57 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)53 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)28 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