private float getClosingRadius() { final int buttonRadius = closeOverlayButton.getWidth() / 2; // 20% wider than the button itself return buttonRadius * 1.2f; }
private int distanceFromCloseButton(MotionEvent popupMotionEvent) { final int closeOverlayButtonX = closeOverlayButton.getLeft() + closeOverlayButton.getWidth() / 2; final int closeOverlayButtonY = closeOverlayButton.getTop() + closeOverlayButton.getHeight() / 2; float fingerX = popupLayoutParams.x + popupMotionEvent.getX(); float fingerY = popupLayoutParams.y + popupMotionEvent.getY(); return (int) Math.sqrt(Math.pow(closeOverlayButtonX - fingerX, 2) + Math.pow(closeOverlayButtonY - fingerY, 2)); }
@OnClick(R.id.btnCreate) public void onTakePhotoClick() { int[] startingLocation = new int[2]; fabCreate.getLocationOnScreen(startingLocation); startingLocation[0] += fabCreate.getWidth() / 2; TakePhotoActivity.startCameraFromLocation(startingLocation, this); overridePendingTransition(0, 0); }
public void animateRevealShow() { Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth()/2,0, fab.getWidth() / 2, cvAdd.getHeight()); mAnimator.setDuration(500); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } @Override public void onAnimationStart(Animator animation) { cvAdd.setVisibility(View.VISIBLE); super.onAnimationStart(animation); } }); mAnimator.start(); }
public void animateRevealClose() { Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd,cvAdd.getWidth()/2,0, cvAdd.getHeight(), fab.getWidth() / 2); mAnimator.setDuration(500); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { cvAdd.setVisibility(View.INVISIBLE); super.onAnimationEnd(animation); fab.setImageResource(R.drawable.plus); AActivityTwo.super.onBackPressed(); } @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); } }); mAnimator.start(); } @Override
mFab.setScaleX(1.0f); mFab.setScaleY(1.0f); 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)
public void show() { if (mMoveFabX) { float fabEndX = mFab.getLeft() > mRootView.getWidth() / 2f ? mFab.getLeft() - mFab.getWidth() : mFab.getLeft() + mFab.getWidth(); // Place view a bit closer to the fab mToolbar.setX(fabEndX - mToolbar.getWidth() / 2f + mFab.getWidth()); // Move FloatingToolbar to the original position mToolbar.animate().x(mToolbar.getLeft()).setStartDelay(CIRCULAR_REVEAL_DELAY + mDelay) .setDuration((long) (CIRCULAR_REVEAL_DURATION) + mDelay) .setInterpolator(new AccelerateDecelerateInterpolator()); } // Start showing content view if (mContentView != null) { mContentView.setAlpha(0f); mContentView.setScaleX(0.7f); mContentView.animate().alpha(1).scaleX(1f) .setDuration(MENU_ANIMATION_DURATION + mDelay) .setStartDelay(MENU_ANIMATION_DELAY + mDelay) .setInterpolator(new AccelerateDecelerateInterpolator()) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mAnimationListener.onAnimationFinished(); mContentView.animate().setListener(null); } }); } }
int centerX = vLocation[0] + fab.getWidth() / 2; int centerY = vLocation[1] + fab.getHeight() / 2;
int height = getFloatingToolbar().getHeight(); Animator toolbarReveal = ViewAnimationUtils.createCircularReveal(getFloatingToolbar(), width / 2, height / 2, (float) getFab().getWidth() / 2f, (float) (Math.hypot(width / 2, height / 2)));
(float) getFab().getWidth() / 2f);
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void animateRevealShow() { GuiUtils.animateRevealShow( this, mRlContainer, mFabCircle.getWidth() / 2, R.color.colorAccent, new GuiUtils.OnRevealAnimationListener() { @Override public void onRevealHide() { } @Override public void onRevealShow() { initViews(); } }); }
@Override public void onBackPressed() { GuiUtils.animateRevealHide( this, mRlContainer, mFabCircle.getWidth() / 2, R.color.colorAccent, new GuiUtils.OnRevealAnimationListener() { @Override public void onRevealHide() { defaultBackPressed(); } @Override public void onRevealShow() { } }); }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private void startRippleTransitionReveal() { fab.setVisibility(View.INVISIBLE); Animator animator = ViewAnimationUtils.createCircularReveal(rippleView, (int) fab.getX() + fab.getWidth() / 2, (int) fab.getY(), fab.getWidth() / 2, TransitionUtils.getViewRadius(rippleView) * 2); rippleView.setVisibility(View.VISIBLE); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(400); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); recyclerView.animate().alpha(0f); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); startActivity(); } }); animator.start(); }
public void animateRevealShow() { Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd, cvAdd.getWidth()/2,0, fab.getWidth() / 2, cvAdd.getHeight()); mAnimator.setDuration(500); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } @Override public void onAnimationStart(Animator animation) { cvAdd.setVisibility(View.VISIBLE); super.onAnimationStart(animation); } }); mAnimator.start(); }
public void animateRevealShow() { Animator mAnimator = ViewAnimationCompatUtils.createCircularReveal(cvAdd, cvAdd.getWidth()/2,0, fab.getWidth() / 2, cvAdd.getHeight()); mAnimator.setDuration(300); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); } @Override public void onAnimationStart(Animator animation) { cvAdd.setVisibility(View.VISIBLE); super.onAnimationStart(animation); } }); mAnimator.start(); }
@Override public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { v.removeOnLayoutChangeListener(this); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int x = (int) (mFab.getWidth() / 2 + mFab.getX()); int y = (int) (mFab.getHeight() / 2 + mFab.getY()); Animator animator = ViewAnimationUtils.createCircularReveal(decorView, x, y, 0, decorView.getHeight()); animator.setDuration(400); animator.start(); } } });
public void animateRevealClose() { Animator mAnimator = ViewAnimationUtils.createCircularReveal(cvAdd,cvAdd.getWidth()/2,0, cvAdd.getHeight(), fab.getWidth() / 2); mAnimator.setDuration(500); mAnimator.setInterpolator(new AccelerateInterpolator()); mAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { cvAdd.setVisibility(View.INVISIBLE); super.onAnimationEnd(animation); fab.setImageResource(R.drawable.ic_signup); RegisterActivity.super.onBackPressed(); } @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); } }); mAnimator.start(); } @Override
@Override public void run() { mRl.setVisibility(View.VISIBLE); CRAnimation crA = new CircularRevealCompat(mRl).circularReveal( mFloatingActionButton.getLeft() + mFloatingActionButton.getWidth() / 2, mFloatingActionButton.getTop() + mFloatingActionButton.getHeight() / 2, 0, mRl.getHeight()); if (crA != null) crA.start(); } },600);