Java Code Examples for com.nineoldandroids.animation.Animator#cancel()
The following examples show how to use
com.nineoldandroids.animation.Animator#cancel() .
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: ViewPropertyAnimatorPreHC.java From Mover with Apache License 2.0 | 6 votes |
@Override public void cancel() { if (mAnimatorMap.size() > 0) { HashMap<Animator, PropertyBundle> mAnimatorMapCopy = (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone(); Set<Animator> animatorSet = mAnimatorMapCopy.keySet(); for (Animator runningAnim : animatorSet) { runningAnim.cancel(); } } mPendingAnimations.clear(); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); } }
Example 2
Source File: ViewPropertyAnimatorHC.java From Mover with Apache License 2.0 | 6 votes |
@Override public void cancel() { if (mAnimatorMap.size() > 0) { HashMap<Animator, PropertyBundle> mAnimatorMapCopy = (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone(); Set<Animator> animatorSet = mAnimatorMapCopy.keySet(); for (Animator runningAnim : animatorSet) { runningAnim.cancel(); } } mPendingAnimations.clear(); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); } }
Example 3
Source File: SupportAnimatorPreL.java From material-sheet-fab with MIT License | 5 votes |
@Override public void cancel() { Animator a = mAnimator.get(); if(a != null){ a.cancel(); } }
Example 4
Source File: ContextualUndoAdapter.java From ALLGO with Apache License 2.0 | 5 votes |
@Override public void onMovedToScrapHeap(View view) { Animator animator = mActiveAnimators.get(view); if (animator != null) { animator.cancel(); } }
Example 5
Source File: BaseIndicatorController.java From AndroidPlayground with MIT License | 5 votes |
/** * make animation to start or end when target * view was be Visible or Gone or Invisible. * make animation to cancel when target view * be onDetachedFromWindow. * @param animStatus */ public void setAnimationStatus(AnimStatus animStatus){ if (mAnimators==null){ return; } int count=mAnimators.size(); for (int i = 0; i < count; i++) { Animator animator=mAnimators.get(i); boolean isRunning=animator.isRunning(); switch (animStatus){ case START: if (!isRunning){ animator.start(); } break; case END: if (isRunning){ animator.end(); } break; case CANCEL: if (isRunning){ animator.cancel(); } break; } } }
Example 6
Source File: SupportAnimatorPreL.java From fab-transformation with MIT License | 5 votes |
@Override public void cancel() { Animator a = mAnimator.get(); if (a != null) { a.cancel(); } }
Example 7
Source File: ViewPropertyAnimatorPreHC.java From Mover with Apache License 2.0 | 5 votes |
/** * Utility function, called by animateProperty() and animatePropertyBy(), which handles the * details of adding a pending animation and posting the request to start the animation. * * @param constantName The specifier for the property being animated * @param startValue The starting value of the property * @param byValue The amount by which the property will change */ private void animatePropertyBy(int constantName, float startValue, float byValue) { // First, cancel any existing animations on this property if (mAnimatorMap.size() > 0) { Animator animatorToCancel = null; Set<Animator> animatorSet = mAnimatorMap.keySet(); for (Animator runningAnim : animatorSet) { PropertyBundle bundle = mAnimatorMap.get(runningAnim); if (bundle.cancel(constantName)) { // property was canceled - cancel the animation if it's now empty // Note that it's safe to break out here because every new animation // on a property will cancel a previous animation on that property, so // there can only ever be one such animation running. if (bundle.mPropertyMask == NONE) { // the animation is no longer changing anything - cancel it animatorToCancel = runningAnim; break; } } } if (animatorToCancel != null) { animatorToCancel.cancel(); } } NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue); mPendingAnimations.add(nameValuePair); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); v.post(mAnimationStarter); } }
Example 8
Source File: ViewPropertyAnimatorHC.java From Mover with Apache License 2.0 | 5 votes |
/** * Utility function, called by animateProperty() and animatePropertyBy(), which handles the * details of adding a pending animation and posting the request to start the animation. * * @param constantName The specifier for the property being animated * @param startValue The starting value of the property * @param byValue The amount by which the property will change */ private void animatePropertyBy(int constantName, float startValue, float byValue) { // First, cancel any existing animations on this property if (mAnimatorMap.size() > 0) { Animator animatorToCancel = null; Set<Animator> animatorSet = mAnimatorMap.keySet(); for (Animator runningAnim : animatorSet) { PropertyBundle bundle = mAnimatorMap.get(runningAnim); if (bundle.cancel(constantName)) { // property was canceled - cancel the animation if it's now empty // Note that it's safe to break out here because every new animation // on a property will cancel a previous animation on that property, so // there can only ever be one such animation running. if (bundle.mPropertyMask == NONE) { // the animation is no longer changing anything - cancel it animatorToCancel = runningAnim; break; } } } if (animatorToCancel != null) { animatorToCancel.cancel(); } } NameValuesHolder nameValuePair = new NameValuesHolder(constantName, startValue, byValue); mPendingAnimations.add(nameValuePair); View v = mView.get(); if (v != null) { v.removeCallbacks(mAnimationStarter); v.post(mAnimationStarter); } }
Example 9
Source File: SupportAnimatorPreL.java From RecyclerView-Animation-Demo with Apache License 2.0 | 5 votes |
@Override public void cancel() { Animator a = mAnimator.get(); if(a != null){ a.cancel(); } }
Example 10
Source File: SupportAnimatorPreL.java From fab-toolbar with MIT License | 5 votes |
@Override public void cancel() { Animator a = mAnimator.get(); if(a != null){ a.cancel(); } }
Example 11
Source File: LockHeaderView.java From PullRefreshView with Apache License 2.0 | 5 votes |
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_REFRESH: break; case REFRESHING: animators.add(AnimUtil.startShow(progress, 0.1f, 200, 0)); animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case REFRESH_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
Example 12
Source File: ExpandFooterView.java From PullRefreshView with Apache License 2.0 | 5 votes |
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.VISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_LOAD: break; case LOADING: animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case LOAD_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
Example 13
Source File: ExpandHeaderView.java From PullRefreshView with Apache License 2.0 | 5 votes |
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.VISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_REFRESH: break; case REFRESHING: animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case REFRESH_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
Example 14
Source File: LockFooterView.java From PullRefreshView with Apache License 2.0 | 5 votes |
@Override protected void onStateChange(int state) { this.state = state; for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); ViewHelper.setAlpha(progress, 1f); switch (state) { case NONE: break; case PULLING: break; case LOOSENT_O_LOAD: break; case LOADING: animators.add(AnimUtil.startShow(progress, 0.1f, 200, 0)); animators.add(AnimUtil.startRotation(progress, ViewHelper.getRotation(progress) + 359.99f, 500, 0, -1)); break; case LOAD_CLONE: animators.add(AnimUtil.startShow(stateImg, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(progress)); break; } }
Example 15
Source File: EndFooterView.java From PullRefreshView with Apache License 2.0 | 5 votes |
@Override protected void onStateChange(int state) { for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); textView.setVisibility(View.VISIBLE); tagImg.setVisibility(View.VISIBLE); ViewHelper.setAlpha(textView, 1); ViewHelper.setAlpha(tagImg, 1); switch (state) { case NONE: case PULLING: textView.setText("上拉加载更多"); animators.add(AnimUtil.startRotation(tagImg, 0)); break; case LOOSENT_O_LOAD: textView.setText("松开加载"); animators.add(AnimUtil.startRotation(tagImg, 180)); break; case LOADING: textView.setText("正在加载"); animators.add(AnimUtil.startShow(progress, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(textView)); animators.add(AnimUtil.startHide(tagImg)); break; case LOAD_CLONE: animators.add(AnimUtil.startScale(stateImg, 0.3f, 1f, 500, 50, new OvershootInterpolator())); animators.add(AnimUtil.startShow(stateImg, 0.1f, 300, 150)); animators.add(AnimUtil.startHide(progress, 150, 0)); textView.setVisibility(View.INVISIBLE); tagImg.setVisibility(View.INVISIBLE); textView.setText("加载完成"); break; } }
Example 16
Source File: NormalHeaderView.java From PullRefreshView with Apache License 2.0 | 4 votes |
@Override protected void onStateChange(int state) { if (textView == null || tagImg == null || progress == null || stateImg == null) { return; } for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); textView.setVisibility(View.VISIBLE); tagImg.setVisibility(View.VISIBLE); ViewHelper.setAlpha(textView, 1); ViewHelper.setAlpha(tagImg, 1); ViewHelper.setTranslationY(stateImg, 0); ViewHelper.setTranslationY(progress, 0); switch (state) { case NONE: break; case PULLING: textView.setText("下拉刷新"); animators.add(AnimUtil.startRotation(tagImg, 0)); break; case LOOSENT_O_REFRESH: textView.setText("松开刷新"); animators.add(AnimUtil.startRotation(tagImg, 180)); break; case REFRESHING: textView.setText("正在刷新"); animators.add(AnimUtil.startShow(progress, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(textView)); animators.add(AnimUtil.startHide(tagImg)); break; case REFRESH_CLONE: animators.add(AnimUtil.startFromY(stateImg, -2 * stateImg.getHeight())); animators.add(AnimUtil.startToY(progress, 2 * progress.getHeight())); stateImg.setVisibility(View.VISIBLE); progress.setVisibility(View.VISIBLE); textView.setVisibility(View.INVISIBLE); tagImg.setVisibility(View.INVISIBLE); textView.setText("刷新完成"); break; } }
Example 17
Source File: NormalFooterView.java From PullRefreshView with Apache License 2.0 | 4 votes |
@Override protected void onStateChange(int state) { for (Animator animator : animators) { animator.cancel(); } animators.clear(); stateImg.setVisibility(View.INVISIBLE); progress.setVisibility(View.INVISIBLE); textView.setVisibility(View.VISIBLE); tagImg.setVisibility(View.VISIBLE); ViewHelper.setAlpha(textView, 1); ViewHelper.setAlpha(tagImg, 1); switch (state) { case NONE: break; case PULLING: textView.setText("上拉加载更多"); animators.add(AnimUtil.startRotation(tagImg, 0)); break; case LOOSENT_O_LOAD: textView.setText("松开加载"); animators.add(AnimUtil.startRotation(tagImg, 180)); break; case LOADING: textView.setText("正在加载"); animators.add(AnimUtil.startShow(progress, 0.1f, 400, 200)); animators.add(AnimUtil.startHide(textView)); animators.add(AnimUtil.startHide(tagImg)); break; case LOAD_CLONE: animators.add(AnimUtil.startScale(stateImg, 0.3f, 1f, 500, 50, new OvershootInterpolator())); animators.add(AnimUtil.startShow(stateImg, 0.1f, 300, 150)); animators.add(AnimUtil.startHide(progress, 150, 0)); textView.setVisibility(View.INVISIBLE); tagImg.setVisibility(View.INVISIBLE); textView.setText("加载完成"); break; } }
Example 18
Source File: ArcAnimator.java From MousePaint with MIT License | 4 votes |
@Override public void cancel() { super.cancel(); Animator a = mAnimator.get(); if(a != null) a.cancel(); }