@Override public void onTransitionStart(Transition transition) { super.onTransitionStart(transition); // hide the fab as for some reason it jumps position?? TODO work out why mToolbar.animate() .alpha(0f) .setDuration(100) .setInterpolator(new AccelerateInterpolator()); if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) { mShot.setElevation(1f); mToolbar.setElevation(0f); } mNest.animate() .alpha(0f) .setDuration(50) .setInterpolator(new AccelerateInterpolator()); } };
@Override public void onTransitionStart(Transition transition) { super.onTransitionStart(transition); // hide the fab as for some reason it jumps position?? TODO work out why mToolbar.animate() .alpha(0f) .setDuration(100) .setInterpolator(new AccelerateInterpolator()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mShot.setElevation(1f); mToolbar.setElevation(0f); } mNest.animate() .alpha(0f) .setDuration(50) .setInterpolator(new AccelerateInterpolator()); } };
@Override public void onBackPressed() { fab.setVisibility(View.INVISIBLE); nestedScrollView.animate().alpha(0) .setInterpolator(new AccelerateInterpolator()) .translationY(TransitionUtils.dpToPixels(TransitionActivity.this, 72)) .start(); supportFinishAfterTransition(); } }
@Override public void onTransitionEnd(Transition transition) { fab.show(); nestedScrollView.setTranslationY( TransitionUtils.dpToPixels(TransitionActivity.this, 72)); nestedScrollView.animate().alpha(1f).translationY(0) .setInterpolator(new DecelerateInterpolator()); transition.removeListener(this); }
@Override public void onGlobalLayout() { if (nestedScrollView.getHeight() != 0) { appbar.setExpanded(true); appbar.addOnOffsetChangedListener(ToolbarActivity.this); nestedScrollView.getViewTreeObserver() .removeOnGlobalLayoutListener(this); nestedScrollView.animate().setStartDelay(400).alpha(1f); nestedScrollView.setTranslationY(nestedScrollView.getHeight() / 3); nestedScrollView.animate().setStartDelay(400).translationY(0) .setInterpolator(new AccelerateDecelerateInterpolator()); } } });