Search in sources :

Example 11 with AnticipateOvershootInterpolator

use of android.view.animation.AnticipateOvershootInterpolator in project android_frameworks_base by ResurrectionRemix.

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)

Example 12 with AnticipateOvershootInterpolator

use of android.view.animation.AnticipateOvershootInterpolator in project android_frameworks_base by DirtyUnicorns.

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)

Example 13 with AnticipateOvershootInterpolator

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

the class DessertCaseView method place.

public synchronized void place(View v, Point pt, boolean animate) {
    final int i = pt.x;
    final int j = pt.y;
    final float rnd = frand();
    if (v.getTag(TAG_POS) != null) {
        for (final Point oc : getOccupied(v)) {
            mFreeList.add(oc);
            mCells[oc.y * mColumns + oc.x] = null;
        }
    }
    int scale = 1;
    if (rnd < PROB_4X) {
        if (!(i >= mColumns - 3 || j >= mRows - 3)) {
            scale = 4;
        }
    } else if (rnd < PROB_3X) {
        if (!(i >= mColumns - 2 || j >= mRows - 2)) {
            scale = 3;
        }
    } else if (rnd < PROB_2X) {
        if (!(i == mColumns - 1 || j == mRows - 1)) {
            scale = 2;
        }
    }
    v.setTag(TAG_POS, pt);
    v.setTag(TAG_SPAN, scale);
    tmpSet.clear();
    final Point[] occupied = getOccupied(v);
    for (final Point oc : occupied) {
        final View squatter = mCells[oc.y * mColumns + oc.x];
        if (squatter != null) {
            tmpSet.add(squatter);
        }
    }
    for (final View squatter : tmpSet) {
        for (final Point sq : getOccupied(squatter)) {
            mFreeList.add(sq);
            mCells[sq.y * mColumns + sq.x] = null;
        }
        if (squatter != v) {
            squatter.setTag(TAG_POS, null);
            if (animate) {
                squatter.animate().withLayer().scaleX(0.5f).scaleY(0.5f).alpha(0).setDuration(DURATION).setInterpolator(new AccelerateInterpolator()).setListener(new Animator.AnimatorListener() {

                    public void onAnimationStart(Animator animator) {
                    }

                    public void onAnimationEnd(Animator animator) {
                        removeView(squatter);
                    }

                    public void onAnimationCancel(Animator animator) {
                    }

                    public void onAnimationRepeat(Animator animator) {
                    }
                }).start();
            } else {
                removeView(squatter);
            }
        }
    }
    for (final Point oc : occupied) {
        mCells[oc.y * mColumns + oc.x] = v;
        mFreeList.remove(oc);
    }
    final float rot = (float) irand(0, 4) * 90f;
    if (animate) {
        v.bringToFront();
        AnimatorSet set1 = new AnimatorSet();
        set1.playTogether(ObjectAnimator.ofFloat(v, View.SCALE_X, (float) scale), ObjectAnimator.ofFloat(v, View.SCALE_Y, (float) scale));
        set1.setInterpolator(new AnticipateOvershootInterpolator());
        set1.setDuration(DURATION);
        AnimatorSet set2 = new AnimatorSet();
        set2.playTogether(ObjectAnimator.ofFloat(v, View.ROTATION, rot), ObjectAnimator.ofFloat(v, View.X, i * mCellSize + (scale - 1) * mCellSize / 2), ObjectAnimator.ofFloat(v, View.Y, j * mCellSize + (scale - 1) * mCellSize / 2));
        set2.setInterpolator(new DecelerateInterpolator());
        set2.setDuration(DURATION);
        set1.addListener(makeHardwareLayerListener(v));
        set1.start();
        set2.start();
    } else {
        v.setX(i * mCellSize + (scale - 1) * mCellSize / 2);
        v.setY(j * mCellSize + (scale - 1) * mCellSize / 2);
        v.setScaleX((float) scale);
        v.setScaleY((float) scale);
        v.setRotation(rot);
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) AccelerateInterpolator(android.view.animation.AccelerateInterpolator) AnimatorSet(android.animation.AnimatorSet) Point(android.graphics.Point) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator) ImageView(android.widget.ImageView) View(android.view.View) Point(android.graphics.Point) Paint(android.graphics.Paint)

Example 14 with AnticipateOvershootInterpolator

use of android.view.animation.AnticipateOvershootInterpolator 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)

Example 15 with AnticipateOvershootInterpolator

use of android.view.animation.AnticipateOvershootInterpolator in project RxTools by vondear.

the class RxAnimationTool method popout.

public static ObjectAnimator popout(final View view, final long duration, final AnimatorListenerAdapter animatorListenerAdapter) {
    ObjectAnimator popout = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat("alpha", 1f, 0f), PropertyValuesHolder.ofFloat("scaleX", 1f, 0f), PropertyValuesHolder.ofFloat("scaleY", 1f, 0f));
    popout.setDuration(duration);
    popout.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.GONE);
            if (animatorListenerAdapter != null) {
                animatorListenerAdapter.onAnimationEnd(animation);
            }
        }
    });
    popout.setInterpolator(new AnticipateOvershootInterpolator());
    return popout;
}
Also used : ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) ObjectAnimator(android.animation.ObjectAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnticipateOvershootInterpolator(android.view.animation.AnticipateOvershootInterpolator)

Aggregations

AnticipateOvershootInterpolator (android.view.animation.AnticipateOvershootInterpolator)16 ObjectAnimator (android.animation.ObjectAnimator)10 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)10 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)10 View (android.view.View)8 Animator (android.animation.Animator)7 ImageView (android.widget.ImageView)7 AnimatorSet (android.animation.AnimatorSet)5 Paint (android.graphics.Paint)5 Point (android.graphics.Point)5 ValueAnimator (android.animation.ValueAnimator)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 AnticipateInterpolator (android.view.animation.AnticipateInterpolator)4 BounceInterpolator (android.view.animation.BounceInterpolator)4 LinearInterpolator (android.view.animation.LinearInterpolator)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 ActivityNotFoundException (android.content.ActivityNotFoundException)1 Intent (android.content.Intent)1 Typeface (android.graphics.Typeface)1