Search in sources :

Example 76 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FloatingActionsMenu method createAddButton.

private void createAddButton(Context context) {
    mAddButton = new AddFloatingActionButton(context) {

        @Override
        void updateBackground() {
            mPlusColor = mAddButtonPlusColor;
            mColorNormal = mAddButtonColorNormal;
            mColorPressed = mAddButtonColorPressed;
            mStrokeVisible = mAddButtonStrokeVisible;
            super.updateBackground();
        }

        @Override
        Drawable getIconDrawable() {
            final RotatingDrawable rotatingDrawable = new RotatingDrawable(super.getIconDrawable());
            mRotatingDrawable = rotatingDrawable;
            final OvershootInterpolator interpolator = new OvershootInterpolator();
            final ObjectAnimator collapseAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", EXPANDED_PLUS_ROTATION, COLLAPSED_PLUS_ROTATION);
            final ObjectAnimator expandAnimator = ObjectAnimator.ofFloat(rotatingDrawable, "rotation", COLLAPSED_PLUS_ROTATION, EXPANDED_PLUS_ROTATION);
            collapseAnimator.setInterpolator(interpolator);
            expandAnimator.setInterpolator(interpolator);
            mExpandAnimation.play(expandAnimator);
            mCollapseAnimation.play(collapseAnimator);
            return rotatingDrawable;
        }
    };
    mAddButton.setId(R.id.fab_expand_menu_button);
    mAddButton.setSize(mAddButtonSize);
    mAddButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            toggle();
        }
    });
    addView(mAddButton, super.generateDefaultLayoutParams());
    mButtonsCount++;
}
Also used : OvershootInterpolator(android.view.animation.OvershootInterpolator) ObjectAnimator(android.animation.ObjectAnimator) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) TextView(android.widget.TextView) View(android.view.View)

Example 77 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project smartmodule by carozhu.

the class AnimationController method setEffect.

private void setEffect(Animation animation, int interpolatorType, long durationMillis, long delayMillis) {
    switch(interpolatorType) {
        case 0:
            animation.setInterpolator(new LinearInterpolator());
            break;
        case 1:
            animation.setInterpolator(new AccelerateInterpolator());
            break;
        case 2:
            animation.setInterpolator(new DecelerateInterpolator());
            break;
        case 3:
            animation.setInterpolator(new AccelerateDecelerateInterpolator());
            break;
        case 4:
            animation.setInterpolator(new BounceInterpolator());
            break;
        case 5:
            animation.setInterpolator(new OvershootInterpolator());
            break;
        case 6:
            animation.setInterpolator(new AnticipateInterpolator());
            break;
        case 7:
            animation.setInterpolator(new AnticipateOvershootInterpolator());
            break;
        default:
            break;
    }
    animation.setDuration(durationMillis);
    animation.setStartOffset(delayMillis);
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) BounceInterpolator(android.view.animation.BounceInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 78 with OvershootInterpolator

use of android.view.animation.OvershootInterpolator in project android_frameworks_base by crdroidandroid.

the class QSPanel method setAnimationTile.

private void setAnimationTile(TileRecord r) {
    ObjectAnimator animTile = null;
    int animStyle = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT);
    int animDuration = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_DURATION, 2000, UserHandle.USER_CURRENT);
    int interpolatorType = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.ANIM_TILE_INTERPOLATOR, 0, UserHandle.USER_CURRENT);
    if (animStyle == 0) {
    //No animation
    }
    if (animStyle == 1) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotationY", 0f, 360f);
    }
    if (animStyle == 2) {
        animTile = ObjectAnimator.ofFloat(r.tileView, "rotation", 0f, 360f);
    }
    if (animTile != null) {
        switch(interpolatorType) {
            case 0:
                animTile.setInterpolator(new LinearInterpolator());
                break;
            case 1:
                animTile.setInterpolator(new AccelerateInterpolator());
                break;
            case 2:
                animTile.setInterpolator(new DecelerateInterpolator());
                break;
            case 3:
                animTile.setInterpolator(new AccelerateDecelerateInterpolator());
                break;
            case 4:
                animTile.setInterpolator(new BounceInterpolator());
                break;
            case 5:
                animTile.setInterpolator(new OvershootInterpolator());
                break;
            case 6:
                animTile.setInterpolator(new AnticipateInterpolator());
                break;
            case 7:
                animTile.setInterpolator(new AnticipateOvershootInterpolator());
                break;
            default:
                break;
        }
        animTile.setDuration(animDuration);
        animTile.start();
    }
}
Also used : AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) DecelerateInterpolator(android.view.animation.DecelerateInterpolator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) OvershootInterpolator(android.view.animation.OvershootInterpolator) LinearInterpolator(android.view.animation.LinearInterpolator) ObjectAnimator(android.animation.ObjectAnimator) BounceInterpolator(android.view.animation.BounceInterpolator) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Aggregations

OvershootInterpolator (android.view.animation.OvershootInterpolator)78 ObjectAnimator (android.animation.ObjectAnimator)30 Animator (android.animation.Animator)21 AnimatorSet (android.animation.AnimatorSet)15 View (android.view.View)15 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)12 Handler (android.os.Handler)11 ValueAnimator (android.animation.ValueAnimator)10 LinearInterpolator (android.view.animation.LinearInterpolator)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)8 TextView (android.widget.TextView)7 Drawable (android.graphics.drawable.Drawable)6 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)6 PropertyValuesHolder (android.animation.PropertyValuesHolder)5 Rect (android.graphics.Rect)5 LayerDrawable (android.graphics.drawable.LayerDrawable)5 Interpolator (android.view.animation.Interpolator)5 Point (android.graphics.Point)4 Animation (android.view.animation.Animation)4