private void runEnterAnim() { final Rect bounds = new Rect(); revealFrameLayout.getHitRect(bounds); ListActivity.this.revealFrameLayout.setLayerType(View.LAYER_TYPE_HARDWARE, null); SupportAnimator revealAnimator = ViewAnimationUtils.createCircularReveal( revealFrameLayout.getChildAt(0), 0, bounds.left, 0, Utils.pythagorean(bounds.width(), bounds.height())); revealAnimator.setDuration(Constants.MILLISECONDS_400); revealAnimator.setInterpolator(new AccelerateInterpolator()); revealAnimator.addListener( new SupportAnimator.SimpleAnimatorListener() { @Override public void onAnimationEnd() { ListActivity.this.revealFrameLayout.setLayerType(View.LAYER_TYPE_NONE, null); listPresenter.loadData(); } }); revealAnimator.start(); }
@Override protected void initView(Bundle savedInstanceState) { ListActivity.this.setSupportActionBar(toolbar); ListActivity.this.getSupportActionBar().setTitle(""); titleTv.setText(getResources().getString(R.string.bottom_bar_forecast)); ListActivity.this.setupAdapter(); if (savedInstanceState == null) { revealFrameLayout .getViewTreeObserver() .addOnPreDrawListener( new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { revealFrameLayout.getViewTreeObserver().removeOnPreDrawListener(this); ListActivity.this.runEnterAnim(); return true; } }); } else { List<MainEntity> entityList = (List<MainEntity>) savedInstanceState.getSerializable(Constants.CACHE); if (entityList != null) { this.cacheObservable = Observable.just(entityList).cache(); this.compositeSubscription.add( this.cacheObservable .compose(ListActivity.this.<List<MainEntity>>bindUntilEvent(ActivityEvent.DESTROY)) .subscribe(forecastAdapter)); } else { listPresenter.loadData(); } } }