Java Code Examples for io.codetail.animation.ViewAnimationUtils#createCircularReveal()
The following examples show how to use
io.codetail.animation.ViewAnimationUtils#createCircularReveal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HomeActivity.java From Expert-Android-Programming with MIT License | 6 votes |
private void exitReveal(final View icon, final View toolbar) { // get the center for the clipping circle int cx = getRelativeLeft(icon) + icon.getMeasuredWidth() / 2; int cy = getRelativeTop(icon); // get the initial radius for the clipping circle int initialRadius = Math.max(toolbar.getWidth(), toolbar.getHeight()); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(toolbar, cx, cy, initialRadius, 0); // make the view invisible when the animation is done anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); toolbar.setVisibility(View.INVISIBLE); } }); anim.setDuration(Constant.SEARCH_REVEAL_DURATION); // start the animation anim.start(); }
Example 2
Source File: AnimationUtil.java From FileManager with Apache License 2.0 | 6 votes |
/** * @param view 展开动画的view * @param centerX 从具体某个点的X坐标开始扩散 * @param centerY 从具体某个点的Y坐标开始扩散 * @param MultipleRadius 半径倍数 * @param Duration 动画时间 * @return */ public static Animator getCircularReveal(View view, int centerX, int centerY, int MultipleRadius, int Duration) { int cx = (view.getLeft() + view.getRight()) / 2; int cy = (view.getTop() + view.getBottom()) / 2; int dx = Math.max(cx, view.getWidth() - cx); int dy = Math.max(cy, view.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); // Android native animator Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius * MultipleRadius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(Duration); return animator; }
Example 3
Source File: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 6 votes |
void disappearRed() { int cx = mRed.getWidth() / 2; int cy = mRed.getHeight() / 2; SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, mRed.getWidth() / 2, 0); animator.addListener(new SimpleListener() { @Override public void onAnimationEnd() { mRed.setVisibility(View.INVISIBLE); ViewHelper.setX(mRed, startRedX); ViewHelper.setY(mRed, startRedY); release(); } }); animator.setInterpolator(DECELERATE); animator.start(); }
Example 4
Source File: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 6 votes |
void appearRed() { mRed.setVisibility(View.VISIBLE); int cx = mRed.getWidth() / 2; int cy = mRed.getHeight() / 2; SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2); animator.addListener(new SimpleListener() { @Override public void onAnimationEnd() { upRed(); } }); animator.setInterpolator(ACCELERATE); animator.start(); }
Example 5
Source File: ViewRevealer.java From MaterialLife with GNU General Public License v2.0 | 6 votes |
private void animateFor(View view, Point origin, int startRadius, int targetRadius, final AnimatorListenerAdapter animatorListenerAdapter) { SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, origin.x, origin.y, startRadius, targetRadius); animator.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { animatorListenerAdapter.onAnimationStart(null); } @Override public void onAnimationEnd() { animatorListenerAdapter.onAnimationEnd(null); } @Override public void onAnimationCancel() { animatorListenerAdapter.onAnimationCancel(null); } @Override public void onAnimationRepeat() { animatorListenerAdapter.onAnimationRepeat(null); } }); animator.setDuration(ANIMATION_DURATION); animator.start(); }
Example 6
Source File: DonationActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 6 votes |
private void playInitAnimation() { DisplayMetrics dm = getResources().getDisplayMetrics(); // Get the center for the FAB int cx = dm.widthPixels / 2; int cy = 0; float finalRadius = dm.heightPixels; revealTransition = ViewAnimationUtils.createCircularReveal(mainContentLayout, cx, cy, 0, finalRadius); revealTransition.setInterpolator(new AccelerateDecelerateInterpolator()); revealTransition.setDuration(800); revealTransition.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mainContentLayout.setVisibility(View.VISIBLE); } public void onAnimationEnd() {} public void onAnimationCancel() {} public void onAnimationRepeat() {} }); revealTransition.start(); }
Example 7
Source File: MemoFragment.java From MaterialCalendar with Apache License 2.0 | 6 votes |
void appearBluePair() { mBluePair.setVisibility(View.VISIBLE); float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f; SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY, mBlue.getWidth() / 2f, finalRadius); animator.setDuration(500); animator.setInterpolator(ACCELERATE); animator.addListener(new SimpleListener() { @Override public void onAnimationEnd() { raise(); } }); animator.start(); }
Example 8
Source File: MapSearchView.java From droidkaigi2016 with Apache License 2.0 | 6 votes |
public void revealOff() { if (binding.mapListContainer.getVisibility() != VISIBLE) return; View container = binding.mapListContainer; Animator animator = ViewAnimationUtils.createCircularReveal( container, getRevealCenterX(container), container.getTop(), (float) Math.hypot(container.getWidth(), container.getHeight()), 0); animator.setInterpolator(INTERPOLATOR); animator.setDuration(getResources().getInteger(R.integer.view_reveal_mills)); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { binding.mapListContainer.setVisibility(INVISIBLE); if (onVisibilityChangeListener != null) { onVisibilityChangeListener.onChange(); } } }); animator.start(); }
Example 9
Source File: GroupPopupView.java From openlauncher with Apache License 2.0 | 5 votes |
private void expand() { _cellContainer.setAlpha(0); int finalRadius = Math.max(_popupCard.getWidth(), _popupCard.getHeight()); int startRadius = Tool.dp2px(Setup.appSettings().getDesktopIconSize() / 2); long animDuration = Setup.appSettings().getAnimationSpeed() * 10; _folderAnimator = ViewAnimationUtils.createCircularReveal(_popupCard, _cx, _cy, startRadius, finalRadius); _folderAnimator.setStartDelay(0); _folderAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); _folderAnimator.setDuration(animDuration); _folderAnimator.start(); Tool.visibleViews(animDuration, _cellContainer); }
Example 10
Source File: HomeBaseActivity.java From Expert-Android-Programming with MIT License | 5 votes |
private void exitReveal(final View myView, final int screenType) { menuShown = false; centerButton.animate().rotation(0).setInterpolator(new AccelerateInterpolator()).setDuration(50); // get the center for the clipping circle int cx = myView.getMeasuredWidth() / 2; int cy = myView.getMeasuredHeight(); // get the initial radius for the clipping circle int initialRadius = Math.max(myView.getWidth(), myView.getHeight()); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, 0); // make the view invisible when the animation is done anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); revealLay.setVisibility(View.INVISIBLE); openActivity(screenType); } }); anim.setDuration(Constant.REVEAL_DURATION); // start the animation anim.start(); setSelected(screenType); }
Example 11
Source File: FabAnimatorPreL.java From fab-transformation with MIT License | 5 votes |
@Override final void revealOn(final View fab, final View transformView, final RevealCallback callback) { SupportAnimator animator = ViewAnimationUtils.createCircularReveal( transformView, getCenterX(fab), getCenterY(fab), fab.getWidth() / 2, (float) Math.hypot(transformView.getWidth(), transformView.getHeight()) / 2); transformView.setVisibility(View.VISIBLE); animator.setInterpolator(FAB_INTERPOLATOR); animator.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { callback.onRevealStart(); } @Override public void onAnimationEnd() { callback.onRevealEnd(); } @Override public void onAnimationCancel() { // } @Override public void onAnimationRepeat() { // } }); if (transformView.getVisibility() == View.VISIBLE) { animator.setDuration((int) getRevealAnimationDuration()); animator.start(); transformView.setEnabled(true); } }
Example 12
Source File: MainActivity.java From Side-Menu.Android with Apache License 2.0 | 5 votes |
private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) { this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music; View view = findViewById(R.id.content_frame); int finalRadius = Math.max(view.getWidth(), view.getHeight()); Animator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius); animator.setInterpolator(new AccelerateInterpolator()); animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION); findViewById(R.id.content_overlay).setBackground(new BitmapDrawable(getResources(), screenShotable.getBitmap())); animator.start(); ContentFragment contentFragment = ContentFragment.newInstance(this.res); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit(); return contentFragment; }
Example 13
Source File: DotsFragment.java From android-material-motion with Apache License 2.0 | 5 votes |
private Animator createRevealAnimator(FloatingActionButton dot, float offsetY) { ViewCompat.setElevation(dot, 0); dot.setVisibility(View.INVISIBLE); lastDot = dot; int cx = (int) (dot.getX() + dot.getHeight() / 2); int cy = (int) (dot.getY() + dot.getHeight() / 2 + offsetY); int w = topPanel.getWidth(); int h = topPanel.getHeight(); final int endRadius = !isFolded ? (int) Math.hypot(w, h) : dot.getHeight() / 2; final int startRadius = isFolded ? (int) Math.hypot(w, h) : dot.getHeight() / 2; topPanel.setVisibility(View.VISIBLE); Animator animator = ViewAnimationUtils.createCircularReveal(topPanel, cx, cy, startRadius, endRadius); animator.setDuration(duration(R.integer.reveal_duration)); return animator; }
Example 14
Source File: RevealLinearLayout.java From PersistentSearchView with Apache License 2.0 | 5 votes |
/** * @hide */ @Override public SupportAnimator startReverseAnimation() { if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) { return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(), mRevealInfo.centerX, mRevealInfo.centerY, mRevealInfo.endRadius, mRevealInfo.startRadius); } return null; }
Example 15
Source File: CreditCardView.java From CreditCardView with Apache License 2.0 | 4 votes |
public void showAnimation(final View cardContainer, final View v, final int drawableId) { final View mRevealView = v; mRevealView.setBackgroundResource(drawableId); if (mCurrentDrawable == drawableId) { return; } int duration = 1000; int cx = mRevealView.getLeft(); int cy = mRevealView.getTop(); int radius = Math.max(mRevealView.getWidth(), mRevealView.getHeight()) * 4; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, 0, radius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(duration); new Handler().postDelayed(new Runnable() { @Override public void run() { cardContainer.setBackgroundResource(drawableId); } }, duration); mRevealView.setVisibility(View.VISIBLE); animator.start(); mCurrentDrawable = drawableId; } else { Animator anim = android.view.ViewAnimationUtils.createCircularReveal(mRevealView, cx, cy, 0, radius); mRevealView.setVisibility(View.VISIBLE); anim.setDuration(duration); anim.start(); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); cardContainer.setBackgroundResource(drawableId); } }); mCurrentDrawable = drawableId; } }
Example 16
Source File: LoginActivity.java From Pocket-Plays-for-Twitch with GNU General Public License v3.0 | 4 votes |
private void showSkippingAnimation() { // Get the center for the FAB int cx = (int) mContinueFABContainer.getX() + mContinueFABContainer.getMeasuredHeight() / 2; int cy = (int) mContinueFABContainer.getY() + mContinueFABContainer.getMeasuredWidth() / 2; // get the final radius for the clipping circle int dx = Math.max(cx, mTransitionViewWhite.getWidth() - cx); int dy = Math.max(cy, mTransitionViewWhite.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); final SupportAnimator whiteTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius); whiteTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); whiteTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); whiteTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.bringToFront(); mTransitionViewWhite.setVisibility(View.VISIBLE); mContinueFABContainer.setClickable(false); if(mContinueIcon.getVisibility() == View.VISIBLE) { hideContinueIconAnimations(); } } @Override public void onAnimationEnd() { hasTransitioned = true; transitionAnimationWhite = whiteTransitionAnimation; new Settings(getBaseContext()).setSetup(true); new Settings(getBaseContext()).setLogin(false); Intent intent = Service.getNotLoggedInIntent(getBaseContext()); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteTransitionAnimation.start(); }
Example 17
Source File: SearchBox.java From ExpressHelper with GNU General Public License v3.0 | 4 votes |
private void revealFrom(float x, float y, Activity a, SearchBox s) { Display display = a.getWindowManager().getDefaultDisplay(); Point size = new Point(); FrameLayout layout = (FrameLayout) a.getWindow().getDecorView() .findViewById(android.R.id.content); RelativeLayout root = (RelativeLayout) s.findViewById(R.id.search_root); display.getSize(size); Resources r = getResources(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 96, r.getDisplayMetrics()); int cx = layout.getLeft() + layout.getRight(); int cy = layout.getTop(); int finalRadius = (int) Math.max(layout.getWidth(), px); SupportAnimator animator = ViewAnimationUtils.createCircularReveal( root, cx, cy, 0, finalRadius); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(500); animator.addListener(new SupportAnimator.AnimatorListener(){ @Override public void onAnimationCancel() { } @Override public void onAnimationEnd() { toggleSearch(); } @Override public void onAnimationRepeat() { } @Override public void onAnimationStart() { } }); animator.start(); }
Example 18
Source File: MainActivity.java From CircularReveal with MIT License | 4 votes |
@OnClick(R.id.reset) void resetUi(View resetCard) { cardsLine.setVisibility(View.INVISIBLE); final View target = ButterKnife.findById(this, R.id.activator); // Coordinates of circle initial point final ViewGroup parent = (ViewGroup) activatorMask.getParent(); final Rect bounds = new Rect(); final Rect maskBounds = new Rect(); target.getDrawingRect(bounds); activatorMask.getDrawingRect(maskBounds); parent.offsetDescendantRectToMyCoords(target, bounds); parent.offsetDescendantRectToMyCoords(activatorMask, maskBounds); maskElevation = activatorMask.getCardElevation(); activatorMask.setCardElevation(0); final int cX = maskBounds.centerX(); final int cY = maskBounds.centerY(); final Animator circularReveal = ViewAnimationUtils.createCircularReveal(activatorMask, cX, cY, (float) Math.hypot(maskBounds.width() * .5f, maskBounds.height() * .5f), target.getWidth() / 2f, View.LAYER_TYPE_HARDWARE); final float c0X = bounds.centerX() - maskBounds.centerX(); final float c0Y = bounds.centerY() - maskBounds.centerY(); AnimatorPath path = new AnimatorPath(); path.moveTo(0, 0); path.curveTo(0, 0, 0, c0Y, c0X, c0Y); ObjectAnimator pathAnimator = ObjectAnimator.ofObject(this, "maskLocation", new PathEvaluator(), path.getPoints().toArray()); AnimatorSet set = new AnimatorSet(); set.playTogether(circularReveal, pathAnimator); set.setInterpolator(new FastOutSlowInInterpolator()); set.setDuration(SLOW_DURATION); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { activatorMask.setCardElevation(maskElevation); activatorMask.setVisibility(View.INVISIBLE); circlesLine.setVisibility(View.VISIBLE); executeCirclesDropDown(); target.setEnabled(true); } }); set.start(); }
Example 19
Source File: NotificationActivity.java From Twire with GNU General Public License v3.0 | 4 votes |
private SupportAnimator showTransitionAnimation() { // Get the center for the FAB int cx = (int) mContinueFABContainer.getX() + mContinueFABContainer.getMeasuredHeight() / 2; int cy = (int) mContinueFABContainer.getY() + mContinueFABContainer.getMeasuredWidth() / 2; // get the final radius for the clipping circle int dx = Math.max(cx, mTransitionViewWhite.getWidth() - cx); int dy = Math.max(cy, mTransitionViewWhite.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); mTransitionViewBlue.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); final SupportAnimator whiteTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius); whiteTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); whiteTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); whiteTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewWhite.bringToFront(); mTransitionViewWhite.setVisibility(View.VISIBLE); mContinueFABContainer.setClickable(false); if (mContinueIcon.getVisibility() == View.VISIBLE) { hideContinueIconAnimations(); } } @Override public void onAnimationEnd() { transitionAnimationWhite = whiteTransitionAnimation; } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); final SupportAnimator blueTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewBlue, cx, cy, 0, finalRadius); blueTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); blueTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); blueTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { mTransitionViewBlue.setVisibility(View.VISIBLE); mTransitionViewBlue.bringToFront(); mContinueFABShadow.bringToFront(); mContinueFAB.bringToFront(); } @Override public void onAnimationEnd() { mTransitionViewBlue.setLayerType(View.LAYER_TYPE_NONE, null); mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); transitionAnimationBlue = blueTransitionAnimation; } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); whiteTransitionAnimation.start(); blueTransitionAnimation.setStartDelay(REVEAL_ANIMATION_DELAY); blueTransitionAnimation.start(); return blueTransitionAnimation; }
Example 20
Source File: ConfirmSetupActivity.java From Twire with GNU General Public License v3.0 | 4 votes |
private SupportAnimator showTransitionAnimation() { // Get the center for the FAB int cx = (int) mContinueFABContainer.getX() + mContinueFABContainer.getMeasuredHeight() / 2; int cy = (int) mContinueFABContainer.getY() + mContinueFABContainer.getMeasuredWidth() / 2; // get the final radius for the clipping circle int dx = Math.max(cx, mTransitionViewWhite.getWidth() - cx); int dy = Math.max(cy, mTransitionViewWhite.getHeight() - cy); float finalRadius = (float) Math.hypot(dx, dy); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mTransitionViewWhite.isAttachedToWindow(); } final SupportAnimator blueTransitionAnimation = ViewAnimationUtils.createCircularReveal(mTransitionViewWhite, cx, cy, 0, finalRadius); blueTransitionAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); blueTransitionAnimation.setDuration(REVEAL_ANIMATION_DURATION); blueTransitionAnimation.addListener(new SupportAnimator.AnimatorListener() { @Override public void onAnimationStart() { //mTransitionViewWhite.setLayerType(View.LAYER_TYPE_HARDWARE, null); mTransitionViewWhite.setVisibility(View.VISIBLE); mTransitionViewWhite.bringToFront(); mContinueFABShadow.bringToFront(); mContinueFAB.bringToFront(); } @Override public void onAnimationEnd() { //mTransitionViewWhite.setLayerType(View.LAYER_TYPE_NONE, null); } @Override public void onAnimationCancel() { } @Override public void onAnimationRepeat() { } }); new Handler().postDelayed(blueTransitionAnimation::start, REVEAL_ANIMATION_DELAY); return blueTransitionAnimation; }