List of usage examples for android.view ViewAnimationUtils createCircularReveal
public static Animator createCircularReveal(View view, int centerX, int centerY, float startRadius, float endRadius)
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void show(final View view, final int cornerType, int normalAnimRes, final AnimatorListenerAdapter listener) { try {/* ww w. j a v a 2 s .c om*/ int[] amaya = calulateCorner(view, cornerType); Animator anim = ViewAnimationUtils.createCircularReveal(view, amaya[0], amaya[1], 0, amaya[2]); anim.setInterpolator(new LinearInterpolator()); anim.setDuration(300); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); if (listener != null) { listener.onAnimationStart(animation); } } }); anim.start(); } catch (Exception e) { e.printStackTrace(); view.setVisibility(View.VISIBLE); } }
From source file:Main.java
/** * Circular Reveal Animation/*from w w w. ja v a 2s. c om*/ * @param view View to be animated * @param cx x coordinate of the center of the circle * @param cy y coordinate of the center of the circle * @param startRadius initial circle radius * @param finalRadius final circle radius * @param duration animation duration in milliseconds * @return Animator Object */ @NonNull @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Animator reveal(@NonNull final View view, int cx, int cy, int startRadius, int finalRadius, int duration) { Animator animator = ViewAnimationUtils.createCircularReveal(view, cx, cy, startRadius, finalRadius); animator.setDuration(duration); return animator; }
From source file:Main.java
public static Animator createCircularHideAnimator(final View view, @Nullable Animator.AnimatorListener listener) { if (view.getWindowToken() == null || view.getVisibility() == View.INVISIBLE) return null; // get the center for the clipping circle int cx = (view.getLeft() + view.getRight()) / 2; int cy = (view.getTop() + view.getBottom()) / 2; // get the initial radius for the clipping circle int initialRadius = view.getWidth(); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override// w ww . j a v a 2s . com public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(View.INVISIBLE); } }); if (listener != null) { anim.addListener(listener); } return anim; }
From source file:Main.java
@SuppressLint("NewApi") public static void revealView(View toBeRevealed, View frame) { try {/*from ww w.ja va2s . c om*/ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) { // get the center for the clipping circle int cx = (frame.getLeft() + frame.getRight()) / 2; int cy = (frame.getTop() + frame.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = Math.max(frame.getWidth(), frame.getHeight()); Log.v("INFO", "Radius: " + finalRadius); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(toBeRevealed, cx, cy, 0, finalRadius); // make the view visible and start the animation toBeRevealed.setVisibility(View.VISIBLE); anim.start(); } else { toBeRevealed.setVisibility(View.VISIBLE); } } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static Animator createCircularShowAnimator(final View view) { if (view.getVisibility() == View.VISIBLE || view.getWindowToken() == null) return null; // get the center for the clipping circle int cx = (view.getLeft() + view.getRight()) / 2; int cy = (view.getTop() + view.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = view.getWidth(); // create and start the animator for this view // (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.addListener(new AnimatorListenerAdapter() { @Override/* w ww . j a va 2 s.c om*/ public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }); return anim; }
From source file:Main.java
public static void circleReveal(final View targetView, int centerX, int centerY, boolean isReverse) { if (targetView == null || !targetView.isAttachedToWindow()) return;/*from ww w. ja va 2 s. c o m*/ int radius = (int) Math.hypot(targetView.getHeight(), targetView.getWidth()); Animator animator; if (isReverse) { animator = isCircleRevealSupported() ? ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, radius, 0) : createFade(targetView, 1, 0); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { targetView.setVisibility(View.GONE); } }); } else { animator = isCircleRevealSupported() ? ViewAnimationUtils.createCircularReveal(targetView, centerX, centerY, 0, radius) : createFade(targetView, 0, 1); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { targetView.setVisibility(View.VISIBLE); } }); } animator.setDuration(DURATION); animator.start(); }
From source file:Main.java
public static void startActivity(final Activity thisActivity, final Intent intent, final View triggerView, int colorOrImageRes, final long durationMills) { int[] location = new int[2]; triggerView.getLocationInWindow(location); final int cx = location[0] + triggerView.getWidth(); final int cy = location[1] + triggerView.getHeight() + (int) TypedValue .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 160, thisActivity.getResources().getDisplayMetrics()); final ImageView view = new ImageView(thisActivity); view.setScaleType(ImageView.ScaleType.CENTER_CROP); view.setImageResource(colorOrImageRes); final ViewGroup decorView = (ViewGroup) thisActivity.getWindow().getDecorView(); int w = decorView.getWidth(); int h = decorView.getHeight(); decorView.addView(view, w, h);//from w w w.j a va 2 s. c o m final int finalRadius = (int) Math.sqrt(w * w + h * h) + 1; Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius); anim.setDuration(durationMills); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); thisActivity.startActivity(intent); thisActivity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); } }); anim.start(); }
From source file:Main.java
public static void showRevealEFfect(final View v, int centerX, int centerY, Animator.AnimatorListener lis) { v.setVisibility(View.VISIBLE); int height = v.getHeight(); Animator anim = ViewAnimationUtils.createCircularReveal(v, centerX, centerY, 0, height); anim.setDuration(350);//from www.ja va2 s . co m anim.addListener(lis); anim.start(); }
From source file:Main.java
public static void hideRevealEffect(final View v, int centerX, int centerY, int initialRadius) { v.setVisibility(View.VISIBLE); // create the animation (the final radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(v, centerX, centerY, initialRadius, 0); anim.setDuration(350);//from w w w. j a v a 2 s . co m // make the view invisible when the animation is done anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); v.setVisibility(View.INVISIBLE); } }); anim.start(); }
From source file:com.destin.sehaikun.AnimationUtils.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void reveal(View view, int centerX, int centerY, float startRadius, float endRadius, Animator.AnimatorListener listener) { Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius); animator.setDuration(ANIMATION_DURATION_MEDIUM); if (listener != null) { animator.addListener(listener);/* www.j a v a 2s . c o m*/ } animator.start(); }