List of usage examples for android.animation Animator end
public void end()
From source file:Main.java
/** * call function and end/* w w w .j av a2 s. co m*/ * * @param animator * @return */ public static boolean end(Animator animator) { if (animator != null && animator.isStarted()) { animator.end(); return true; } return false; }
From source file:com.google.samples.apps.iosched.util.LPreviewUtilsBase.java
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate) { final int imageResId = isCheck ? R.drawable.add_schedule_button_icon_checked : R.drawable.add_schedule_button_icon_unchecked; if (imageView.getTag() != null) { if (imageView.getTag() instanceof Animator) { Animator anim = (Animator) imageView.getTag(); anim.end(); imageView.setAlpha(1f);//from www .j a v a 2 s. co m } } if (allowAnimate && isCheck) { int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime); Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f); outAnimator.setDuration(duration / 2); outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setImageResource(imageResId); } }); AnimatorSet inAnimator = new AnimatorSet(); outAnimator.setDuration(duration); inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f)); AnimatorSet set = new AnimatorSet(); set.playSequentially(outAnimator, inAnimator); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setTag(null); } }); imageView.setTag(set); set.start(); } else { mHandler.post(new Runnable() { @Override public void run() { imageView.setImageResource(imageResId); } }); } }
From source file:fr.paug.droidcon.util.LPreviewUtilsBase.java
public void setOrAnimatePlusCheckIcon(final ImageView imageView, boolean isCheck, boolean allowAnimate, int resIdChecked) { final int imageResId = isCheck ? resIdChecked : R.drawable.add_schedule_button_icon_unchecked; if (imageView.getTag() != null) { if (imageView.getTag() instanceof Animator) { Animator anim = (Animator) imageView.getTag(); anim.end(); imageView.setAlpha(1f);/*from w w w . j a v a 2s.c o m*/ } } if (allowAnimate && isCheck) { int duration = mActivity.getResources().getInteger(android.R.integer.config_shortAnimTime); Animator outAnimator = ObjectAnimator.ofFloat(imageView, View.ALPHA, 0f); outAnimator.setDuration(duration / 2); outAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setImageResource(imageResId); } }); AnimatorSet inAnimator = new AnimatorSet(); outAnimator.setDuration(duration); inAnimator.playTogether(ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_X, 0f, 1f), ObjectAnimator.ofFloat(imageView, View.SCALE_Y, 0f, 1f)); AnimatorSet set = new AnimatorSet(); set.playSequentially(outAnimator, inAnimator); set.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { imageView.setTag(null); } }); imageView.setTag(set); set.start(); } else { mHandler.post(new Runnable() { @Override public void run() { imageView.setImageResource(imageResId); } }); } }
From source file:com.devilyang.musicstation.swinginadapters.AnimationAdapter.java
private void cancelExistingAnimation(int position, View convertView) { int hashCode = convertView.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode);//w ww . jav a2s . c o m } }
From source file:com.hadis.mylunbo.carrousel.CircleIndicator.java
private void addIndicator(@DrawableRes int backgroundDrawableId, Animator animator) { if (animator.isRunning()) { animator.end(); animator.cancel();/* www.j a va 2 s . c o m*/ } 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(); }
From source file:com.android.clear.reminder.ItemAnimator.java
@Override public void endAnimations() { final List<Animator> animatorList = new ArrayList<>(mAnimators.values()); for (Animator animator : animatorList) { animator.end(); }/* w w w. j av a 2 s . co m*/ dispatchFinishedWhenDone(); }
From source file:com.dalingge.gankio.common.widgets.recyclerview.anim.adapter.helper.ViewAnimator.java
/** * Cancels any existing animations for given View. *//*from ww w .j av a2 s . co m*/ public void cancelExistingAnimation(@NonNull final View view) { int hashCode = view.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode); } }
From source file:com.xianxiaotao.copyandstudy.xcopy.recycleranim.adapter.helper.ViewAnimator.java
/** * Cancels any existing animations for given View. *//*from w ww. j av a2 s . c o m*/ @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void cancelExistingAnimation(@NonNull final View view) { int hashCode = view.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) { animator.end(); mAnimators.remove(hashCode); } }
From source file:com.hippo.vectorold.drawable.AnimatedVectorDrawable.java
@Override public void stop() { final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators; final int size = animators.size(); for (int i = 0; i < size; i++) { final Animator animator = animators.get(i); animator.end(); }//www . j a v a 2 s. co m }
From source file:eu.davidea.flexibleadapter.FlexibleAnimatorAdapter.java
/** * Cancels any existing animations for given View. Useful when fling. */// w ww . j a va 2 s .c o m private void cancelExistingAnimation(@NonNull final View itemView) { int hashCode = itemView.hashCode(); Animator animator = mAnimators.get(hashCode); if (animator != null) animator.end(); }