Example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

List of usage examples for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator

Introduction

In this page you can find the example usage for android.view.animation AccelerateDecelerateInterpolator AccelerateDecelerateInterpolator.

Prototype

public AccelerateDecelerateInterpolator() 

Source Link

Usage

From source file:cn.appsdream.nestrefresh.matetialstyle.WaveView.java

public void startDropAnimation() {
    // show dropBubble again
    mDisappearCircleAnimator = ValueAnimator.ofFloat(1.f, 1.f);
    mDisappearCircleAnimator.setDuration(1);
    mDisappearCircleAnimator.start();/*from w ww . j  a v  a 2  s. com*/

    mDropCircleAnimator = ValueAnimator.ofFloat(500 * (mWidth / 1440.f), mMaxDropHeight);
    mDropCircleAnimator.setDuration(DROP_CIRCLE_ANIMATOR_DURATION);
    mDropCircleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mCurrentCircleCenterY = (float) animation.getAnimatedValue();
            ViewCompat.postInvalidateOnAnimation(WaveView.this);
        }
    });
    mDropCircleAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mDropCircleAnimator.start();
    mDropVertexAnimator = ValueAnimator.ofFloat(MAX_WAVE_HEIGHT * mWidth, mMaxDropHeight - mDropCircleRadius);
    mDropVertexAnimator.setDuration(DROP_VERTEX_ANIMATION_DURATION);
    mDropVertexAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropVertexAnimator.start();

    mDropBounceVerticalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mDropBounceVerticalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
    mDropBounceVerticalAnimator.addUpdateListener(mAnimatorUpdateListener);
    mDropBounceVerticalAnimator.setInterpolator(new DropBounceInterpolator());
    mDropBounceVerticalAnimator.setStartDelay(DROP_VERTEX_ANIMATION_DURATION);
    mDropBounceVerticalAnimator.start();

    mDropBounceHorizontalAnimator = ValueAnimator.ofFloat(0.f, 1.f);
    mDropBounceHorizontalAnimator.setDuration(DROP_BOUNCE_ANIMATOR_DURATION);
    mDropBounceHorizontalAnimator.addUpdateListener(mAnimatorUpdateListener);
    if (mDropListener != null)
        mDropBounceHorizontalAnimator.addListener(mDropListener);
    mDropBounceHorizontalAnimator.setInterpolator(new DropBounceInterpolator());
    mDropBounceHorizontalAnimator
            .setStartDelay((long) (DROP_VERTEX_ANIMATION_DURATION + DROP_BOUNCE_ANIMATOR_DURATION * 0.25));
    mDropBounceHorizontalAnimator.start();
}

From source file:com.pitchedapps.primenumbercalculator.Calculator.java

License:asdf

private void onResult(final String result) {
    // Calculate the values needed to perform the scale and translation animations,
    // accounting for how the scale will affect the final position of the text.
    final float resultScale = mInputEditText.getVariableTextSize(result) / mResultEditText.getTextSize();
    final float resultTranslationX = (1.0f - resultScale)
            * (mResultEditText.getWidth() / 2.0f - mResultEditText.getPaddingEnd());
    final float resultTranslationY = (1.0f - resultScale) * //TODO delete unnecessary lines for animation
            (mResultEditText.getHeight() / 2.0f - mResultEditText.getPaddingBottom())
            + (mInputEditText.getBottom() - mResultEditText.getBottom())
            + (mResultEditText.getPaddingBottom() - mInputEditText.getPaddingBottom());
    final float inputTranslationY = -mInputEditText.getBottom();

    // Use a value animator to fade to the final text color over the course of the animation.
    final int resultTextColor = mResultEditText.getCurrentTextColor();
    final int inputEditText = mInputEditText.getCurrentTextColor();
    final ValueAnimator textColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), resultTextColor,
            inputEditText);//from  w w  w.  ja  v a  2 s .c  om
    textColorAnimator.addUpdateListener(new AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mResultEditText.setTextColor((int) valueAnimator.getAnimatedValue());
        }
    });

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(textColorAnimator,
            ObjectAnimator.ofFloat(mResultEditText, View.SCALE_X, resultScale),
            ObjectAnimator.ofFloat(mResultEditText, View.SCALE_Y, resultScale),
            ObjectAnimator.ofFloat(mResultEditText, View.TRANSLATION_X, resultTranslationX),
            ObjectAnimator.ofFloat(mResultEditText, View.TRANSLATION_Y, resultTranslationY),
            ObjectAnimator.ofFloat(mInputEditText, View.TRANSLATION_Y, inputTranslationY));
    animatorSet.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime));
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            mResultEditText.setText(result);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            // Reset all of the values modified during the animation.
            mResultEditText.setTextColor(resultTextColor);
            mResultEditText.setScaleX(1.0f);
            mResultEditText.setScaleY(1.0f);
            mResultEditText.setTranslationX(0.0f);
            mResultEditText.setTranslationY(0.0f);
            mInputEditText.setTranslationY(0.0f);

            // Finally update the input to use the current result.
            mInputEditText.setText(result); //TODO figure out how to reset after equal sign without changing input text
            mResultEditText.getEditableText().clear();
            setState(CalculatorState.RESULT);

            mCurrentAnimator = null;
        }

    });

    mCurrentAnimator = animatorSet;
    animatorSet.start();
}

From source file:com.guodong.sun.guodong.widget.ZoomImageView.java

private void startTransform(final int state) {
    if (mTransfrom == null) {
        return;//from  ww  w  . j  av a2s  .co m
    }
    ValueAnimator valueAnimator = new ValueAnimator();
    valueAnimator.setDuration(300);
    valueAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    if (state == STATE_TRANSFORM_IN) {
        PropertyValuesHolder scaleHolder = PropertyValuesHolder.ofFloat("scale", mTransfrom.startScale,
                mTransfrom.endScale);
        PropertyValuesHolder leftHolder = PropertyValuesHolder.ofFloat("left", mTransfrom.startRect.left,
                mTransfrom.endRect.left);
        PropertyValuesHolder topHolder = PropertyValuesHolder.ofFloat("top", mTransfrom.startRect.top,
                mTransfrom.endRect.top);
        PropertyValuesHolder widthHolder = PropertyValuesHolder.ofFloat("width", mTransfrom.startRect.width,
                mTransfrom.endRect.width);
        PropertyValuesHolder heightHolder = PropertyValuesHolder.ofFloat("height", mTransfrom.startRect.height,
                mTransfrom.endRect.height);
        PropertyValuesHolder alphaHolder = PropertyValuesHolder.ofInt("alpha", 0, 255);
        valueAnimator.setValues(scaleHolder, leftHolder, topHolder, widthHolder, heightHolder, alphaHolder);
    } else {
        PropertyValuesHolder scaleHolder = PropertyValuesHolder.ofFloat("scale", mTransfrom.endScale,
                mTransfrom.startScale);
        PropertyValuesHolder leftHolder = PropertyValuesHolder.ofFloat("left", mTransfrom.endRect.left,
                mTransfrom.startRect.left);
        PropertyValuesHolder topHolder = PropertyValuesHolder.ofFloat("top", mTransfrom.endRect.top,
                mTransfrom.startRect.top);
        PropertyValuesHolder widthHolder = PropertyValuesHolder.ofFloat("width", mTransfrom.endRect.width,
                mTransfrom.startRect.width);
        PropertyValuesHolder heightHolder = PropertyValuesHolder.ofFloat("height", mTransfrom.endRect.height,
                mTransfrom.startRect.height);
        PropertyValuesHolder alphaHolder = PropertyValuesHolder.ofInt("alpha", 255, 0);
        valueAnimator.setValues(scaleHolder, leftHolder, topHolder, widthHolder, heightHolder, alphaHolder);
    }

    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public synchronized void onAnimationUpdate(ValueAnimator animation) {
            mTransfrom.scale = (Float) animation.getAnimatedValue("scale");
            mTransfrom.rect.left = (Float) animation.getAnimatedValue("left");
            mTransfrom.rect.top = (Float) animation.getAnimatedValue("top");
            mTransfrom.rect.width = (Float) animation.getAnimatedValue("width");
            mTransfrom.rect.height = (Float) animation.getAnimatedValue("height");
            mBgAlpha = (Integer) animation.getAnimatedValue("alpha");
            invalidate();
            ((Activity) getContext()).getWindow().getDecorView().invalidate();
        }
    });
    valueAnimator.addListener(new ValueAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            /*
             * ???center_cropout??center_crop?
             *  ???out???Normal???bug
             */
            // TODO ???
            if (state == STATE_TRANSFORM_IN) {
                mState = STATE_NORMAL;
            }
            if (mTransformListener != null) {
                mTransformListener.onTransformComplete(state);
            }
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }
    });
    valueAnimator.start();
}

From source file:com.iride.ayride.HomePageActivity.java

private void animateMarkerTo(final Marker marker, final double lat, final double lng) {
    final Handler handler = new Handler();
    final long start = SystemClock.uptimeMillis();
    final long DURATION_MS = 1000;
    final Interpolator interpolator = new AccelerateDecelerateInterpolator();
    final LatLng startPosition = marker.getPosition();
    handler.post(new Runnable() {
        @Override/*from ww w .  ja  va2  s. c o m*/
        public void run() {
            float elapsed = SystemClock.uptimeMillis() - start;
            float t = elapsed / DURATION_MS;
            float v = interpolator.getInterpolation(t);

            double currentLat = (lat - startPosition.latitude) * v + startPosition.latitude;
            double currentLng = (lng - startPosition.longitude) * v + startPosition.longitude;
            marker.setPosition(new LatLng(currentLat, currentLng));

            // if animation is not finished yet, repeat
            if (t < 1) {
                handler.postDelayed(this, 16);
            }
        }
    });
}

From source file:com.android.calculator2.Calculator.java

private void reveal(View sourceView, int colorRes, AnimatorListener listener) {
    final ViewGroupOverlay groupOverlay = (ViewGroupOverlay) getWindow().getDecorView().getOverlay();

    final Rect displayRect = new Rect();
    mDisplayView.getGlobalVisibleRect(displayRect);

    // Make reveal cover the display and status bar.
    final View revealView = new View(this);
    revealView.setBottom(displayRect.bottom);
    revealView.setLeft(displayRect.left);
    revealView.setRight(displayRect.right);
    revealView.setBackgroundColor(getResources().getColor(colorRes));
    groupOverlay.add(revealView);/* w ww  .ja v a 2 s.c  om*/

    final int[] clearLocation = new int[2];
    sourceView.getLocationInWindow(clearLocation);
    clearLocation[0] += sourceView.getWidth() / 2;
    clearLocation[1] += sourceView.getHeight() / 2;

    final int revealCenterX = clearLocation[0] - revealView.getLeft();
    final int revealCenterY = clearLocation[1] - revealView.getTop();

    final double x1_2 = Math.pow(revealView.getLeft() - revealCenterX, 2);
    final double x2_2 = Math.pow(revealView.getRight() - revealCenterX, 2);
    final double y_2 = Math.pow(revealView.getTop() - revealCenterY, 2);
    final float revealRadius = (float) Math.max(Math.sqrt(x1_2 + y_2), Math.sqrt(x2_2 + y_2));

    final Animator revealAnimator = ViewAnimationUtils.createCircularReveal(revealView, revealCenterX,
            revealCenterY, 0.0f, revealRadius);
    revealAnimator.setDuration(getResources().getInteger(android.R.integer.config_longAnimTime));
    revealAnimator.addListener(listener);

    final Animator alphaAnimator = ObjectAnimator.ofFloat(revealView, View.ALPHA, 0.0f);
    alphaAnimator.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));

    final AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(revealAnimator).before(alphaAnimator);
    animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            groupOverlay.remove(revealView);
            mCurrentAnimator = null;
        }
    });

    mCurrentAnimator = animatorSet;
    animatorSet.start();
}

From source file:de.tum.in.tumcampus.auxiliary.calendar.DayView.java

public void setSelected(Time time, boolean ignoreTime, boolean animateToday) {
    mBaseDate.set(time);/* w  w  w  . j  av  a2s.  c  om*/
    setSelectedHour(mBaseDate.hour);
    setSelectedEvent(null);
    long millis = mBaseDate.toMillis(false /* use isDst */);
    setSelectedDay(Time.getJulianDay(millis, mBaseDate.gmtoff));
    mSelectedEvents.clear();
    mComputeSelectedEvents = true;

    int gotoY = Integer.MIN_VALUE;

    if (!ignoreTime && mGridAreaHeight != -1) {
        int lastHour = 0;

        if (mBaseDate.hour < mFirstHour) {
            // Above visible region
            gotoY = mBaseDate.hour * (mCellHeight + HOUR_GAP);
        } else {
            lastHour = (mGridAreaHeight - mFirstHourOffset) / (mCellHeight + HOUR_GAP) + mFirstHour;

            if (mBaseDate.hour >= lastHour) {
                // Below visible region

                // target hour + 1 (to give it room to see the event) -
                // grid height (to get the y of the top of the visible
                // region)
                gotoY = (int) ((mBaseDate.hour + 1 + mBaseDate.minute / 60.0f) * (mCellHeight + HOUR_GAP)
                        - mGridAreaHeight);
            }
        }

        if (gotoY > mMaxViewStartY) {
            gotoY = mMaxViewStartY;
        } else if (gotoY < 0 && gotoY != Integer.MIN_VALUE) {
            gotoY = 0;
        }
    }

    recalc();

    mRemeasure = true;
    invalidate();

    boolean delayAnimateToday = false;
    if (gotoY != Integer.MIN_VALUE) {
        ValueAnimator scrollAnim = ObjectAnimator.ofInt(this, "viewStartY", mViewStartY, gotoY);
        scrollAnim.setDuration(GOTO_SCROLL_DURATION);
        scrollAnim.setInterpolator(new AccelerateDecelerateInterpolator());
        scrollAnim.addListener(mAnimatorListener);
        scrollAnim.start();
        delayAnimateToday = true;
    }
    if (animateToday) {
        synchronized (mTodayAnimatorListener) {
            if (mTodayAnimator != null) {
                mTodayAnimator.removeAllListeners();
                mTodayAnimator.cancel();
            }
            mTodayAnimator = ObjectAnimator.ofInt(this, "animateTodayAlpha", mAnimateTodayAlpha, 255);
            mAnimateToday = true;
            mTodayAnimatorListener.setFadingIn(true);
            mTodayAnimatorListener.setAnimator(mTodayAnimator);
            mTodayAnimator.addListener(mTodayAnimatorListener);
            mTodayAnimator.setDuration(150);
            if (delayAnimateToday) {
                mTodayAnimator.setStartDelay(GOTO_SCROLL_DURATION);
            }
            mTodayAnimator.start();
        }
    }
}

From source file:com.jaus.albertogiunta.justintrain_oraritreni.journeyFavourites.FavouriteJourneysActivity.java

@Override
public boolean onItemClick(int position) {
    analyticsHelper.logScreenEvent(SCREEN_FAVOURITE_JOURNEYS, ACTION_NO_SWIPE_BUT_CLICK);
    Vibrator vibe = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    if (presenter.getRecyclerViewList().get(position) instanceof FavouriteJourneysItem) {
        boolean isFavourite = ((FavouriteJourneysItem) presenter.getRecyclerViewList().get(position))
                .isPreferredInsteadOfRecent();
        Log.d("onItemClick: ", position, presenter.getPreferredJourneys().size());
        vibe.vibrate(25);/*  w  ww .  jav  a 2  s  .  c o  m*/
        PreferredJourney preferredJourney = ((FavouriteJourneysItem) presenter.getRecyclerViewList()
                .get(position)).getPreferredJourney();

        AlertDialog.Builder alertDialog = new AlertDialog.Builder(FavouriteJourneysActivity.this);
        View view = LayoutInflater.from(FavouriteJourneysActivity.this)
                .inflate(R.layout.dialog_favourites_click, null);
        alertDialog.setView(view)
                .setPositiveButton("ANNULLA", (dialogInterface, i) -> dialogInterface.dismiss()).create();

        Dialog dialog = alertDialog.show();

        RelativeLayout rlSearchAR = view.findViewById(R.id.rl_search_ar);
        TextView searchAR = view.findViewById(R.id.tv_search_ar);
        RelativeLayout rlSearchRA = view.findViewById(R.id.rl_search_ra);
        TextView searchRA = view.findViewById(R.id.tv_search_ra);
        RelativeLayout rlRemoveFromList = view.findViewById(R.id.rl_remove_from_favourites);
        RelativeLayout rlTransformToFav = view.findViewById(R.id.rl_transform_into_favourites);

        searchAR.setText("Da " + preferredJourney.getStation1().getNameShort() + " a "
                + preferredJourney.getStation2().getNameShort());
        searchRA.setText("Da " + preferredJourney.getStation2().getNameShort() + " a "
                + preferredJourney.getStation1().getNameShort());
        if (!isFavourite)
            apply(rlTransformToFav, VISIBLE);
        else
            apply(rlTransformToFav, GONE);

        rlSearchAR.setOnClickListener(v -> {
            analyticsHelper.logScreenEvent(SCREEN_FAVOURITE_JOURNEYS, ACTION_AR_FROM_POPUP);
            Intent intent = new Intent(FavouriteJourneysActivity.this, JourneySearchActivity.class);
            intent.putExtra(I_STATIONS, gson.toJson(preferredJourney));
            startActivity(intent);
            dialog.dismiss();
        });

        rlSearchRA.setOnClickListener(v -> {
            analyticsHelper.logScreenEvent(SCREEN_FAVOURITE_JOURNEYS, ACTION_RA_FROM_POPUP);
            Intent intent = new Intent(FavouriteJourneysActivity.this, JourneySearchActivity.class);
            intent.putExtra(I_STATIONS, gson.toJson(preferredJourney.swapStations()));
            startActivity(intent);
            dialog.dismiss();
        });

        rlRemoveFromList.setOnClickListener(v -> {
            analyticsHelper.logScreenEvent(SCREEN_FAVOURITE_JOURNEYS, ACTION_REMOVE_FROM_POPUP);
            if (isFavourite) {
                presenter.removeFavourite(preferredJourney.getStation1(), preferredJourney.getStation2());
            } else {
                presenter.removeRecent(preferredJourney.getStation1(), preferredJourney.getStation2());
            }
            updateFavouritesList();
            btnSearch.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(0)
                    .setDuration(0);
            dialog.dismiss();
        });

        rlTransformToFav.setOnClickListener(v -> {
            presenter.removeRecent(preferredJourney.getStation1(), preferredJourney.getStation2());
            analyticsHelper.logScreenEvent(SCREEN_FAVOURITE_JOURNEYS, ACTION_TRANSFORM_TO_FAVS);
            presenter.addNewFavourite(preferredJourney.getStation1(), preferredJourney.getStation2());
            updateFavouritesList();
            btnSearch.animate().setInterpolator(new AccelerateDecelerateInterpolator()).translationY(0)
                    .setDuration(0);
            dialog.dismiss();
        });
    }
    return false;
}

From source file:org.numixproject.hermes.activity.ConversationActivity.java

private void hideConversationLayout() {
    // previously visible view

    // get the center for the clipping circle
    int cx = (conversationLayout.getLeft() + conversationLayout.getRight()) / 2;
    int cy = (conversationLayout.getTop() + conversationLayout.getBottom()) / 2;

    // get the initial radius for the clipping circle
    int initialRadius = conversationLayout.getWidth();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        // create the animation (the final radius is zero)
        Animator anim = ViewAnimationUtils.createCircularReveal(conversationLayout, cx, cy, initialRadius, 0);
        anim.setInterpolator(new AccelerateDecelerateInterpolator());

        // make the view invisible when the animation is done
        anim.addListener(new AnimatorListenerAdapter() {
            @Override//from  w ww  .j a v a 2 s.  co  m
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                conversationLayout.setVisibility(View.INVISIBLE);
            }
        });

        // start the animation
        anim.start();
    } else {
        conversationLayout.setAlpha(1.f);
        conversationLayout.setScaleX(1.f);
        conversationLayout.setScaleY(1.f);
        conversationLayout.animate().alpha(0.f).scaleX(0.f).scaleY(0.f).setDuration(300)
                .setInterpolator(new AccelerateDecelerateInterpolator()).start();
    }
    conversationLayout.setVisibility(View.INVISIBLE);
}

From source file:self.philbrown.droidQuery.$.java

/**
 * This reusable chunk of code can set up the given animation using the given animation options
 * @param options the options used to manipulate how the animation behaves
 * @return the container for placing views that will be animated using the given options
 *//*from   w ww.j a  v a  2s  . c o  m*/
private AnimatorSet animationWithOptions(final AnimationOptions options, List<Animator> animators) {
    AnimatorSet animation = new AnimatorSet();
    animation.playTogether(animators);
    animation.setDuration(options.duration());
    animation.addListener(new AnimatorListener() {

        @Override
        public void onAnimationCancel(Animator animation) {
            if (options.fail() != null)
                options.fail().invoke($.this);
            if (options.complete() != null)
                options.complete().invoke($.this);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            if (options.success() != null)
                options.success().invoke($.this);
            if (options.complete() != null)
                options.complete().invoke($.this);
        }

        @Override
        public void onAnimationRepeat(Animator animation) {
        }

        @Override
        public void onAnimationStart(Animator animation) {
        }

    });
    Interpolator interpolator = null;
    if (options.easing() == null)
        options.easing(Easing.LINEAR);
    final Easing easing = options.easing();
    switch (easing) {
    case ACCELERATE: {
        interpolator = new AccelerateInterpolator();
        break;
    }
    case ACCELERATE_DECELERATE: {
        interpolator = new AccelerateDecelerateInterpolator();
        break;
    }
    case ANTICIPATE: {
        interpolator = new AnticipateInterpolator();
        break;
    }
    case ANTICIPATE_OVERSHOOT: {
        interpolator = new AnticipateOvershootInterpolator();
        break;
    }
    case BOUNCE: {
        interpolator = new BounceInterpolator();
        break;
    }
    case DECELERATE: {
        interpolator = new DecelerateInterpolator();
        break;
    }
    case OVERSHOOT: {
        interpolator = new OvershootInterpolator();
        break;
    }
    //linear is default.
    case LINEAR:
    default:
        interpolator = new LinearInterpolator();
        break;
    }

    //allow custom interpolator
    if (options.specialEasing() != null)
        interpolator = options.specialEasing();

    animation.setInterpolator(interpolator);

    return animation;
}

From source file:com.saphion.stencilweather.activities.MainActivity.java

public void initiateActions(boolean animate) {

    // get the center for the clipping circle
    int cx = actionsContainer.getRight() - Utils.dpToPx(25, MainActivity.this);
    int cy = actionsContainer.getTop() + Utils.dpToPx(60, MainActivity.this);

    // get the final radius for the clipping circle
    float finalRadius = (float) Math.hypot(actionsContainer.getWidth(), actionsContainer.getHeight());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        android.animation.Animator animator = android.view.ViewAnimationUtils
                .createCircularReveal(actionsContainer, cx, cy, 0, finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(animate ? 300 : 1);

        android.animation.Animator animator_reverse = android.view.ViewAnimationUtils
                .createCircularReveal(actionsContainer, cx, cy, finalRadius, 0);
        animator_reverse.setInterpolator(new AccelerateDecelerateInterpolator());
        animator_reverse.setDuration(animate ? 300 : 1);

        if (hidden) {
            actionsContainer.setVisibility(View.VISIBLE);
            animator.start();//from w ww.  j av  a  2s  .  c  om
            bounceScaleAnimation(findViewById(R.id.containerFabShare), 80);
            bounceScaleAnimation(findViewById(R.id.containerFabMap), 120);
            bounceScaleAnimation(findViewById(R.id.containerFabGraph), 160);
            hidden = false;
        } else {
            animator_reverse.addListener(new android.animation.Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(android.animation.Animator animator) {

                }

                @Override
                public void onAnimationEnd(android.animation.Animator animator) {
                    actionsContainer.setVisibility(View.GONE);
                    hidden = true;
                }

                @Override
                public void onAnimationCancel(android.animation.Animator animator) {

                }

                @Override
                public void onAnimationRepeat(android.animation.Animator animator) {

                }
            });
            animator_reverse.start();
        }

    } else {

        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(actionsContainer, cx, cy, 0,
                finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(animate ? 300 : 1);

        SupportAnimator animator_reverse = animator.reverse();
        //            animator.start();
        //
        if (hidden) {
            actionsContainer.setVisibility(View.VISIBLE);
            animator.start();

            bounceScaleAnimation(findViewById(R.id.containerFabShare), 80);
            bounceScaleAnimation(findViewById(R.id.containerFabMap), 120);
            bounceScaleAnimation(findViewById(R.id.containerFabGraph), 160);

            hidden = false;
        } else {
            animator_reverse.addListener(new SupportAnimator.AnimatorListener() {

                @Override
                public void onAnimationStart() {

                }

                @Override
                public void onAnimationEnd() {
                    actionsContainer.setVisibility(View.GONE);
                    hidden = true;
                }

                @Override
                public void onAnimationCancel() {

                }

                @Override
                public void onAnimationRepeat() {

                }
            });
            animator_reverse.start();
        }
    }

}