@Override public void show() { mAddToDoItemFAB.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start(); // mAddToDoItemFAB.animate().translationY(0).setInterpolator(new AccelerateInterpolator(2.0f)).start(); }
private void hideFAB() { mFAB.animate().scaleX(0f).scaleY(0f) .setInterpolator(new AccelerateInterpolator()) .start(); mFAB.setClickable(false); }
@Override public void hide() { CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mAddToDoItemFAB.getLayoutParams(); int fabMargin = lp.bottomMargin; mAddToDoItemFAB.animate().translationY(mAddToDoItemFAB.getHeight() + fabMargin).setInterpolator(new AccelerateInterpolator(2.0f)).start(); } };
private void startContentAnimation() { fabCreate.animate() .translationY(0) .setInterpolator(new OvershootInterpolator(1.f)) .setStartDelay(300) .setDuration(ANIM_DURATION_FAB) .start(); feedAdapter.updateItems(true); }
private void animateOverlayAndFinishService() { final int targetTranslationY = (int) (closeOverlayButton.getRootView().getHeight() - closeOverlayButton.getY()); closeOverlayButton.animate().setListener(null).cancel(); closeOverlayButton.animate() .setInterpolator(new AnticipateInterpolator()) .translationY(targetTranslationY) .setDuration(400) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationCancel(Animator animation) { end(); } @Override public void onAnimationEnd(Animator animation) { end(); } private void end() { windowManager.removeView(closeOverlayView); stopForeground(true); stopSelf(); } }).start(); }
private void showFAB() { mFAB.animate().scaleX(1f).scaleY(1f) .setInterpolator(new OvershootInterpolator()) .start(); mFAB.setClickable(true); }
if (fraction < 0.1 && misAppbarExpand) { misAppbarExpand = false; mActionButton.animate().scaleX(0).scaleY(0); mFlyView.animate().scaleX(0).scaleY(0); ValueAnimator animator = ValueAnimator.ofInt(mListView.getPaddingTop(), 0); mActionButton.animate().scaleX(1).scaleY(1); mFlyView.animate().scaleX(1).scaleY(1); ValueAnimator animator = ValueAnimator.ofInt(mListView.getPaddingTop(), DensityUtil.dp2px(25));
@Override public void onBackPressed() { if (mFragment != null) { FragmentManager manager = getFragmentManager(); FragmentTransaction trans = manager.beginTransaction(); trans.remove(mFragment); trans.commit(); manager.popBackStack(); mFragment = null; mRevealButton.animate() .scaleX(1f) .scaleY(1f) .setListener(null) .start(); } else { super.onBackPressed(); } }
@OnClick(R.id.text_animate) public void animate() { int padding = mFloatingActionButton.getPaddingBottom() + mFloatingActionButton.getPaddingTop(); int height = mLayoutRoot.getHeight() - padding; ActionBar actionBar = getSupportActionBar(); if (actionBar != null) height -= actionBar.getHeight(); if (!mIsButtonAtTop) height = -height; mIsButtonAtTop = !mIsButtonAtTop; mFloatingActionButton.animate().setInterpolator(getSelectedInterpolator()) .setDuration(500) .setStartDelay(200) .translationYBy(height) .setListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { mAnimateText.setEnabled(false); } @Override public void onAnimationEnd(Animator animation) { mAnimateText.setEnabled(true); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }) .start(); }
int fabEndX = mEditPanel.getLeft() + (mEditPanel.getWidth() / 2) - (mFab.getWidth() / 2); int fabEndY = mEditPanel.getTop() + (mEditPanel.getHeight() / 2) - (mFab.getHeight() / 2); mFab.animate().x(fabEndX).y(fabEndY).scaleX(0.0f).scaleY(0.0f) .setInterpolator(AnimationUtils.SLOW_FAST_SLOW_INTERPOLATOR) .setDuration(300L).setListener(new SimpleAnimatorListener() {
private void startFABAnimation() { mFabButton.animate() .translationY(0) .setInterpolator(new OvershootInterpolator(1.f)) .setStartDelay(500) .setDuration(ANIM_DURATION_FAB) .start(); }
@Override public void onAnimationEnd(Animator animation) { getFloatingToolbar().setVisibility(View.INVISIBLE); getFab().setVisibility(View.VISIBLE); // Ugly workaround for fab having wrong position for a few ms if (getFab().getTranslationY() < 0) { getFab().setAlpha(0f); getFab().animate().alpha(1).setDuration(2); } } });
@Override public void onAnimationEnd(Animator animation) { // Make sure the fab goes to the right place after the animation ends // when the Appbar is attached if (getAppBar() != null && getFab().getY() != getFab().getTop()) { getFab().setAlpha(0f); getFab().setY(getFab().getTop()); getFab().animate().alpha(1f) .setDuration(200) .setInterpolator(new AccelerateDecelerateInterpolator()).start(); } getAnimationListener().onAnimationFinished(); } });
@Override public void onShow() { btnRefresh.animate().translationY(0).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(200); } });
@Override public void onDependentViewRemoved(CoordinatorLayout parent, FloatingActionButton fab, View dependency) { super.onDependentViewRemoved(parent, fab, dependency); if (Util.SNACKBAR.equals(dependency.getTag()) && fabTranslationY != -1) { fab.animate().translationY(fabTranslationY).start(); } } }
@Override public void onHide() { int distanceToScroll = btnRefresh.getHeight() + DimenUtils.dip2px(PostsActivity.this, 16); btnRefresh.animate().translationY(distanceToScroll).setInterpolator(new AccelerateDecelerateInterpolator()).setDuration(200); }
@Override public void onTransitionEnd(Transition transition) { transition.removeListener(this); // liney_bottom.setTransitionGroup(true); fab.animate() .scaleY(1) .scaleX(1) .start(); }
private void animateIn(FloatingActionButton button) { button.setVisibility(View.VISIBLE); button.setScaleX(0); button.setScaleY(0); button.animate() .scaleX(1) .scaleY(1) .setInterpolator(new FastOutSlowInInterpolator()) .setListener(null) .start(); } }
private void closeMenu() { hideFab(infoFab); hideFab(saveFab); hideFab(applyFab); fab.animate().rotation(0.0f).withLayer().setDuration(300).setInterpolator(new OvershootInterpolator(10.0F)).start(); }
private void openMenu() { fab.animate().rotation(45.0f).withLayer().setDuration(300).setInterpolator(new OvershootInterpolator(10.0F)).start(); showFab(applyFab); showFab(saveFab); showFab(infoFab); }