List of usage examples for android.animation Animator addListener
public void addListener(AnimatorListener listener)
From source file:Main.java
public static void cancelOnDestroyActivity(Animator a) { sAnimators.add(a); a.addListener(sEndAnimListener); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static Animator createHideAnim(final View viewRoot, int x, int y) { float initialRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, initialRadius, 0); anim.addListener(new AnimatorListenerAdapter() { @Override/* w w w . ja va 2 s . c o m*/ public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); viewRoot.setVisibility(View.GONE); } }); anim.start(); return anim; }
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// ww w .j a va 2 s . c o m public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); view.setVisibility(View.VISIBLE); } }); return anim; }
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//from www. j a v a 2 s .co m 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
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 w w w. j ava 2s. c om anim.addListener(lis); anim.start(); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private static void hide(final View view, int cornerType, int animRes, final boolean goneOrInvisible, final AnimatorListenerAdapter listener) { int[] amaya = calulateCorner(view, cornerType); // if(view) Animator anim = ViewAnimationUtils.createCircularReveal(view, amaya[0], amaya[1], amaya[2], 0); anim.addListener(new AnimatorListenerAdapter() { @Override//w w w . jav a2s . c om public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); view.setVisibility(goneOrInvisible ? View.GONE : View.INVISIBLE); if (listener != null) listener.onAnimationEnd(animation); } }); anim.setDuration(300); anim.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 v a 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, @Nullable Animator.AnimatorListener lis) { v.setVisibility(View.VISIBLE); int finalRadius = Math.max(v.getWidth(), v.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(v, centerX, centerY, 0, finalRadius); anim.setDuration(REVEAL_DURATION);/*from ww w . ja v a 2s . co m*/ if (lis != null) anim.addListener(lis); 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); }/* w w w .j a v a2s . c o m*/ animator.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 www . ja va2s . c o 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(); }