private void startEnterAnim() { ViewCompat.setTranslationY(progressLayout, progressLayout.getHeight()); final Rect bounds = new Rect(); revealRootView.getHitRect(bounds); SearchActivity.this.rootView.setLayerType(View.LAYER_TYPE_HARDWARE, null); revealAnimator = ViewAnimationUtils.createCircularReveal( revealRootView.getChildAt(0), bounds.right - bounds.left, 0, 0, Utils.pythagorean(bounds.width(), bounds.height())); revealAnimator.setDuration(Constants.MILLISECONDS_400); revealAnimator.setInterpolator(new AccelerateInterpolator()); revealAnimator.addListener( new SupportAnimator.SimpleAnimatorListener() { @Override public void onAnimationStart() { if (progressLayout != null) { ViewCompat.animate(progressLayout) .translationY(0.0f) .setDuration(Constants.MILLISECONDS_400) .withLayer(); } } @Override public void onAnimationEnd() { if (progressLayout != null) { SearchActivity.this.rootView.setLayerType(View.LAYER_TYPE_NONE, null); SearchActivity.this.loadData(); } } }); revealAnimator.start(); }
@Override protected void onDestroy() { super.onDestroy(); if (revealAnimator != null && revealAnimator.isRunning()) revealAnimator.cancel(); }