Search in sources :

Example 56 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project FlyRefresh by race604.

the class SampleItemAnimator method animateAddImpl.

@Override
protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
    View target = holder.itemView;
    View icon = target.findViewById(R.id.icon);
    Animator swing = ObjectAnimator.ofFloat(icon, "rotationX", 45, 0);
    swing.setInterpolator(new OvershootInterpolator(5));
    View right = holder.itemView.findViewById(R.id.right);
    Animator rotateIn = ObjectAnimator.ofFloat(right, "rotationY", 90, 0);
    rotateIn.setInterpolator(new DecelerateInterpolator());
    AnimatorSet animator = new AnimatorSet();
    animator.setDuration(getAddDuration());
    animator.playTogether(swing, rotateIn);
    animator.start();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) BaseItemAnimator(jp.wasabeef.recyclerview.animators.BaseItemAnimator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimatorSet(android.animation.AnimatorSet) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 57 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project material by rey5137.

the class TimePicker method applyStyle.

protected void applyStyle(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TimePicker, defStyleAttr, defStyleRes);
    boolean hourDefined = false;
    String familyName = null;
    int style = -1;
    for (int i = 0, count = a.getIndexCount(); i < count; i++) {
        int attr = a.getIndex(i);
        if (attr == R.styleable.TimePicker_tp_backgroundColor)
            mBackgroundColor = a.getColor(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_selectionColor)
            mSelectionColor = a.getColor(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_selectionRadius)
            mSelectionRadius = a.getDimensionPixelOffset(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_tickSize)
            mTickSize = a.getDimensionPixelOffset(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_textSize)
            mTextSize = a.getDimensionPixelOffset(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_textColor)
            mTextColor = a.getColor(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_textHighlightColor)
            mTextHighlightColor = a.getColor(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_animDuration)
            mAnimDuration = a.getInteger(attr, 0);
        else if (attr == R.styleable.TimePicker_tp_inInterpolator)
            mInInterpolator = AnimationUtils.loadInterpolator(context, a.getResourceId(attr, 0));
        else if (attr == R.styleable.TimePicker_tp_outInterpolator)
            mOutInterpolator = AnimationUtils.loadInterpolator(context, a.getResourceId(attr, 0));
        else if (attr == R.styleable.TimePicker_tp_mode)
            setMode(a.getInteger(attr, 0), false);
        else if (attr == R.styleable.TimePicker_tp_24Hour) {
            set24Hour(a.getBoolean(attr, false));
            hourDefined = true;
        } else if (attr == R.styleable.TimePicker_tp_hour)
            setHour(a.getInteger(attr, 0));
        else if (attr == R.styleable.TimePicker_tp_minute)
            setMinute(a.getInteger(attr, 0));
        else if (attr == R.styleable.TimePicker_tp_fontFamily)
            familyName = a.getString(attr);
        else if (attr == R.styleable.TimePicker_tp_textStyle)
            style = a.getInteger(attr, 0);
    }
    a.recycle();
    if (mSelectionRadius < 0)
        mSecondInnerRadius = ThemeUtil.dpToPx(context, 8);
    if (mTickSize < 0)
        mTickSize = ThemeUtil.dpToPx(context, 1);
    if (mTextSize < 0)
        mTextSize = context.getResources().getDimensionPixelOffset(R.dimen.abc_text_size_caption_material);
    if (mAnimDuration < 0)
        mAnimDuration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
    if (mInInterpolator == null)
        mInInterpolator = new DecelerateInterpolator();
    if (mOutInterpolator == null)
        mOutInterpolator = new DecelerateInterpolator();
    if (!hourDefined)
        set24Hour(DateFormat.is24HourFormat(context));
    if (familyName != null || style >= 0)
        mTypeface = TypefaceUtil.load(context, familyName, style);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) TypedArray(android.content.res.TypedArray) Paint(android.graphics.Paint)

Example 58 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project ToggleDrawable by renaudcerrato.

the class MainActivity method toggle.

private void toggle() {
    isFaded = !isFaded;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        AnimatorSet set = new AnimatorSet();
        ObjectAnimator backgroundAnim = ObjectAnimator.ofInt(mContainer.getBackground(), "alpha", isFaded ? 128 : 0);
        ObjectAnimator drawableAnim = ObjectAnimator.ofInt(mSeekBar, "progress", isFaded ? mSeekBar.getMax() : 0);
        set.setDuration(700);
        set.setInterpolator(new DecelerateInterpolator(3f));
        set.playTogether(backgroundAnim, drawableAnim);
        set.start();
    } else {
        Animation set = new ToggleAnimationSet(isFaded);
        set.setDuration(700);
        set.setInterpolator(new DecelerateInterpolator(3f));
        mContainer.startAnimation(set);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ObjectAnimator(android.animation.ObjectAnimator) Animation(android.view.animation.Animation) AnimatorSet(android.animation.AnimatorSet)

Example 59 with DecelerateInterpolator

use of android.view.animation.DecelerateInterpolator in project mobile-android by photo.

the class Workspace method initWorkspace.

/**
	 * Inits the workspace.
	 * 
	 * @param context
	 *           the context
	 * @param attrs
	 *           the attrs
	 * @param defStyle
	 *           the def style
	 */
private void initWorkspace(Context context, AttributeSet attrs, int defStyle) {
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Workspace, defStyle, 0);
    mDefaultScreen = a.getInt(R.styleable.Workspace_defaultScreen, 0);
    a.recycle();
    setHapticFeedbackEnabled(false);
    mScrollInterpolator = new DecelerateInterpolator(1.0f);
    mScroller = new Scroller(context, mScrollInterpolator);
    // mCurrentScreen = mDefaultScreen;
    mPreviousScreen = INVALID_SCREEN;
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mPaddingTop = getPaddingTop();
    mPaddingBottom = getPaddingBottom();
    mPaddingLeft = getPaddingLeft();
    mPaddingRight = getPaddingRight();
    int overscrollMode = a.getInt(R.styleable.Workspace_overscroll, 0);
    setOverScroll(overscrollMode);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ViewConfiguration(android.view.ViewConfiguration) TypedArray(android.content.res.TypedArray) Scroller(android.widget.Scroller)

Example 60 with DecelerateInterpolator

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

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++) {
                AnimatorProxy child = AnimatorProxy.wrap(mMenuView.getChildAt(i));
                child.setScaleY(0);
                ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0);
                a.setDuration(100);
                a.setStartDelay(i * 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)

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