Example usage for android.view ViewAnimationUtils createCircularReveal

List of usage examples for android.view ViewAnimationUtils createCircularReveal

Introduction

In this page you can find the example usage for android.view ViewAnimationUtils createCircularReveal.

Prototype

public static Animator createCircularReveal(View view, int centerX, int centerY, float startRadius,
        float endRadius) 

Source Link

Document

Returns an Animator which can animate a clipping circle.

Usage

From source file:com.google.samples.apps.topeka.view.quiz.QuizActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void prepareCircularReveal(View startView, FrameLayout targetView, int themeAccentColor) {
    int centerX = (startView.getLeft() + startView.getRight()) / 2;
    // Subtract the start view's height to adjust for relative coordinates on screen.
    int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight();
    float endRadius = (float) Math.hypot(centerX, centerY);
    mCircularReveal = ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY,
            startView.getWidth(), endRadius);
    mCircularReveal.setInterpolator(new FastOutLinearInInterpolator());

    mCircularReveal.addListener(new AnimatorListenerAdapter() {
        @Override//w w w .  j a  v  a  2  s.c o  m
        public void onAnimationEnd(Animator animation) {
            mIcon.setVisibility(View.GONE);
            mCircularReveal.removeListener(this);
        }
    });
    // Adding a color animation from the FAB's color to transparent creates a dissolve like
    // effect to the circular reveal.
    mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, themeAccentColor,
            Color.TRANSPARENT);
    mColorChange.setEvaluator(new ArgbEvaluator());
    mColorChange.setInterpolator(mInterpolator);
}

From source file:com.andremion.floatingnavigationview.FloatingNavigationView.java

private void startCloseAnimations() {

    // Icon//from   ww  w . j  a  va2s .  com
    AnimatedVectorDrawable closeIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(),
            R.drawable.ic_close_animated);
    mFabView.setImageDrawable(closeIcon);
    closeIcon.start();

    // Unreveal
    int centerX = mFabRect.centerX();
    int centerY = mFabRect.centerY();
    float startRadius = getMaxRadius();
    float endRadius = getMinRadius();
    Animator reveal = ViewAnimationUtils.createCircularReveal(mNavigationView, centerX, centerY, startRadius,
            endRadius);
    reveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            detachNavigationView();
        }
    });

    // Fade out
    Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 1, 0);

    // Animations
    AnimatorSet set = new AnimatorSet();
    set.playTogether(fade, reveal);
    set.start();
}

From source file:com.adkdevelopment.earthquakesurvival.utils.Utilities.java

/**
 * Animates RecyclerView card on click with revealing effect
 * @param viewHolder to make animation on
 *//*  w ww . j  a va  2  s  .  c o  m*/
public static void animationCard(RecyclerView.ViewHolder viewHolder) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        if (mBlueColor == 0) {
            mBlueColor = ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.colorPrimary);
        }
        if (mWhiteColor == 0) {
            mWhiteColor = ContextCompat.getColor(viewHolder.itemView.getContext(), R.color.white);
        }

        int finalRadius = (int) Math.hypot(viewHolder.itemView.getWidth() / 2,
                viewHolder.itemView.getHeight() / 2);

        Animator anim = ViewAnimationUtils.createCircularReveal(viewHolder.itemView,
                viewHolder.itemView.getWidth() / 2, viewHolder.itemView.getHeight() / 2, 0, finalRadius);

        viewHolder.itemView.setBackgroundColor(mBlueColor);
        anim.start();
        anim.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {
                viewHolder.itemView.setBackgroundColor(mWhiteColor);
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });
    }
}

From source file:com.github.huajianjiang.expandablerecyclerview.sample.anim.CircularRevealItemAnimator.java

void animateAddImpl(final RecyclerView.ViewHolder holder) {
    Logger.e(TAG, "<<<animateAddImpl>>" + holder);
    final View view = holder.itemView;
    //        final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    mAddAnimations.add(holder);/*from  w  w w.  j  a  v  a2 s  .  com*/
    // get the center for the clipping circle
    int cx = (view.getLeft() + view.getRight()) / 2;
    int cy = view.getHeight() / 2;

    Logger.e(TAG, "cx=" + cx + ",cy=" + cy);

    // get the final radius for the clipping circle
    int finalRadius = Math.max(view.getWidth(), view.getHeight());

    Logger.e(TAG, "width=" + view.getWidth() + ",height=" + view.getHeight() + ",finalRadius=" + finalRadius);

    // create the animator for this view (the start radius is zero)
    final Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
    anim.setDuration(getAddDuration());
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            dispatchAddStarting(holder);
        }

        @Override
        public void onAnimationCancel(Animator animation) {
            view.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            anim.removeListener(this);
            dispatchAddFinished(holder);
            mAddAnimations.remove(holder);
            dispatchFinishedWhenDone();
        }
    });
    // make the view visible and start the animation
    view.setVisibility(View.VISIBLE);
    anim.start();
    //        animation.alpha(1).setDuration(getAddDuration()).
    //                setListener(new CircularRevealItemAnimator.VpaListenerAdapter() {
    //                    @Override
    //                    public void onAnimationStart(View view) {
    //                        dispatchAddStarting(holder);
    //                    }
    //                    @Override
    //                    public void onAnimationCancel(View view) {
    //                        ViewCompat.setAlpha(view, 1);
    //                    }
    //
    //                    @Override
    //                    public void onAnimationEnd(View view) {
    //                        animation.setListener(null);
    //                        dispatchAddFinished(holder);
    //                        mAddAnimations.remove(holder);
    //                        dispatchFinishedWhenDone();
    //                    }
    //                }).start();
}

From source file:babbq.com.searchplace.SearchActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search);
    ButterKnife.bind(this);
    setupSearchView();/*from  w  w w  . j  a v a 2 s. c  o  m*/
    auto = TransitionInflater.from(this).inflateTransition(R.transition.auto);

    mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API)
            .addApi(Places.GEO_DATA_API).addConnectionCallbacks(this).addOnConnectionFailedListener(this)
            .build();

    mAdapter = new TestAdapter(null, v -> {
        int position = results.getChildLayoutPosition(v);
        //Toast.makeText(getActivity(), "#" + position, Toast.LENGTH_SHORT).show();
        PendingResult result = Places.GeoDataApi.getPlaceById(mGoogleApiClient,
                String.valueOf(mAdapter.getElementAt(position).placeId));
        result.setResultCallback(mCoordinatePlaceDetailsCallback);
    }, mGoogleApiClient);

    dataManager = new SearchDataManager(mGoogleApiClient, mCoordinatePlaceDetailsCallback) {

        @Override
        public void onDataLoaded(List<? extends PlaceAutocomplete> data) {
            if (data != null && data.size() > 0) {
                if (results.getVisibility() != View.VISIBLE) {
                    TransitionManager.beginDelayedTransition(container, auto);
                    progress.setVisibility(View.GONE);
                    results.setVisibility(View.VISIBLE);
                    //                        fab.setVisibility(View.VISIBLE);
                    fab.setAlpha(0.6f);
                    fab.setScaleX(0f);
                    fab.setScaleY(0f);
                    fab.animate().alpha(1f).scaleX(1f).scaleY(1f).setStartDelay(800L).setDuration(300L)
                            .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                                    android.R.interpolator.linear_out_slow_in));
                }
                //                    mAdapter.addAndResort(data);
                mAdapter.setList(data);
            } else {
                TransitionManager.beginDelayedTransition(container, auto);
                progress.setVisibility(View.GONE);
                setNoResultsVisibility(View.VISIBLE);
            }
        }
    };
    //        mAdapter = new FeedAdapter(this, dataManager, columns);
    results.setAdapter(mAdapter);
    GridLayoutManager layoutManager = new GridLayoutManager(this, columns);
    //        layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
    //
    //            @Override
    //            public int getSpanSize(int position) {
    //                return mAdapter.getItemColumnSpan(position);
    //            }
    //        });
    results.setLayoutManager(layoutManager);
    results.addOnScrollListener(new InfiniteScrollListener(layoutManager, dataManager) {

        @Override
        public void onLoadMore() {
            dataManager.loadMore();
        }
    });
    results.setHasFixedSize(true);
    results.addOnScrollListener(gridScroll);

    // extract the search icon's location passed from the launching activity, minus 4dp to
    // compensate for different paddings in the views
    searchBackDistanceX = getIntent().getIntExtra(EXTRA_MENU_LEFT, 0) - (int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics());
    searchIconCenterX = getIntent().getIntExtra(EXTRA_MENU_CENTER_X, 0);

    // translate icon to match the launching screen then animate back into position
    searchBackContainer.setTranslationX(searchBackDistanceX);
    searchBackContainer.animate().translationX(0f).setDuration(650L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in));
    // transform from search icon to back icon
    AnimatedVectorDrawable searchToBack = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,
            R.drawable.avd_search_to_back);
    searchBack.setImageDrawable(searchToBack);
    searchToBack.start();
    // for some reason the animation doesn't always finish (leaving a part arrow!?) so after
    // the animation set a static drawable. Also animation callbacks weren't added until API23
    // so using post delayed :(
    // TODO fix properly!!
    searchBack.postDelayed(new Runnable() {

        @Override
        public void run() {
            searchBack.setImageDrawable(
                    ContextCompat.getDrawable(SearchActivity.this, R.drawable.ic_arrow_back_padded));
        }
    }, 600);

    // fade in the other search chrome
    searchBackground.animate().alpha(1f).setDuration(300L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
    searchView.animate().alpha(1f).setStartDelay(400L).setDuration(400L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in))
            .setListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    searchView.requestFocus();
                    ImeUtils.showIme(searchView);
                }
            });

    // animate in a scrim over the content behind
    scrim.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

        @Override
        public boolean onPreDraw() {
            scrim.getViewTreeObserver().removeOnPreDrawListener(this);
            AnimatorSet showScrim = new AnimatorSet();
            showScrim.playTogether(
                    ViewAnimationUtils.createCircularReveal(scrim, searchIconCenterX,
                            searchBackground.getBottom(), 0,
                            (float) Math.hypot(searchBackDistanceX,
                                    scrim.getHeight() - searchBackground.getBottom())),
                    ObjectAnimator.ofArgb(scrim, ViewUtils.BACKGROUND_COLOR, Color.TRANSPARENT,
                            ContextCompat.getColor(SearchActivity.this, R.color.scrim)));
            showScrim.setDuration(400L);
            showScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.linear_out_slow_in));
            showScrim.start();
            return false;
        }
    });
    onNewIntent(getIntent());
}

From source file:de.janniskilian.xkcdreader.presentation.components.showcomics.ShowComicsActivity.java

@Override
public void startSearchMode(boolean animate) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (animate) {
            final View actionMenuView = toolbar.getChildAt(1);
            final ViewGroup actionMenuViewGroup = (ViewGroup) actionMenuView;
            final View addButton = actionMenuViewGroup.getChildAt(0);

            searchButtonCenter = new Point(
                    (int) (addButton.getX() + actionMenuView.getX() + addButton.getWidth() / 2),
                    (int) (addButton.getY() + actionMenuView.getY() + addButton.getHeight() / 2));

            final Animator animator = ViewAnimationUtils.createCircularReveal(searchToolbar,
                    searchButtonCenter.x, searchButtonCenter.y, 0, searchToolbar.getWidth());
            animator.setDuration(revealStatusBarDuration);
            animator.addListener(new StartSearchModeAnimationListener(toolbar));
            searchToolbar.setVisibility(View.VISIBLE);
            animator.start();/*from   ww  w .  jav a  2 s .  c om*/
        } else {
            searchToolbar.setVisibility(View.VISIBLE);
        }

        setSupportActionBar(searchToolbar);

        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setHomeButtonEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeAsUpIndicator(tintedBackArrow);
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayShowCustomEnabled(true);
            actionBar.setCustomView(R.layout.toolbar_search);
        }
    } else {
        toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.background));

        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setHomeButtonEnabled(true);
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setHomeAsUpIndicator(tintedBackArrow);
            actionBar.setDisplayShowTitleEnabled(false);
            actionBar.setDisplayShowCustomEnabled(true);
            actionBar.setCustomView(R.layout.toolbar_search);
        }

        invalidateOptionsMenu();
    }

    searchInput = (EditText) findViewById(R.id.search_input);
    searchInput.requestFocus();
    searchInputSub = RxTextView.textChangeEvents(searchInput)
            .debounce(searchInputDebounceDuration, TimeUnit.MILLISECONDS)
            .observeOn(AndroidSchedulers.mainThread()).subscribe(textViewTextChangeEvent -> {
                presenter.onSearchInputChanged(textViewTextChangeEvent.text().toString());
            });
    searchInputLengthSub = RxTextView.textChangeEvents(searchInput).observeOn(AndroidSchedulers.mainThread())
            .subscribe(textViewTextChangeEvent -> {
                presenter.onSearchInputLengthChanged(textViewTextChangeEvent.text().toString(),
                        textViewTextChangeEvent.count());
            });
    searchInput.setOnEditorActionListener((textView, actionId, keyEvent) -> {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            Utils.hideKeyboard(ShowComicsActivity.this);
            return true;
        }
        return false;
    });

    Utils.showKeyboard(this);

    searchResults.setVisibility(View.VISIBLE);
    if (animate) {
        searchResults.animate().alpha(1).setDuration(crossfadeViewPagerSearchDuration).setListener(null);

        viewPager.animate().alpha(0).setDuration(crossfadeViewPagerSearchDuration)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        viewPager.setVisibility(View.GONE);
                    }
                });
    } else {
        searchResults.setAlpha(1);
        viewPager.setAlpha(0);
        viewPager.setVisibility(View.GONE);
    }
}

From source file:net.nurik.roman.formwatchface.CompanionWatchFaceConfigActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateUIToSelectedTheme(final String themeId, final boolean animate) {
    for (final ThemeUiHolder holder : mThemeUiHolders) {
        boolean selected = holder.theme.id.equals(themeId);

        holder.button.setSelected(selected);

        if (holder.selected != selected && selected) {
            if (mCurrentRevealAnimator != null) {
                mCurrentRevealAnimator.end();
                updatePreviewView(mAnimatingTheme, mMainClockContainerView, mMainClockView);
            }//from  w w  w. jav a 2s  . co  m

            if (animate && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                mAnimatingTheme = holder.theme;
                updatePreviewView(mAnimatingTheme, mAnimateClockContainerView, mAnimateClockView);

                Rect buttonRect = new Rect();
                Rect clockContainerRect = new Rect();
                holder.button.getGlobalVisibleRect(buttonRect);
                mMainClockContainerView.getGlobalVisibleRect(clockContainerRect);

                int cx = buttonRect.centerX() - clockContainerRect.left;
                int cy = buttonRect.centerY() - clockContainerRect.top;
                clockContainerRect.offsetTo(0, 0);

                mCurrentRevealAnimator = ViewAnimationUtils.createCircularReveal(mAnimateClockContainerView, cx,
                        cy, 0, MathUtil.maxDistanceToCorner(clockContainerRect, cx, cy));
                mAnimateClockContainerView.setVisibility(View.VISIBLE);
                mCurrentRevealAnimator.setDuration(300);
                mCurrentRevealAnimator.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        if (mCurrentRevealAnimator == animation) {
                            mAnimateClockContainerView.setVisibility(View.INVISIBLE);
                            updatePreviewView(holder.theme, mMainClockContainerView, mMainClockView);
                        }
                    }
                });

                mAnimateClockView.postInvalidateOnAnimation();
                mCurrentRevealAnimator.start();
            } else {
                updatePreviewView(holder.theme, mMainClockContainerView, mMainClockView);
            }
        }

        holder.selected = selected;
    }
}

From source file:com.commit451.springy.CompanionWatchFaceConfigActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void updateUIToSelectedTheme(final String themeId, final boolean animate) {
    for (final ThemeUiHolder holder : mThemeUiHolders) {
        boolean selected = holder.theme.id.equals(themeId);

        holder.button.setSelected(selected);

        if (holder.selected != selected && selected) {
            if (mCurrentRevealAnimator != null) {
                mCurrentRevealAnimator.end();
                updatePreviewView(mAnimatingTheme, mMainClockContainerView);
            }//from ww  w  .  j  a  va2  s.  c  o m

            if (animate && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                mAnimatingTheme = holder.theme;
                updatePreviewView(mAnimatingTheme, mAnimateClockContainerView);

                Rect buttonRect = new Rect();
                Rect clockContainerRect = new Rect();
                holder.button.getGlobalVisibleRect(buttonRect);
                mMainClockContainerView.getGlobalVisibleRect(clockContainerRect);

                int cx = buttonRect.centerX() - clockContainerRect.left;
                int cy = buttonRect.centerY() - clockContainerRect.top;
                clockContainerRect.offsetTo(0, 0);

                mCurrentRevealAnimator = ViewAnimationUtils.createCircularReveal(mAnimateClockContainerView, cx,
                        cy, 0, MathUtil.maxDistanceToCorner(clockContainerRect, cx, cy));
                mAnimateClockContainerView.setVisibility(View.VISIBLE);
                mCurrentRevealAnimator.setDuration(300);
                mCurrentRevealAnimator.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        if (mCurrentRevealAnimator == animation) {
                            mAnimateClockContainerView.setVisibility(View.INVISIBLE);
                            updatePreviewView(holder.theme, mMainClockContainerView);
                        }
                    }
                });

                mAnimateClockView.postInvalidateOnAnimation();
                mCurrentRevealAnimator.start();
            } else {
                updatePreviewView(holder.theme, mMainClockContainerView);
            }
        }

        holder.selected = selected;
    }
}

From source file:io.plaidapp.ui.SearchActivity.java

@OnClick({ R.id.scrim, R.id.searchback })
protected void dismiss() {
    // translate the icon to match position in the launching activity
    searchBackContainer.animate().translationX(searchBackDistanceX).setDuration(600L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in))
            .setListener(new AnimatorListenerAdapter() {
                @Override/* w  ww  . java  2s.co  m*/
                public void onAnimationEnd(Animator animation) {
                    finishAfterTransition();
                }
            }).start();
    // transform from back icon to search icon
    AnimatedVectorDrawable backToSearch = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,
            R.drawable.avd_back_to_search);
    searchBack.setImageDrawable(backToSearch);
    // clear the background else the touch ripple moves with the translation which looks bad
    searchBack.setBackground(null);
    backToSearch.start();
    // fade out the other search chrome
    searchView.animate().alpha(0f).setStartDelay(0L).setDuration(120L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
            .setListener(null).start();
    searchBackground.animate().alpha(0f).setStartDelay(300L).setDuration(160L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
            .setListener(null).start();

    // if we're showing search results, circular hide them
    if (resultsContainer.getHeight() > 0) {
        Animator closeResults = ViewAnimationUtils.createCircularReveal(resultsContainer, searchIconCenterX, 0,
                (float) Math.hypot(searchIconCenterX, resultsContainer.getHeight()), 0f);
        closeResults.setDuration(500L);
        closeResults.setInterpolator(
                AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
        closeResults.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                resultsContainer.setVisibility(View.INVISIBLE);
            }
        });
        closeResults.start();
    }

    // fade out the scrim
    scrim.animate().alpha(0f).setDuration(400L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
            .setListener(null).start();
}

From source file:com.hannesdorfmann.search.SearchActivity.java

@OnClick({ R.id.scrim, R.id.searchback })
  protected void dismiss() {
      // translate the icon to match position in the launching activity
      searchBackContainer.animate().translationX(searchBackDistanceX).setDuration(600L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in))
              .setListener(new AnimatorListenerAdapter() {
                  @Override/*from  w w  w.  j  av  a  2  s. com*/
                  public void onAnimationEnd(Animator animation) {
                      finishAfterTransition();
                  }
              }).start();
      // transform from back icon to search icon
      AnimatedVectorDrawable backToSearch = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,
              R.drawable.avd_back_to_search);
      searchBack.setImageDrawable(backToSearch);
      // clear the background else the touch ripple moves with the translation which looks bad
      searchBack.setBackground(null);
      backToSearch.start();
      // fade out the other search chrome
      searchView.animate().alpha(0f).setStartDelay(0L).setDuration(120L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
              .setListener(null).start();
      searchBackground.animate().alpha(0f).setStartDelay(300L).setDuration(160L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
              .setListener(null).start();
      if (searchToolbar.getZ() != 0f) {
          searchToolbar.animate().z(0f).setDuration(600L)
                  .setInterpolator(
                          AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
                  .start();
      }

      // if we're showing search results, circular hide them
      if (resultsContainer.getHeight() > 0) {
          Animator closeResults = ViewAnimationUtils.createCircularReveal(resultsContainer, searchIconCenterX, 0,
                  (float) Math.hypot(searchIconCenterX, resultsContainer.getHeight()), 0f);
          closeResults.setDuration(500L);
          closeResults.setInterpolator(
                  AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
          closeResults.addListener(new AnimatorListenerAdapter() {
              @Override
              public void onAnimationEnd(Animator animation) {
                  resultsContainer.setVisibility(View.INVISIBLE);
              }
          });
          closeResults.start();
      }

      // fade out the scrim
      scrim.animate().alpha(0f).setDuration(400L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
              .setListener(null).start();
  }