List of usage examples for android.animation Animator cancel
public void cancel()
From source file:Main.java
public static void stopAnimator(Animator animator) { if (animator != null && animator.isRunning()) { animator.cancel(); }// w w w. ja va 2 s . c om }
From source file:Main.java
public static void deleteAnimator(Animator animator) { if (animator != null && animator.isRunning()) { animator.cancel(); }/*w w w. ja v a 2 s. co m*/ animator = null; }
From source file:Main.java
/** * cancel/*from www .j a va 2 s.c om*/ * * @param animator * @return */ public static boolean cancel(Animator animator) { if (animator != null) { animator.cancel(); return true; } return false; }
From source file:Main.java
public static void onDestroyActivity() { HashSet<Animator> animators = new HashSet<Animator>(sAnimators.keySet()); for (Animator a : animators) { if (a.isRunning()) { a.cancel(); }/* w w w . j ava 2s. c o m*/ sAnimators.remove(a); } }
From source file:Main.java
public static void onDestroyActivity() { HashSet<Animator> animators = new HashSet<Animator>(sAnimators); for (Animator a : animators) { if (a.isRunning()) { a.cancel(); } else {/*w w w .j a v a 2 s. com*/ sAnimators.remove(a); } } }
From source file:Main.java
/** * Cancels an animation ensuring that if it has listeners, onCancel and onEnd * are not called.//from w ww . j a v a2s . com */ public static void cancelAnimationWithoutCallbacks(Animator animator) { if (animator != null) { animator.removeAllListeners(); animator.cancel(); } }
From source file:Main.java
@SuppressLint("NewApi") public static void pauseOrStopAnimator(Animator animator) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { animator.pause();/*from ww w. j a v a2 s.c om*/ } else { animator.cancel(); } }
From source file:im.ene.ribbon.MiscUtils.java
protected static void switchColor(final BottomNavigationView navigation, final View v, final View backgroundOverlay, final ColorDrawable backgroundDrawable, final int newColor) { backgroundOverlay.clearAnimation();//from w ww . j a va2s .c o m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Animator currentAnimator = (Animator) backgroundOverlay.getTag(R.id.ribbon_background_overlay_animator); if (null != currentAnimator) { currentAnimator.cancel(); } } backgroundDrawable.setColor(newColor); backgroundOverlay.setVisibility(View.INVISIBLE); ViewCompat.setAlpha(backgroundOverlay, 1); }
From source file:im.ene.ribbon.AnimUtil.java
static void animate(BottomNavigationView parent, View view, final View backgroundOverlay, final ColorDrawable backgroundDrawable, final int newColor, long duration) { int centerX = (int) (ViewCompat.getX(view) + (view.getWidth() / 2)); int centerY = parent.getPaddingTop() + view.getHeight() / 2; backgroundOverlay.clearAnimation();/*from w w w .ja v a 2s . c om*/ final Object animator; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Animator currentAnimator = (Animator) backgroundOverlay.getTag(R.id.ribbon_background_overlay_animator); if (currentAnimator != null) { //currentAnimator.end(); currentAnimator.cancel(); } final float startRadius = 1; final float finalRadius = centerX > parent.getWidth() / 2 ? centerX : parent.getWidth() - centerX; animator = ViewAnimationUtils.createCircularReveal(backgroundOverlay, centerX, centerY, startRadius, finalRadius); backgroundOverlay.setTag(R.id.ribbon_background_overlay_animator, animator); } else { ViewCompat.setAlpha(backgroundOverlay, 0); animator = ViewCompat.animate(backgroundOverlay).alpha(1); } backgroundOverlay.setBackgroundColor(newColor); backgroundOverlay.setVisibility(View.VISIBLE); if (animator instanceof ViewPropertyAnimatorCompat) { ((ViewPropertyAnimatorCompat) animator).setListener(new ViewPropertyAnimatorListener() { boolean cancelled; @Override public void onAnimationStart(final View view) { } @Override public void onAnimationEnd(final View view) { if (!cancelled) { backgroundDrawable.setColor(newColor); backgroundOverlay.setVisibility(View.INVISIBLE); ViewCompat.setAlpha(backgroundOverlay, 1); } } @Override public void onAnimationCancel(final View view) { cancelled = true; } }).setDuration(duration).start(); } else { Animator animator1 = (Animator) animator; animator1.setDuration(duration); animator1.setInterpolator(new DecelerateInterpolator()); animator1.addListener(new Animator.AnimatorListener() { boolean cancelled; @Override public void onAnimationStart(final Animator animation) { } @Override public void onAnimationEnd(final Animator animation) { if (!cancelled) { backgroundDrawable.setColor(newColor); backgroundOverlay.setVisibility(View.INVISIBLE); ViewCompat.setAlpha(backgroundOverlay, 1); } } @Override public void onAnimationCancel(final Animator animation) { cancelled = true; } @Override public void onAnimationRepeat(final Animator animation) { } }); animator1.start(); } }
From source file:com.hadis.mylunbo.carrousel.CircleIndicator.java
private void addIndicator(@DrawableRes int backgroundDrawableId, Animator animator) { if (animator.isRunning()) { animator.end();/*from w ww .ja va2 s . c om*/ animator.cancel(); } View Indicator = new View(getContext()); Indicator.setBackgroundResource(backgroundDrawableId); addView(Indicator, mIndicatorWidth, mIndicatorHeight); LayoutParams lp = (LayoutParams) Indicator.getLayoutParams(); lp.leftMargin = mIndicatorMargin; lp.rightMargin = mIndicatorMargin; Indicator.setLayoutParams(lp); animator.setTarget(Indicator); animator.start(); }