public void hideFab() { if (fab != null) { // ObjectAnimator animatorTX = // ObjectAnimator.ofFloat(fab,"translationX",fab.getTranslationX(),200); //// ObjectAnimator animatorSX = ObjectAnimator.ofFloat(fab, "scaleX", 1, 0); //// ObjectAnimator animatorSY = ObjectAnimator.ofFloat(fab, "scaleY", 1,0); // ObjectAnimator animatorA = ObjectAnimator.ofFloat(fab,"alpha",1,0); // AnimatorSet animSet = new AnimatorSet(); // animSet.play(animatorA).with(animatorTX); // animSet.setDuration(500); // animSet.start(); fab.animate().scaleX(0.1f); fab.animate().scaleY(0.1f); fab.animate().translationX(200); } }
public void hideFab() { if (mFab.getVisibility() == View.VISIBLE) { mFab.animate() .scaleX(0.65f) .scaleY(0.65f) .setDuration(100) .setListener( new AnimationFinishedListener() { @Override public void onAnimationFinished() { mFab.setVisibility(View.GONE); } }); mFab.setImageDrawable( new AnimatingDrawable.Builder(getBaseContext()) .frames( R.drawable.fab_close_1, R.drawable.fab_close_2, R.drawable.fab_close_3, R.drawable.fab_close_4, R.drawable.fab_close_5) .build()); ((Animatable) mFab.getDrawable()).start(); } }
private void initLayout() { setContentView(R.layout.activity_debt); mFab = (FloatingActionButton) findViewById(R.id.fab); mFab.setVisibility(mSavedStateIsPlaying ? View.GONE : View.VISIBLE); mFab.setOnClickListener(this); mFab.animate().scaleX(1).scaleY(1).setInterpolator(mInterpolator).setStartDelay(400).start(); }
private void setAnimation(View view, final FrameLayout FrameLayout) { prepare(view, mFrameLayout); mFAB.animate() .scaleX(0) .scaleY(0) .setDuration(200) .setListener( new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) {} @Override public void onAnimationEnd(Animator animation) { FrameLayout.setVisibility(View.VISIBLE); circularAnimator.start(); } @Override public void onAnimationCancel(Animator animation) {} @Override public void onAnimationRepeat(Animator animation) {} }) .start(); }
private void startFABAnimation() { mFabButton .animate() .translationY(0) .setInterpolator(new OvershootInterpolator(1.f)) .setStartDelay(500) .setDuration(ANIM_DURATION_FAB) .start(); }
private void hideViews() { RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) searchButton.getLayoutParams(); int fabBottomMargin = lp.bottomMargin; searchButton .animate() .translationY(searchButton.getHeight() + fabBottomMargin) .setInterpolator(new AccelerateInterpolator(2)) .start(); }
private void closeFragment() { FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.remove(mFragment); ft.commit(); // fm.popBackStack(); mFragment = null; mFrameLayout.setVisibility(View.INVISIBLE); mFAB.animate().scaleX(1).scaleY(1).setListener(null).start(); }
@Override public void onPageScrollStateChanged(int state) { if (state == ViewPager.SCROLL_STATE_IDLE) { if (viewPager.getCurrentItem() == 1) { floatingActionButton .animate() .translationY(getResources().getDimensionPixelSize(R.dimen.bnc_button_height)) .setDuration(200) .start(); } else { floatingActionButton.animate().translationY(0).setDuration(200).start(); } } else { floatingActionButton .animate() .translationY(getResources().getDimensionPixelSize(R.dimen.bnc_button_height)) .setDuration(200) .start(); } }
public void showFab() { mFab.setVisibility(View.VISIBLE); mFab.setScaleX(0.65f); mFab.setScaleY(0.65f); mFab.animate().scaleX(1f).scaleY(1f).setDuration(100).setListener(null); mFab.setImageDrawable( new AnimatingDrawable.Builder(getBaseContext()) .frames( R.drawable.fab_open_1, R.drawable.fab_open_2, R.drawable.fab_open_3, R.drawable.fab_open_4, R.drawable.fab_open_5) .build()); ((Animatable) mFab.getDrawable()).start(); }
private void showViews() { searchButton.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start(); }