summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2010-02-09 11:30:44 -0800
committerJim Miller <jaggies@google.com>2010-02-17 20:49:10 -0800
commit8368ef0b670f8193f3161671b119e78b1fb659a1 (patch)
treebcb0b24ca5668eaf1c2642426ff703f7b6b75337 /core
parent5d72a8dda22cdb0c8e1ded1ca5e5122b0c25bcc7 (diff)
downloadframeworks_base-8368ef0b670f8193f3161671b119e78b1fb659a1.zip
frameworks_base-8368ef0b670f8193f3161671b119e78b1fb659a1.tar.gz
frameworks_base-8368ef0b670f8193f3161671b119e78b1fb659a1.tar.bz2
Manual merge of 40080 DO NOT MERGE
Properly notifies listener when an animation is cancelled. Bug: #2428005.
Diffstat (limited to 'core')
-rw-r--r--core/java/android/view/View.java3
-rw-r--r--core/java/android/view/animation/Animation.java22
2 files changed, 25 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1fc3678..94ff15e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8191,6 +8191,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
* Cancels any animations for this view.
*/
public void clearAnimation() {
+ if (mCurrentAnimation != null) {
+ mCurrentAnimation.cancel();
+ }
mCurrentAnimation = null;
}
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index c8396c4..3e107df 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -256,6 +256,28 @@ public abstract class Animation implements Cloneable {
}
/**
+ * Cancel the animation. Cancelling an animation invokes the animation
+ * listener, if set, to notify the end of the animation.
+ *
+ * If you cancel an animation manually, you must call {@link #reset()}
+ * before starting the animation again.
+ *
+ * @see #reset()
+ * @see #start()
+ * @see #startNow()
+ * @hide
+ */
+ public void cancel() {
+ if (mStarted && !mEnded) {
+ if (mListener != null) mListener.onAnimationEnd(this);
+ mEnded = true;
+ }
+ // Make sure we move the animation to the end
+ mStartTime = Long.MIN_VALUE;
+ mMore = mOneMoreTime = false;
+ }
+
+ /**
* Whether or not the animation has been initialized.
*
* @return Has this animation been initialized.