private void startAnimation(final boolean isEnterAnimation) {
        float from = isEnterAnimation ? 0f : 1f;
        float to = isEnterAnimation ? 1f : 0f;
        long duration = isEnterAnimation ? ENTER_ANIMATION_DURATION_MS : EXIT_ANIMATION_DURATION_MS;
        mContentView.setScaleX(from);
        mContentView.setScaleY(from);

        mContentView.animate()
                .scaleX(to)
                .scaleY(to)
                .setDuration(duration)
                .setInterpolator(new LinearOutSlowInInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        if (!isEnterAnimation) {
                            BrowserActionsFallbackMenuDialog.super.dismiss();
                        }
                    }
                })
                .start();
    }
The dialog class showing the context menu and ensures proper animation is played upon calling
{@link #show()} and {@link #dismiss()}.
customtabs/src/android/support/customtabs/browseractions/BrowserActionsFallbackMenuDialog.java