android.view.ViewAnimationUtils Java Examples
The following examples show how to use
android.view.ViewAnimationUtils.
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: SearchAnimator.java From MeiZiNews with MIT License | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void revealInAnimation(final Context mContext, final View view, int duration) { int cx = view.getWidth() - mContext.getResources().getDimensionPixelSize(R.dimen.reveal); int cy = view.getHeight() / 2; if (cx != 0 && cy != 0) { float finalRadius = (float) Math.hypot(cx, cy); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0.0f, finalRadius); anim.setInterpolator(new AccelerateDecelerateInterpolator()); anim.setDuration(duration); view.setVisibility(View.VISIBLE); anim.start(); } }
Example #2
Source File: UserDetailActivity.java From timecat with Apache License 2.0 | 6 votes |
private void animateAvatarBg(int duration, int x, Animator.AnimatorListener cb) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { userAvatarBg.setVisibility(View.INVISIBLE); // get the center for the clipping circle int cx = (userAvatarBg.getLeft() + userAvatarBg.getRight()) / 2; int cy = userAvatarBg.getBottom(); // get the final radius for the clipping circle int finalRadius = (int) Math.hypot(userAvatarBg.getWidth(), userAvatarBg.getHeight()); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(userAvatarBg, x, cy, ScreenUtil.dpToPx(getResources(), 100f), finalRadius); // make the view visible and start the animation userAvatarBg.setVisibility(View.VISIBLE); anim.setInterpolator(new DecelerateInterpolator()); anim.setDuration(duration); if (cb != null) { anim.addListener(cb); } anim.start(); } }
Example #3
Source File: SearchToolbar.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
@MainThread private void hide() { if (getVisibility() == View.VISIBLE) { if (listener != null) listener.onSearchClosed(); if (Build.VERSION.SDK_INT >= 21) { Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, getWidth(), 0); animator.setDuration(400); animator.addListener(new AnimationCompleteListener() { @Override public void onAnimationEnd(Animator animation) { setVisibility(View.INVISIBLE); } }); animator.start(); } else { setVisibility(View.INVISIBLE); } } }
Example #4
Source File: MainActivity.java From Android-Tutorials with Apache License 2.0 | 6 votes |
private void animateAppAndStatusBar(int cx, final int toColor) { Animator animator = ViewAnimationUtils.createCircularReveal( mRevealView, cx, appBarLayout.getBottom(), 0, appBarLayout.getWidth() / 2); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { mRevealView.setBackgroundColor(getResources().getColor(toColor)); } }); mRevealBackgroundView.setBackgroundColor(getResources().getColor(fromColor)); animator.setStartDelay(200); animator.setDuration(125); animator.start(); mRevealView.setVisibility(View.VISIBLE); fromColor = toColor; }
Example #5
Source File: NextActivity.java From Android-Tutorials with Apache License 2.0 | 6 votes |
private void circularRevealActivity() { int cx = background.getRight() - getDips(44); int cy = background.getBottom() - getDips(44); float finalRadius = Math.max(background.getWidth(), background.getHeight()); Animator circularReveal = ViewAnimationUtils.createCircularReveal( background, cx, cy, 0, finalRadius); circularReveal.setDuration(3000); background.setVisibility(View.VISIBLE); circularReveal.start(); }
Example #6
Source File: CircularAnimUtil.java From Awesome-WanAndroid with Apache License 2.0 | 6 votes |
/** * 向四周伸张,直到完成显示。 */ @SuppressLint("NewApi") public static void show(View myView, float startRadius, long durationMills) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { myView.setVisibility(View.VISIBLE); return; } int cx = (myView.getLeft() + myView.getRight()) / 2; int cy = (myView.getTop() + myView.getBottom()) / 2; int w = myView.getWidth(); int h = myView.getHeight(); // 勾股定理 & 进一法 int finalRadius = (int) Math.sqrt(w * w + h * h) + 1; Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius); myView.setVisibility(View.VISIBLE); anim.setDuration(durationMills); anim.start(); }
Example #7
Source File: AnimationUtils.java From adamant-android with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static void startCircularRevealExitAnimation(Context context, final View view, RevealAnimationSetting revealSettings, int startColor, int endColor, final AnimationFinishedListener listener) { if (isAnimationEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int cx = revealSettings.getCenterX(); int cy = revealSettings.getCenterY(); int width = revealSettings.getWidth(); int height = revealSettings.getHeight(); float initRadius = (float) Math.sqrt(width * width + height * height); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initRadius, 0); anim.setDuration(getMediumDuration(context)); anim.setInterpolator(new FastOutSlowInInterpolator()); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { //Important: This will prevent the view's flashing (visible between the finished animation and the Fragment remove) view.setVisibility(View.GONE); listener.onAnimationFinished(); } }); anim.start(); startBackgroundColorAnimation(view, startColor, endColor, getMediumDuration(context)); } else { listener.onAnimationFinished(); } }
Example #8
Source File: SearchToolbar.java From deltachat-android with GNU General Public License v3.0 | 6 votes |
@MainThread public void display(float x, float y) { if (getVisibility() != View.VISIBLE) { this.x = x; this.y = y; searchItem.expandActionView(); if (Build.VERSION.SDK_INT >= 21) { Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, 0, getWidth()); animator.setDuration(400); setVisibility(View.VISIBLE); animator.start(); } else { setVisibility(View.VISIBLE); } } }
Example #9
Source File: CircularRevealCompat.java From material-components-android with Apache License 2.0 | 6 votes |
/** * Returns an Animator to animate a clipping circle. * * <p>This is meant to be used as a drop-in replacement for {@link * ViewAnimationUtils#createCircularReveal(View, int, int, float, float)}. In pre-L APIs, a * backwards compatible version of the Animator will be returned. * * <p>You must also call {@link * CircularRevealCompat#createCircularRevealListener(CircularRevealWidget)} and add the returned * AnimatorListener to this Animator or preferably to the overall AnimatorSet. */ @NonNull public static Animator createCircularReveal( CircularRevealWidget view, float centerX, float centerY, float startRadius, float endRadius) { Animator revealInfoAnimator = ObjectAnimator.ofObject( view, CircularRevealProperty.CIRCULAR_REVEAL, CircularRevealEvaluator.CIRCULAR_REVEAL, new RevealInfo(centerX, centerY, startRadius), new RevealInfo(centerX, centerY, endRadius)); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { Animator circularRevealAnimator = ViewAnimationUtils.createCircularReveal( (View) view, (int) centerX, (int) centerY, startRadius, endRadius); AnimatorSet set = new AnimatorSet(); set.playTogether(revealInfoAnimator, circularRevealAnimator); return set; } else { return revealInfoAnimator; } }
Example #10
Source File: FabTransformationBehavior.java From material-components-android with Apache License 2.0 | 6 votes |
/** Adds pre radial expansion animator. */ private void createPreFillRadialExpansion( View child, long delay, int revealCenterX, int revealCenterY, float fromRadius, @NonNull List<Animator> animations) { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { // No setter for circular reveal in L+. if (delay > 0) { Animator animator = ViewAnimationUtils.createCircularReveal( child, revealCenterX, revealCenterY, fromRadius, fromRadius); animator.setStartDelay(0); animator.setDuration(delay); animations.add(animator); } } }
Example #11
Source File: FabTransformationBehavior.java From material-components-android with Apache License 2.0 | 6 votes |
/** Adds post radial expansion animator. */ private void createPostFillRadialExpansion( View child, long delay, long duration, long totalDuration, int revealCenterX, int revealCenterY, float toRadius, @NonNull List<Animator> animations) { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { // Circular reveal in L+ doesn't stick around. if (delay + duration < totalDuration) { Animator animator = ViewAnimationUtils.createCircularReveal( child, revealCenterX, revealCenterY, toRadius, toRadius); animator.setStartDelay(delay + duration); animator.setDuration(totalDuration - (delay + duration)); animations.add(animator); } } }
Example #12
Source File: SearchToolbar.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
@MainThread private void hide() { if (getVisibility() == View.VISIBLE) { if (listener != null) listener.onSearchClosed(); if (Build.VERSION.SDK_INT >= 21) { Animator animator = ViewAnimationUtils.createCircularReveal(this, (int)x, (int)y, getWidth(), 0); animator.setDuration(400); animator.addListener(new AnimationCompleteListener() { @Override public void onAnimationEnd(Animator animation) { setVisibility(View.INVISIBLE); } }); animator.start(); } else { setVisibility(View.INVISIBLE); } } }
Example #13
Source File: Utils.java From KA27 with Apache License 2.0 | 6 votes |
public static void circleAnimate(final View view, int cx, int cy) { if (view == null) return; try { view.setVisibility(View.INVISIBLE); int finalRadius = Math.max(view.getWidth(), view.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.setDuration(500); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }); anim.start(); } catch (IllegalStateException e) { view.setVisibility(View.VISIBLE); } }
Example #14
Source File: MainActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) private void listing12_3() { // Listing 12-3: Using a circular reveal to show a View final View view = findViewById(R.id.hidden_view); // Center the reveal on the middle of the View int centerX = view.getWidth() / 2; int centerY = view.getHeight() / 2; // Determine what radius circle will cover the entire View float coveringRadius = (float) Math.hypot(centerX, centerY); // Build the circular reveal Animator anim = ViewAnimationUtils.createCircularReveal( view, centerX, centerY, 0, // initial radius coveringRadius // final covering radius ); // Set the View to VISIBLE before starting the animation view.setVisibility(View.VISIBLE); anim.start(); }
Example #15
Source File: CircularAnimUtil.java From SeeWeather with Apache License 2.0 | 6 votes |
/** * 向四周伸张,直到完成显示。 */ @SuppressLint("NewApi") public static void show(View myView, float startRadius, long durationMills) { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { myView.setVisibility(View.VISIBLE); return; } int cx = (myView.getLeft() + myView.getRight()) / 2; int cy = (myView.getTop() + myView.getBottom()) / 2; int w = myView.getWidth(); int h = myView.getHeight(); // 勾股定理 & 进一法 int finalRadius = (int) Math.sqrt(w * w + h * h) + 1; Animator anim = ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius); myView.setVisibility(View.VISIBLE); anim.setDuration(durationMills); anim.start(); }
Example #16
Source File: Utils.java From kernel_adiutor with Apache License 2.0 | 6 votes |
public static void circleAnimate(final View view, int cx, int cy) { if (view == null) return; try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setVisibility(View.INVISIBLE); int finalRadius = Math.max(view.getWidth(), view.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.setDuration(500); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }); anim.start(); } } catch (IllegalStateException e) { view.setVisibility(View.VISIBLE); } }
Example #17
Source File: Utils.java From guitar-tuner with Apache License 2.0 | 6 votes |
public static void reveal(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // get the center for the clipping circle int cx = view.getWidth() / 2; int cy = view.getHeight() / 2; // get the final radius for the clipping circle float finalRadius = (float) Math.hypot(cx, cy); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); // make the view visible and start the animation view.setVisibility(View.VISIBLE); anim.start(); } else { view.setVisibility(View.VISIBLE); view.animate().alpha(1f).start(); } }
Example #18
Source File: SheetLayout.java From HaiNaBaiChuan with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void contractLollipop(int x, int y, float startRadius, float endRadius) { Animator toolbarContractAnim = ViewAnimationUtils.createCircularReveal( mFabExpandLayout, x, y, startRadius, endRadius); toolbarContractAnim.setDuration(animationDuration); toolbarContractAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); contractAnimationEnd(); } }); toolbarContractAnim.start(); }
Example #19
Source File: NeighborsFragment.java From android-wallet-app with GNU General Public License v3.0 | 6 votes |
private void hideReavelEditText(final FrameLayout view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int cx = view.getRight() - 30; int cy = view.getBottom() - 60; int initialRadius = view.getWidth(); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); isEditTextVisible = false; anim.start(); } else { view.setVisibility(View.INVISIBLE); isEditTextVisible = false; } }
Example #20
Source File: NeighborsFragment.java From android-wallet-app with GNU General Public License v3.0 | 6 votes |
private void showRevealEditText(FrameLayout view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { int cx = view.getRight() - 30; int cy = view.getBottom() - 60; int finalRadius = Math.max(view.getWidth(), view.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); view.setVisibility(View.VISIBLE); isEditTextVisible = true; anim.start(); } else { view.setVisibility(View.VISIBLE); isEditTextVisible = true; } }
Example #21
Source File: Timber4.java From Muzesto with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void circularRevealActivity(View v1, View v2) { int cx = v1.getWidth() / 2; int cy = v1.getHeight() / 2; float finalRadius = Math.max(v1.getWidth(), v1.getHeight()); // create the animator for this view (the start radius is zero) Animator circularReveal = ViewAnimationUtils.createCircularReveal(v1, cx, cy, 0, finalRadius); circularReveal.setDuration(1000); // make the view visible and start the animation v2.setVisibility(View.INVISIBLE); v1.setVisibility(View.VISIBLE); circularReveal.start(); }
Example #22
Source File: VideoDetailActivity.java From LQRBiliBlili with MIT License | 6 votes |
private void showVideoStartTip() { mRlVideoTip.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Animator circularReveal = ViewAnimationUtils.createCircularReveal(mRlVideoTip, mIvCover.getWidth() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorX), mIvCover.getHeight() - ArmsUtils.dip2px(VideoDetailActivity.this, mAnchorY), 0, ((float) Math.hypot(mIvCover.getWidth(), mIvCover.getHeight()))); circularReveal.setDuration(800); circularReveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); mIvCover.setVisibility(View.GONE); mPresenter.loadPlayUrl(aid); } }); circularReveal.start(); } else { mPresenter.loadPlayUrl(aid); } // 锁定AppBarLayout AppBarLayout.LayoutParams layoutParams = (AppBarLayout.LayoutParams) mAppbar.getChildAt(0).getLayoutParams(); layoutParams.setScrollFlags(0); mAppbar.getChildAt(0).setLayoutParams(layoutParams); }
Example #23
Source File: AnimHelper.java From mvvm-template with GNU General Public License v3.0 | 6 votes |
@UiThread public static void revealPopupWindow(@NonNull PopupWindow popupWindow, @NonNull View from) { Rect rect = ViewHelper.getLayoutPosition(from); int x = (int) rect.exactCenterX(); int y = (int) rect.exactCenterY(); if (popupWindow.getContentView() != null) { View view = popupWindow.getContentView(); if (view != null) { popupWindow.showAsDropDown(from); view.post(() -> { if (ViewCompat.isAttachedToWindow(view)) { Animator animator = ViewAnimationUtils.createCircularReveal(view, x, y, 0, (float) Math.hypot(rect.width(), rect.height())); animator.setDuration(view.getResources().getInteger(android.R.integer.config_shortAnimTime)); animator.start(); } }); } } }
Example #24
Source File: AnimHelper.java From mvvm-template with GNU General Public License v3.0 | 6 votes |
@UiThread public static void revealDialog(@NonNull Dialog dialog, int animDuration) { if (dialog.getWindow() != null) { View view = dialog.getWindow().getDecorView(); if (view != null) { view.post(() -> { if (ViewCompat.isAttachedToWindow(view)) { int centerX = view.getWidth() / 2; int centerY = view.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 20, view.getHeight()); animator.setDuration(animDuration); animator.start(); } }); } } }
Example #25
Source File: AnimHelper.java From mvvm-template with GNU General Public License v3.0 | 6 votes |
@UiThread public static void dismissDialog(@NonNull DialogFragment dialogFragment, int duration, AnimatorListenerAdapter listenerAdapter) { Dialog dialog = dialogFragment.getDialog(); if (dialog != null) { if (dialog.getWindow() != null) { View view = dialog.getWindow().getDecorView(); if (view != null) { int centerX = view.getWidth() / 2; int centerY = view.getHeight() / 2; float radius = (float) Math.sqrt(view.getWidth() * view.getWidth() / 4 + view.getHeight() * view.getHeight() / 4); view.post(() -> { if (ViewCompat.isAttachedToWindow(view)) { Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, radius, 0); animator.setDuration(duration); animator.addListener(listenerAdapter); animator.start(); } else { listenerAdapter.onAnimationEnd(null); } }); } } } else { listenerAdapter.onAnimationEnd(null); } }
Example #26
Source File: CircularRevealTransition.java From magellan with Apache License 2.0 | 6 votes |
@Override public void animate( View from, View to, NavigationType navType, Direction direction, final Callback callback) { int[] clickedViewCenter = getCenterClickedView((ViewGroup) from); int circularRevealCenterX = clickedViewCenter[0]; int circularRevealCenterY = clickedViewCenter[1]; float finalRadius = (float) Math.hypot(to.getWidth(), to.getHeight()); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { Animator anim = ViewAnimationUtils.createCircularReveal(to, circularRevealCenterX, circularRevealCenterY, 0, finalRadius); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { callback.onAnimationEnd(); } }); anim.start(); } else { callback.onAnimationEnd(); } }
Example #27
Source File: AnimationUtils.java From outlay with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void hideWithReveal(View view, Point point) { if(DeviceUtils.supportV5()) { // get the initial radius for the clipping circle int initialRadius = (int) Math.hypot(view.getWidth(), view.getHeight()); // create the animation (the final radius is zero) Animator animator = ViewAnimationUtils.createCircularReveal(view, point.x, point.y, initialRadius, 0); // make the view invisible when the animation is done animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(500); animator.start(); } else { view.setVisibility(View.INVISIBLE); } }
Example #28
Source File: PlaylistFragment.java From Melophile with Apache License 2.0 | 6 votes |
@Override public void showTitle(String title) { playlistTitle.setText(title); playlistTitle.setScaleX(0); playlistTitle.setScaleY(0); titleBackground.post(() -> { int cx = titleBackground.getWidth() / 2; int cy = titleBackground.getHeight() / 2; Animator animator = ViewAnimationUtils.createCircularReveal(titleBackground, cx, cy, 0, (int) Math.hypot(titleBackground.getWidth(), titleBackground.getHeight())); animator.setDuration(400); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); titleBackground.setVisibility(View.VISIBLE); playlistTitle.animate() .setDuration(400) .scaleX(1).scaleY(1) .setInterpolator(new OvershootInterpolator()) .start(); } }); animator.start(); }); }
Example #29
Source File: QuizActivity.java From android-topeka with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void prepareCircularReveal(View startView, FrameLayout targetView) { int centerX = (startView.getLeft() + startView.getRight()) / 2; // Subtract the start view's height to adjust for relative coordinates on screen. int centerY = (startView.getTop() + startView.getBottom()) / 2 - startView.getHeight(); float endRadius = (float) Math.hypot(centerX, centerY); mCircularReveal = ViewAnimationUtils.createCircularReveal( targetView, centerX, centerY, startView.getWidth(), endRadius); mCircularReveal.setInterpolator(new FastOutLinearInInterpolator()); mCircularReveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mIcon.setVisibility(View.GONE); mCircularReveal.removeListener(this); } }); // Adding a color animation from the FAB's color to transparent creates a dissolve like // effect to the circular reveal. int accentColor = ContextCompat.getColor(this, mCategory.getTheme().getAccentColor()); mColorChange = ObjectAnimator.ofInt(targetView, ViewUtils.FOREGROUND_COLOR, accentColor, Color.TRANSPARENT); mColorChange.setEvaluator(new ArgbEvaluator()); mColorChange.setInterpolator(mInterpolator); }
Example #30
Source File: BeatBoxFragment.java From AndroidProgramming3e with Apache License 2.0 | 6 votes |
private void performRevealAnimation(final View view, int screenCenterX, int screenCenterY) { int[] animatingViewCoords = new int[2]; view.getLocationOnScreen(animatingViewCoords); int centerX = screenCenterX - animatingViewCoords[0]; int centerY = screenCenterY - animatingViewCoords[1]; Point size = new Point(); getActivity().getWindowManager().getDefaultDisplay().getSize(size); int maxRadius = size.y; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { view.setVisibility(View.VISIBLE); Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, maxRadius); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); animator.start(); } }